예제 #1
0
파일: Main.cs 프로젝트: JBPKII/PRUSA3D
        private void CmBGoTo_Click(object sender, EventArgs e)
        {
            double X, Y, Z;

            if (double.TryParse(TxtGoToX.Text.Replace('.', ','), out X) && double.TryParse(TxtGoToY.Text.Replace('.', ','), out Y) && double.TryParse(TxtGoToZ.Text.Replace('.', ','), out Z))
            {
                StrokeSLT Origen = new StrokeSLT();
                Origen.Destino   = new VertexSLT(X, Y, Z);
                Origen.Pendiente = true;

                switch (CBModo.SelectedItem)
                {
                case "Relleno":
                    Origen.Mode = Modes.ModoFill;
                    break;

                case "Bordes":
                    Origen.Mode = Modes.ModoRim;
                    break;

                case "Traslación":
                default:
                    Origen.Mode = Modes.ModeTraslation;
                    break;
                }

                Controller.Interpreter.SendStroke(Origen);
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("Los valores de coordenadas no son válidos.", "ir a:", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        internal bool SendStroke(StrokeSLT Trazo, double mmMaterial = 0.0)
        {
            bool Res = false;

            if (IsTest)
            {
                mmMaterial = 0.0;
            }

            Trazo.E = mmMaterial;

            try
            {
                SerialPort.WriteLine(Trazo.ToPrinter());

                OnLog("SEND: " + Trazo.ToPrinter());

                Res = true;
            }
            catch (System.Exception sysEx)
            {
                System.Windows.Forms.MessageBox.Show(sysEx.ToString());
            }

            return(Res);
        }
예제 #3
0
파일: Main.cs 프로젝트: JBPKII/PRUSA3D
        private void CmBOrigen_Click(object sender, EventArgs e)
        {
            StrokeSLT Origen = new StrokeSLT();

            Origen.Destino   = new VertexSLT(0.0, 0.0, 0.0);
            Origen.Pendiente = true;
            //Origen.Mode = Modes.ModeTraslation;

            switch (CBModo.SelectedItem)
            {
            case "Relleno":
                Origen.Mode = Modes.ModoFill;
                break;

            case "Bordes":
                Origen.Mode = Modes.ModoRim;
                break;

            case "Traslación":
            default:
                Origen.Mode = Modes.ModeTraslation;
                break;
            }

            Controller.Interpreter.SendStroke(Origen);
        }
예제 #4
0
        public IList <StrokeSLT> TrazarPerimetro(Modes M)
        {
            IList <StrokeSLT> Res = new List <StrokeSLT>();

            if (_Puntos.Count > 0)
            {
                foreach (Punto p in _Puntos)
                {
                    StrokeSLT TempTrazo = new StrokeSLT();
                    TempTrazo.Pendiente = true;
                    if (Res.Count == 0)
                    {
                        TempTrazo.Mode = Modes.ModeTraslation;
                    }
                    else
                    {
                        TempTrazo.Mode = M;
                    }
                    TempTrazo.Destino = new VertexSLT(p.X, p.Y, p.Z);

                    Res.Add(TempTrazo);
                }

                //cierro
                StrokeSLT TempT = new StrokeSLT();
                TempT.Pendiente = true;
                TempT.Mode      = Modes.ModoRim;
                TempT.Destino   = new VertexSLT(_Puntos[0].X, _Puntos[0].Y, _Puntos[0].Z);

                Res.Add(TempT);
            }

            return(Res);
        }
예제 #5
0
        private void OnStop()
        {
            Status = PrinterStatus.Stoped;

            double gapInMilimetres = 50.0 /*mm*/;

            try
            {
                Interpreter.RequireCommand -= PrinterInterpreter_RequireCommand;
            }
            catch (Exception)
            { }

            Interpreter.SendTemperature();

            // Presenta el trazado
            StrokeSLT trzPresent = new StrokeSLT();

            trzPresent.Destino   = new VertexSLT(lastPoint.X, lastPoint.Y, lastPoint.Z + gapInMilimetres /*mm*/);
            trzPresent.E         = 0.0;
            trzPresent.Mode      = Modes.ModeTraslation;
            trzPresent.Pendiente = true;
            Interpreter.SendStroke(trzPresent);

            trzPresent.Destino   = new VertexSLT(0.0, 0.0, lastPoint.Z + gapInMilimetres /*mm*/);
            trzPresent.E         = 0.0;
            trzPresent.Mode      = Modes.ModeTraslation;
            trzPresent.Pendiente = true;
            Interpreter.SendStroke(trzPresent);
        }
예제 #6
0
        public void Print(bool isTest = false)
        {
            if (Status != PrinterStatus.Printing)
            {
                Status = PrinterStatus.Printing;

                Interpreter.IsTest          = isTest;
                Interpreter.RequireCommand += PrinterInterpreter_RequireCommand;

                Interpreter.SendTemperature(225.0);

                /*if (_TImprimir == null || !_TImprimir.IsAlive)
                 * {
                 *  _TImprimir = new Thread(new ThreadStart(_Draw));
                 *  _TImprimir.Start();
                 * }
                 * else
                 * {
                 *  //avisa de que ya está en ejecución
                 *  System.Windows.Forms.MessageBox.Show("Proceso de impresión ejecutándose.");
                 * }*/

                StrokeSLT _Trazo = null;

                //Printing = true;

                /*_TGenerarLayer = new Thread(new ThreadStart(_GeneraLayer));
                 * _TGenerarLayer.Start();
                 * _GenerandoLayer = true;*/

                Model.GenerateLayer();

                /*while(_GenerandoLayer )
                 * {
                 *  System.Threading.Thread.Sleep(500);
                 * }*/

                Model.ChangeLayer();

                /*_TGenerarLayer = new Thread(new ThreadStart(_GeneraLayer));
                 * _TGenerarLayer.Start();*/

                Model.GenerateLayer();


                //if (ZCalculo <= Solido.Top)

                //IsTrazando = true;

                _Trazo = Model.FirstStroke();

                //Para calcular la distancia del trazado
                lastPoint = new Punto(_Trazo.Destino.X, _Trazo.Destino.Y, _Trazo.Destino.Z);

                //Envía el trazo
                Interpreter.SendStroke(_Trazo);
            }
        }
예제 #7
0
        private void PrinterInterpreter_RequireCommand()
        {
            // _SendNextStroke = true;

            StrokeSLT strokeSLT = Model.NextStroke();

            if (strokeSLT != null)
            {
                Punto  current  = new Punto(strokeSLT.Destino.X, strokeSLT.Destino.Y, strokeSLT.Destino.Z);
                double distance = lastPoint.Distancia(current);
                lastPoint = current;

                Interpreter.SendStroke(strokeSLT, distance);
            }
            else
            {
                OnStop();
            }
        }