コード例 #1
0
ファイル: Traduce.cs プロジェクト: echicerman/cncmatic
        public static List<string> Puntos(ReadOnlyCollection<DXF.Entidades.Punto> puntos)
        {
            G01_Lineal mov;
            List<string> movs = new List<string>();

            foreach (DXF.Entidades.Punto p in puntos)
            {
                mov = new G01_Lineal();

                mov.Inicio.X = p.Ubicacion.X;
                mov.Inicio.Y = p.Ubicacion.Y;
                mov.Inicio.Z = p.Ubicacion.Z;

                mov.Fin.X = p.Ubicacion.X;
                mov.Fin.Y = p.Ubicacion.Y;
                mov.Fin.Z = p.Ubicacion.Z;

                movs.Add(Metodos.IrA(mov.Inicio.X, mov.Inicio.Y, mov.Inicio.Z));
                movs.Add(mov.ToString());

            }

            return movs;
        }
コード例 #2
0
ファイル: Traduce.cs プロジェクト: echicerman/cncmatic
        public static List<string> Punto(DXF.Entidades.Punto p)
        {
            G01_Lineal mov;
            List<string> movs = new List<string>();

            mov = new G01_Lineal();

            mov.Inicio.X = p.Ubicacion.X;
            mov.Inicio.Y = p.Ubicacion.Y;
            mov.Inicio.Z = p.Ubicacion.Z;

            mov.Fin.X = p.Ubicacion.X;
            mov.Fin.Y = p.Ubicacion.Y;
            mov.Fin.Z = p.Ubicacion.Z;

            movs.Add(mov.ToString());
            return movs;
        }
コード例 #3
0
ファイル: Traduce.cs プロジェクト: echicerman/cncmatic
        public static List<string> Polilineas(ReadOnlyCollection<IPolilinea> polilineas)
        {
            G01_Lineal mov;
            List<string> movs = new List<string>();

            foreach (IPolilinea p in polilineas)
            {
                //movs.Add("<polilinea>");

                Polilinea pi = new Polilinea();

                if (p.Tipo == EntidadTipo.Polilinea)
                {
                    pi = (Polilinea)p;
                }
                if (p.Tipo == EntidadTipo.LightWeightPolyline)
                {
                    pi = ((LightWeightPolyline)p).ToPolilinea();
                }

                int i = 0;
                foreach (PolylineVertex v in pi.Vertexes)
                {
                    mov = new G01_Lineal();

                    mov.Inicio.X = v.Location.X;
                    mov.Inicio.Y = v.Location.Y;
                    mov.Inicio.Z = pi.Elevation;

                    mov.Fin.X = v.Location.X;
                    mov.Fin.Y = v.Location.Y;
                    mov.Fin.Z = pi.Elevation;

                    if (i == 0)
                    {
                        movs.Add(Metodos.IrA(mov.Inicio.X, mov.Inicio.Y, mov.Inicio.Z));
                    }
                    else if (i == 1)
                    {
                        //movs.Add(Metodos.IrA(pi.Vertexes[i - 1].Location.X, pi.Vertexes[i - 1].Location.Y, 0));
                        movs.Add(mov.ToString());
                    }
                    else
                    {
                        movs.Add(Metodos.IrA(pi.Vertexes[i - 1].Location.X, pi.Vertexes[i - 1].Location.Y, pi.Elevation));
                        movs.Add(mov.ToString());
                    }
                    i++;
                }

                if (pi.IsClosed) //si es cerrado, adicionalmente agregamos ir al inicio
                {
                    mov = new G01_Lineal();

                    mov.Inicio.X = pi.Vertexes[0].Location.X;
                    mov.Inicio.Y = pi.Vertexes[0].Location.Y;
                    mov.Inicio.Z = pi.Elevation;

                    mov.Fin.X = pi.Vertexes[0].Location.X;
                    mov.Fin.Y = pi.Vertexes[0].Location.Y;
                    mov.Fin.Z = pi.Elevation;

                    //movs.Add(Metodos.IrA(pi.Vertexes[i - 1].Location.X, pi.Vertexes[i - 1].Location.Y, pi.Elevation));
                    movs.Add(mov.ToString());
                }

                //movs.Add("</polilinea>");
            }

            return movs;
        }
コード例 #4
0
ファイル: Traduce.cs プロジェクト: echicerman/cncmatic
        public static List<string> Polilinea(IPolilinea p)
        {
            G01_Lineal mov;
            List<string> movs = new List<string>();

            Polilinea pi = new Polilinea();

            if (p.Tipo == EntidadTipo.Polilinea)
            {
                pi = (Polilinea)p;
            }
            if (p.Tipo == EntidadTipo.LightWeightPolyline)
            {
                pi = ((LightWeightPolyline)p).ToPolilinea();
            }

            foreach (PolylineVertex v in pi.Vertexes)
            {
                mov = new G01_Lineal();

                mov.Inicio.X = v.Location.X;
                mov.Inicio.Y = v.Location.Y;
                mov.Inicio.Z = pi.Elevation;

                mov.Fin.X = v.Location.X;
                mov.Fin.Y = v.Location.Y;
                mov.Fin.Z = pi.Elevation;

                movs.Add(mov.ToString());

            }

            if (pi.IsClosed) //si es cerrado, adicionalmente agregamos ir al inicio
            {
                mov = new G01_Lineal();

                mov.Inicio.X = pi.Vertexes[pi.Vertexes.Count - 1].Location.X;
                mov.Inicio.Y = pi.Vertexes[pi.Vertexes.Count - 1].Location.Y;
                mov.Inicio.Z = pi.Elevation;

                mov.Fin.X = pi.Vertexes[0].Location.X;
                mov.Fin.Y = pi.Vertexes[0].Location.Y;
                mov.Fin.Z = pi.Elevation;

                movs.Add(mov.ToString());
            }
            return movs;
        }
コード例 #5
0
ファイル: Traduce.cs プロジェクト: echicerman/cncmatic
        public static List<string> Lineas(ReadOnlyCollection<Linea> lineas)
        {
            G01_Lineal mov;
            List<string> movs = new List<string>();

            foreach (Linea l in lineas)
            {
                mov = new G01_Lineal();

                mov.Inicio.X = l.PuntoInicio.X;
                mov.Inicio.Y = l.PuntoInicio.Y;
                mov.Inicio.Z = l.PuntoInicio.Z;

                mov.Fin.X = l.PuntoFinal.X;
                mov.Fin.Y = l.PuntoFinal.Y;
                mov.Fin.Z = l.PuntoFinal.Z;

                movs.Add(Metodos.IrA(mov.Inicio.X, mov.Inicio.Y, mov.Inicio.Z));
                movs.Add(mov.ToString());

            }

            return movs;
        }
コード例 #6
0
ファイル: Traduce.cs プロジェクト: echicerman/cncmatic
        public static List<string> Linea(Linea l)
        {
            G01_Lineal mov;
            List<string> movs = new List<string>();

            mov = new G01_Lineal();

            mov.Inicio.X = l.PuntoInicio.X;
            mov.Inicio.Y = l.PuntoInicio.Y;
            mov.Inicio.Z = l.PuntoInicio.Z;

            mov.Fin.X = l.PuntoFinal.X;
            mov.Fin.Y = l.PuntoFinal.Y;
            mov.Fin.Z = l.PuntoFinal.Z;

            movs.Add(mov.ToString());

            return movs;
        }