Beispiel #1
0
 public PrinterInfo()
 {
     con = Main.conn;
     InitializeComponent();
     RegMemory.RestoreWindowPos("printerInfoWindow", this);
     timer_Tick(null, null);
 }
        protected virtual void CaptureState(PrinterConnection conn)
        {
            GCodeAnalyzer analyzer = conn.analyzer;

            this.x = analyzer.RealX;
            this.y = analyzer.RealY;
            this.z = analyzer.RealZ;
            this.fanVoltage = analyzer.fanVoltage;
            this.fanOn = analyzer.fanOn;
            this.speed = analyzer.f;
            this.layer = analyzer.layer;
            this.extrudersTemp = new float[conn.extruderTemp.Count];
            for (int extr = 0; extr < conn.extruderTemp.Count; extr++)
            {
                // Use the configured temperature, not the measured
                // temperature.
                this.extrudersTemp[extr] = conn.analyzer.getTemperature(extr);
                //this.extrudersTemp[extr] = conn.extruderTemp[extr];
            }
            // Use the configured temperature, not the measured temperature.
            this.bedTemp = conn.analyzer.bedTemp;
            //this.bedTemp = conn.bedTemp;
            this.activeExtruderId = analyzer.activeExtruderId;
            this.relative = analyzer.relative;
            this.activeExtruderValue = analyzer.activeExtruder.e - analyzer.activeExtruder.eOffset;
        }
Beispiel #3
0
 public Main()
 {
     repetierKey = Registry.CurrentUser.CreateSubKey("Software\\Repetier");
     main = this;
     generator = new GCodeGenerator();
     globalSettings = new GlobalSettings();
     conn = new PrinterConnection();
     printerSettings = new FormPrinterSettings();
     threeDSettings = new ThreeDSettings();
     InitializeComponent();
     conn.eventConnectionChange += OnPrinterConnectionChange;
     conn.eventPrinterAction += OnPrinterAction;
     conn.eventJobProgress += OnJobProgress;
     printPanel = new PrintPanel();
     printPanel.Dock = DockStyle.Fill;
     splitContainerPrinterGraphic.Panel1.Controls.Add(printPanel);
     logView = new LogView();
     logView.Dock = DockStyle.Fill;
     splitVert.Panel2.Controls.Add(logView);
     skeinforge = new Skeinforge();
     PrinterChanged(printerSettings.currentPrinterKey,true);
     printerSettings.eventPrinterChanged += PrinterChanged;
     // GCode print preview
     printPreview = new ThreeDControl();
     printPreview.Dock = DockStyle.Fill;
     splitContainerPrinterGraphic.Panel2.Controls.Add(printPreview);
     printPreview.SetEditor(false);
     printPreview.AutoUpdateable = true;
     printVisual = new GCodeVisual(conn.analyzer);
     printPreview.models.AddLast(printVisual);
     basicTitle = Text;
 }
Beispiel #4
0
        public PrintPanel()
        {
            InitializeComponent();
            con = Main.conn;
            ann = con.analyzer;
            con.eventConnectionChange += ConnectionChanged;
            ann.fanVoltage = trackFanVoltage.Value;
            con.eventTempChange += tempUpdate;
          //  ann.eventPosChanged += coordUpdate;
            ann.eventChange += analyzerChange;
            UpdateConStatus(false);
            textExtrudeSpeed.Text = RegMemory.GetString("panelExtrudeSpeed", textExtrudeSpeed.Text);
            textExtrudeAmount.Text = RegMemory.GetString("panelExtrudeAmount", textExtrudeAmount.Text);
            textRetractAmount.Text = RegMemory.GetString("panelRetractAmount", textRetractAmount.Text);

            float volt = 100f * trackFanVoltage.Value / 255;
            labelVoltage.Text = Trans.T1("L_OUTPUT_PERCENT",volt.ToString("0.0")); //"Output " + volt.ToString("0.0") + "%";
            arrowButtonXMinus.PossibleValues = Custom.GetString("xyMoveDistances", arrowButtonXMinus.PossibleValues);
            arrowButtonXPlus.PossibleValues = Custom.GetString("xyMoveDistances", arrowButtonXPlus.PossibleValues);
            arrowButtonYMinus.PossibleValues = Custom.GetString("xyMoveDistances", arrowButtonYMinus.PossibleValues);
            arrowButtonYPlus.PossibleValues = Custom.GetString("xyMoveDistances", arrowButtonYPlus.PossibleValues);
            if (Custom.GetBool("noPowerControlButton", false))
                switchPower.Visible = false;
            timer.Start();
            comboExtruder.SelectedIndex = 0;
            if (Main.main != null)
            {
                translate();
                Main.main.languageChanged += translate;
            }
        }
        internal static PrintingStateSnapshot GeneratePrintingStateSnapshot(PrinterConnection conn)
        {
            // Analyze status and save state.
            GCodeAnalyzer         analyzer = conn.analyzer;
            PrintingStateSnapshot s        = new PrintingStateSnapshot();

            s.x             = analyzer.RealX;
            s.y             = analyzer.RealY;
            s.z             = analyzer.RealZ;
            s.fanVoltage    = analyzer.fanVoltage;
            s.fanOn         = analyzer.fanOn;
            s.speed         = analyzer.f;
            s.layer         = analyzer.layer;
            s.extrudersTemp = new float[conn.extruderTemp.Count];
            for (int extr = 0; extr < conn.extruderTemp.Count; extr++)
            {
                // Use the configured temperature, not the measured
                // temperature.
                s.extrudersTemp[extr] = conn.analyzer.getTemperature(extr);
                //s.extrudersTemp[extr] = conn.extruderTemp[extr];
            }
            // Use the configured temperature, not the measured temperature.
            s.bedTemp = conn.analyzer.bedTemp;
            //s.bedTemp = conn.bedTemp;
            s.activeExtruderId    = analyzer.activeExtruderId;
            s.relative            = analyzer.relative;
            s.activeExtruderValue = analyzer.activeExtruder.e - analyzer.activeExtruder.eOffset;
            s.remainingCode       = GetRemainingGcode(conn);

            return(s);
        }
        internal static PrintingStateSnapshot GeneratePrintingStateSnapshot(PrinterConnection conn)
        {
            // Analyze status and save state.
            GCodeAnalyzer analyzer = conn.analyzer;
            PrintingStateSnapshot s = new PrintingStateSnapshot();

            s.x = analyzer.RealX;
            s.y = analyzer.RealY;
            s.z = analyzer.RealZ;
            s.fanVoltage = analyzer.fanVoltage;
            s.fanOn = analyzer.fanOn;
            s.speed = analyzer.f;
            s.layer = analyzer.layer;
            s.extrudersTemp = new float[conn.extruderTemp.Count];
            for (int extr = 0; extr < conn.extruderTemp.Count; extr++ )
            {
                // Use the configured temperature, not the measured
                // temperature.
                s.extrudersTemp[extr] = conn.analyzer.getTemperature(extr);
                //s.extrudersTemp[extr] = conn.extruderTemp[extr];
            }
            // Use the configured temperature, not the measured temperature.
            s.bedTemp = conn.analyzer.bedTemp;
            //s.bedTemp = conn.bedTemp;
            s.activeExtruderId = analyzer.activeExtruderId;
            s.relative = analyzer.relative;
            s.activeExtruderValue = analyzer.activeExtruder.e - analyzer.activeExtruder.eOffset;
            s.remainingCode = GetRemainingGcode(conn); 
            
            return s;
        }
 // other snapshot attributes are inherited from PrintingState
 internal static PrintingStateSnapshot GeneratePrintingStateSnapshot(PrinterConnection conn)
 {
     // Analyze status and save state.
     PrintingStateSnapshot s = new PrintingStateSnapshot();
     s.CaptureState(conn);
     s.remainingCode = GetRemainingGcode(conn);
     return s;
 }
 internal static string GetRemainingGcode(PrinterConnection conn)
 {
     StringBuilder remainingCodeSb = new StringBuilder();
     foreach (GCodeCompressed gc in conn.connector.Job.GetPendingJobCommands())
     {
         remainingCodeSb.AppendLine(gc.getCode().orig);
     }
     return remainingCodeSb.ToString();
 }
Beispiel #9
0
 public PrinterInfo()
 {
     con = Main.conn;
     InitializeComponent();
     RegMemory.RestoreWindowPos("printerInfoWindow", this);
     timer_Tick(null, null);
     translate();
     Main.main.languageChanged += translate;
 }
        internal static string GetRemainingGcode(PrinterConnection conn)
        {
            StringBuilder remainingCodeSb = new StringBuilder();

            foreach (GCodeCompressed gc in conn.connector.Job.GetPendingJobCommands())
            {
                remainingCodeSb.AppendLine(gc.getCode().orig);
            }
            return(remainingCodeSb.ToString());
        }
Beispiel #11
0
        public void stats()
        {
            PrinterConnection.logInfo("Path segments:" + segments.Count.ToString());
            int pts = 0;

            foreach (GCodePath p in segments)
            {
                pts += p.pointsCount;
            }
            PrinterConnection.logInfo("Points total:" + pts.ToString());
        }
Beispiel #12
0
 public PrintPanel()
 {
     InitializeComponent();
     con = Main.conn;
     ann = con.analyzer;
     con.eventConnectionChange += ConnectionChanged;
     con.eventTempChange += tempUpdate;
     ann.eventPosChanged += coordUpdate;
     ann.eventChange += analyzerChange;
     UpdateConStatus(false);
     float volt = 100f * trackFanVoltage.Value / 255;
     labelVoltage.Text = "Output " + volt.ToString("0.0") + "%";
 }
 public FormPrinterSettings()
 {
     InitializeComponent();
     repetierKey = Registry.CurrentUser.CreateSubKey("Software\\Repetier");
     printerKey = repetierKey.CreateSubKey("printer");
     con = Main.conn;
     conToForm();
     comboPrinter.Items.Clear();
     foreach (string s in printerKey.GetSubKeyNames())
         comboPrinter.Items.Add(s);
     con.printerName = (string)repetierKey.GetValue("currentPrinter", "default");
     load(con.printerName);
     formToCon();
     UpdateDimensions();
 }
 public FormPrinterSettings()
 {
     InitializeComponent();
     RegMemory.RestoreWindowPos("printerSettingsWindow", this);
     repetierKey = Custom.BaseKey; // Registry.CurrentUser.CreateSubKey("SOFTWARE\\Repetier");
     printerKey = repetierKey.CreateSubKey("printer");
     con = Main.conn;
     conToForm();
     comboPrinter.Items.Clear();
     foreach (string s in printerKey.GetSubKeyNames())
         comboPrinter.Items.Add(s);
     con.printerName = (string)repetierKey.GetValue("currentPrinter", "default");
     load(con.printerName);
     formToCon();
     UpdateDimensions();
     if (Custom.GetBool("simpleConnectionsConfig", false))
     {
         comboParity.Visible = false;
         comboStopbits.Visible = false;
         labelStopbits.Visible = false;
         labelParity.Visible = false;
     }
     if (Custom.GetBool("noDisposeArea", false))
     {
         labelDumpAreaDepth.Visible = false;
         labelDumpAreaFront.Visible = false;
         labelDumpAreaLeft.Visible = false;
         labelDumpAreaWidth.Visible = false;
         labelDumpUnit1.Visible = false;
         labelDumpUnit2.Visible = false;
         labelDumpUnit3.Visible = false;
         labelDumpUnit4.Visible = false;
         checkHasDumpArea.Visible = false;
         textDumpAreaDepth.Visible = false;
         textDumpAreaFront.Visible = false;
         textDumpAreaLeft.Visible = false;
         textDumpAreaWidth.Visible = false;
     }
     if (Custom.GetBool("noMaxHoming", false))
     {
         checkHomeXMax.Visible = false;
         checkHomeYMax.Visible = false;
         checkHomeZMax.Visible = false;
     }
     Main.main.languageChanged += translate;
     translate();
 }
Beispiel #15
0
        public PrintPanel()
        {
            InitializeComponent();
            con = Main.conn;
            ann = con.analyzer;
            con.eventConnectionChange += ConnectionChanged;
            ann.fanVoltage = trackFanVoltage.Value;
            con.eventTempChange += tempUpdate;
              //  ann.eventPosChanged += coordUpdate;
            ann.eventChange += analyzerChange;
            UpdateConStatus(false);
            textExtrudeSpeed.Text = RegMemory.GetString("panelExtrudeSpeed", textExtrudeSpeed.Text);
            textExtrudeAmount.Text = RegMemory.GetString("panelExtrudeAmount", textExtrudeAmount.Text);
            textRetractAmount.Text = RegMemory.GetString("panelRetractAmount", textRetractAmount.Text);

            float volt = 100f * trackFanVoltage.Value / 255;
            labelVoltage.Text = "Output " + volt.ToString("0.0") + "%";
            timer.Start();
        }
 public FormPrinterSettings()
 {
     ps = this;
     InitializeComponent();
     addConnector(new SerialConnector());
     addConnector(new VirtualPrinterConnector());
     RegMemory.RestoreWindowPos("printerSettingsWindow", this);
     repetierKey = Custom.BaseKey; // Registry.CurrentUser.CreateSubKey("SOFTWARE\\Repetier");
     printerKey = repetierKey.CreateSubKey("printer");
     con = Main.conn;
     conToForm();
     comboPrinter.Items.Clear();
     /*bindingConnectors.DataSource = connectors;
     comboConnector.DataSource = bindingConnectors.DataSource;
     comboConnector.DisplayMember = "Name";
     comboConnector.ValueMember = "Id";*/
     foreach (string s in printerKey.GetSubKeyNames())
         comboPrinter.Items.Add(s);
     con.printerName = (string)repetierKey.GetValue("currentPrinter", "default");
     load(con.printerName);
     formToCon();
     UpdateDimensions();
    /* if (Custom.GetBool("noDisposeArea", false))
     {
         labelDumpAreaDepth.Visible = false;
         labelDumpAreaFront.Visible = false;
         labelDumpAreaLeft.Visible = false;
         labelDumpAreaWidth.Visible = false;
         labelDumpUnit1.Visible = false;
         labelDumpUnit2.Visible = false;
         labelDumpUnit3.Visible = false;
         labelDumpUnit4.Visible = false;
         checkHasDumpArea.Visible = false;
         textDumpAreaDepth.Visible = false;
         textDumpAreaFront.Visible = false;
         textDumpAreaLeft.Visible = false;
         textDumpAreaWidth.Visible = false;
     }*/
     Main.main.languageChanged += translate;
     translate();
 }
 public static PrintingStateSnapshot TakeSnapshot(PrinterConnection conn)
 {
     return(PrintingStateSnapshot.GeneratePrintingStateSnapshot(conn));
 }
 public static PrintingStateSnapshot TakeSnapshot(PrinterConnection conn)
 {
     return PrintingStateSnapshot.GeneratePrintingStateSnapshot(conn);
 }
 public SerialConnector()
 {
     con = Main.conn;
     job = new Printjob(Main.conn);
     writeEvent = new AutoResetEvent(false);
     if (Environment.OSVersion.Platform == PlatformID.Unix)
         port = "/dev/ttyUSB0";
 }
Beispiel #20
0
        public Main()
        {
            executeHostCall = new executeHostCommandDelegate(this.executeHostCommand);
            repetierKey = Custom.BaseKey; // Registry.CurrentUser.CreateSubKey("SOFTWARE\\Repetier");
            repetierKey.SetValue("installPath", Application.StartupPath);
            if (Path.DirectorySeparatorChar != '\\' && IsRunningOnMac())
                IsMac = true;
            /*String[] parms = Environment.GetCommandLineArgs();
            string lastcom = "";
            foreach (string s in parms)
            {
                if (lastcom == "-home")
                {
                    repetierKey.SetValue("installPath",s);
                    lastcom = "";
                    continue;
                }
                if (s == "-macosx") IsMac = true;
                lastcom = s;
            }*/
            main = this;
            SplashScreen.run();
            trans = new Trans(Application.StartupPath + Path.DirectorySeparatorChar + "data" + Path.DirectorySeparatorChar + "translations");
            SwitchButton.imageOffset = RegMemory.GetInt("onOffImageOffset", 0);
            generator = new GCodeGenerator();
            globalSettings = new GlobalSettings();
            conn = new PrinterConnection();
            printerSettings = new FormPrinterSettings();
            printerModel = new PrinterModel();
            conn.analyzer.start(true);
            threeDSettings = new ThreeDSettings();
            InitializeComponent();
            tdSettings.DataSource = threeDSettings;
            tdSettings_DataMemberChanged(null, null);
            editor = new RepetierEditor();
            editor.Dock = DockStyle.Fill;
            tabGCode.Controls.Add(editor);
            updateShowFilament();
            RegMemory.RestoreWindowPos("mainWindow", this);
            if (WindowState == FormWindowState.Maximized)
                Application.DoEvents();
            splitLog.SplitterDistance = RegMemory.GetInt("logSplitterDistance", splitLog.SplitterDistance);
            splitInfoEdit.SplitterDistance = RegMemory.GetInt("infoEditSplitterDistance", Width-470);
            if (IsMono)
            {
                if (!IsMac)
                {
                    foreach (ToolStripItem m in menu.Items)
                    {
                        m.Text = m.Text.Replace("&", null);
                    }
                }
                if (IsMac)
                {
                    /*Application.Events.Quit += delegate (object sender, ApplicationEventArgs e) {
                        Application.Quit ();
                        e.Handled = true;
                    };
 
                    ApplicationEvents.Reopen += delegate (object sender, ApplicationEventArgs e) {
                        WindowState = FormWindowState.Normal;
                        e.Handled = true;
                    };*/

                    MinimumSize = new Size(500, 640);
                    tab.MinimumSize = new Size(500, 500);
                    splitLog.Panel1MinSize = 520;
                    splitLog.Panel2MinSize = 100;
                    splitLog.IsSplitterFixed = true;
                    //splitContainerPrinterGraphic.SplitterDistance -= 52;
                    splitLog.SplitterDistance = splitLog.Height - 100;
                }
            }
            slicerToolStripMenuItem.Visible = false;
            splitLog.Panel2Collapsed = !RegMemory.GetBool("logShow", true);
            splitPrinterId.Panel1Collapsed = !RegMemory.GetBool("printerIdShow", false);
            conn.eventConnectionChange += OnPrinterConnectionChange;
            conn.eventPrinterAction += OnPrinterAction;
            conn.eventJobProgress += OnJobProgress;
            objectPlacement = new STLComposer();
            objectPlacement.Dock = DockStyle.Fill;
            tabModel.Controls.Add(objectPlacement);
            printPanel = new PrintPanel();
            printPanel.Dock = DockStyle.Fill;
            tabPrint.Controls.Add(printPanel);
            printerSettings.formToCon();
            logView = new LogView();
            logView.Dock = DockStyle.Fill;
            splitLog.Panel2.Controls.Add(logView);
            skeinforge = new Skeinforge();
            PrinterChanged(printerSettings.currentPrinterKey, true);
            printerSettings.eventPrinterChanged += PrinterChanged;
            // GCode print preview
            threedview = new ThreeDControl();
            threedview.Dock = DockStyle.Fill;
            tabPage3DView.Controls.Add(threedview);

            printPreview = new ThreeDView();
           // printPreview.Dock = DockStyle.Fill;
          //  splitContainerPrinterGraphic.Panel2.Controls.Add(printPreview);
            printPreview.SetEditor(false);
            printPreview.autoupdateable = true;
            printVisual = new GCodeVisual(conn.analyzer);
            printVisual.liveView = true;
            printPreview.models.AddLast(printVisual);
            basicTitle = Text;
            jobPreview = new ThreeDView();
         //   jobPreview.Dock = DockStyle.Fill;
         //   splitJob.Panel2.Controls.Add(jobPreview);
            jobPreview.SetEditor(false);
            jobPreview.models.AddLast(jobVisual);
            editor.contentChangedEvent += JobPreview;
            editor.commands = new Commands();
            editor.commands.Read("default", "en");
            UpdateHistory();
            UpdateConnections();
            Main.slic3r = new Slic3r();
            slicer = new Slicer();
            //toolShowLog_CheckedChanged(null, null);
            updateShowFilament();
            assign3DView();
            history = new TemperatureHistory();
            tempView = new TemperatureView();
            tempView.Dock = DockStyle.Fill;
            tabPageTemp.Controls.Add(tempView);
            if (IsMono)
            {
                showWorkdirectoryToolStripMenuItem.Visible = false;
                toolStrip.Height = 56;
            }
            new SoundConfig();
            //stlComposer1.buttonSlice.Text = Trans.T1("L_SLICE_WITH", slicer.SlicerName);

            // Customizations

            if(Custom.GetBool("removeTestgenerator",false)) {
                internalSlicingParameterToolStripMenuItem.Visible = false;
                testCaseGeneratorToolStripMenuItem.Visible = false;
            }
            string titleAdd = Custom.GetString("titleAddition", "");
            string titlePrefix = Custom.GetString("titlePrefix", "");
            if (titleAdd.Length > 0 || titlePrefix.Length>0)
            {
                int p = basicTitle.IndexOf(' ');
                basicTitle = titlePrefix+basicTitle.Substring(0, p) + titleAdd + basicTitle.Substring(p);
                Text = basicTitle;
            }
            slicerPanel.UpdateSelection();
            if (Custom.GetBool("removeUpdates", false))
                checkForUpdatesToolStripMenuItem.Visible = false;
            else
                RHUpdater.checkForUpdates(true);
            UpdateToolbarSize();
            // Add languages
            foreach (Translation t in trans.translations.Values)
            {
                ToolStripMenuItem item = new ToolStripMenuItem(t.language,null, languageSelected);
                item.Tag = t;
                languageToolStripMenuItem.DropDownItems.Add(item);
            }
            languageChanged += translate;
            translate();
            if (Custom.GetBool("removeSkeinforge", false))
            {
                Main.slicer.ActiveSlicer = Slicer.SlicerID.Slic3r;
            }
            if (Custom.GetBool("extraSupportButton", false))
            {
                supportToolStripMenuItem.Text = Custom.GetString("extraSupportText", "Support");
            }
            else
            {
                toolStripAskSeperator.Visible = false;
                supportToolStripMenuItem.Visible = false;
            }
            if (Custom.GetString("extraLink1Title", "").Length>0)
            {
                extraUrl1ToolStripMenuItem.Text = Custom.GetString("extraLink1Title", "");
                toolStripAskSeperator.Visible = true;
            }
            else extraUrl1ToolStripMenuItem.Visible = false;
            if (Custom.GetString("extraLink2Title", "").Length > 0)
            {
                extraUrl2ToolStripMenuItem.Text = Custom.GetString("extraLink2Title", "");
                toolStripAskSeperator.Visible = true;
            }
            else extraUrl2ToolStripMenuItem.Visible = false;
            if (Custom.GetString("extraLink3Title", "").Length > 0)
            {
                extraUrl3ToolStripMenuItem.Text = Custom.GetString("extraLink3Title", "");
                toolStripAskSeperator.Visible = true;
            }
            else extraUrl3ToolStripMenuItem.Visible = false;
            if (Custom.GetString("extraLink4Title", "").Length > 0)
            {
                extraUrl4ToolStripMenuItem.Text = Custom.GetString("extraLink4Title", "");
                toolStripAskSeperator.Visible = true;
            }
            else extraUrl4ToolStripMenuItem.Visible = false;
            if (Custom.GetString("extraLink5Title", "").Length > 0)
            {
                extraUrl5ToolStripMenuItem.Text = Custom.GetString("extraLink5Title", "");
                toolStripAskSeperator.Visible = true;
            }
            else extraUrl5ToolStripMenuItem.Visible = false;
            string supportImage = Custom.GetString("extraSupportToolbarImage", "");
            if (supportImage.Length > 0 && File.Exists(Application.StartupPath + Path.DirectorySeparatorChar + supportImage))
            {
                toolStripButtonSupport.Image = Image.FromFile(Application.StartupPath + Path.DirectorySeparatorChar + Custom.GetString("extraSupportToolbarImage", ""));
                toolStripButtonSupport.Text = Custom.GetString("extraSupportText", "Support");
            }
            else
            {
                toolStripButtonSupport.Visible = false;
            }
            toolAction.Text = Trans.T("L_IDLE");
            toolConnection.Text = Trans.T("L_DISCONNECTED");
            updateTravelMoves();
            printerIdLabel.Text = printerSettings.comboPrinter.Text;
            this.AllowDrop = true;
            this.DragEnter += new DragEventHandler(Form1_DragEnter);
            this.DragDrop += new DragEventHandler(Form1_DragDrop);
            extensions.ExtensionManager.Initalize();
            if (conn.connector != null)
                conn.connector.Activate();
            //TestTopoTriangle triTests = new TestTopoTriangle();
            //triTests.RunTests();

            //everything done.  Now look at command line
            ProcessCommandLine();
            snapshotToolStripMenuItem.Visible = false;
            setImportUnits(RegMemory.GetDouble("importScaleFactor", importScaleFactor));

        }
Beispiel #21
0
 public Printjob(PrinterConnection c)
 {
     con = c;
 }
Beispiel #22
0
        public Main()
        {
            executeHostCall = new executeHostCommandDelegate(this.executeHostCommand);
            repetierKey = Custom.BaseKey; // Registry.CurrentUser.CreateSubKey("SOFTWARE\\Repetier");
            repetierKey.SetValue("installPath", Application.StartupPath);
            if (Path.DirectorySeparatorChar != '\\' && IsRunningOnMac())
                IsMac = true;
            /*String[] parms = Environment.GetCommandLineArgs();
            string lastcom = "";
            foreach (string s in parms)
            {
                if (lastcom == "-home")
                {
                    repetierKey.SetValue("installPath",s);
                    lastcom = "";
                    continue;
                }
                if (s == "-macosx") IsMac = true;
                lastcom = s;
            }*/
            main = this;
            generator = new GCodeGenerator();
            globalSettings = new GlobalSettings();
            conn = new PrinterConnection();
            printerSettings = new FormPrinterSettings();
            conn.analyzer.start();
            threeDSettings = new ThreeDSettings();
            InitializeComponent();
            updateShowFilament();
            RegMemory.RestoreWindowPos("mainWindow", this);
            if (WindowState == FormWindowState.Maximized)
                Application.DoEvents();
            splitLog.SplitterDistance = RegMemory.GetInt("logSplitterDistance", splitLog.SplitterDistance);
            splitInfoEdit.SplitterDistance = RegMemory.GetInt("infoEditSplitterDistance", Width-470);
            if (IsMono)
            {
                if (!IsMac)
                {
                    foreach (ToolStripItem m in menu.Items)
                    {
                        m.Text = m.Text.Replace("&", null);
                    }
                }
                if (IsMac)
                {
                    /*Application.Events.Quit += delegate (object sender, ApplicationEventArgs e) {
                        Application.Quit ();
                        e.Handled = true;
                    };
 
                    ApplicationEvents.Reopen += delegate (object sender, ApplicationEventArgs e) {
                        WindowState = FormWindowState.Normal;
                        e.Handled = true;
                    };*/

                    MinimumSize = new Size(500, 640);
                    tab.MinimumSize = new Size(500, 500);
                    splitLog.Panel1MinSize = 520;
                    splitLog.Panel2MinSize = 100;
                    splitLog.IsSplitterFixed = true;
                    //splitContainerPrinterGraphic.SplitterDistance -= 52;
                    splitLog.SplitterDistance = splitLog.Height - 100;
                }
            }
            slicerToolStripMenuItem.Visible = false;
            splitLog.Panel2Collapsed = !RegMemory.GetBool("logShow", true);
            conn.eventConnectionChange += OnPrinterConnectionChange;
            conn.eventPrinterAction += OnPrinterAction;
            conn.eventJobProgress += OnJobProgress;
            printPanel = new PrintPanel();
            printPanel.Dock = DockStyle.Fill;
            tabPrint.Controls.Add(printPanel);
            printerSettings.formToCon();
            logView = new LogView();
            logView.Dock = DockStyle.Fill;
            splitLog.Panel2.Controls.Add(logView);
            skeinforge = new Skeinforge();
            PrinterChanged(printerSettings.currentPrinterKey, true);
            printerSettings.eventPrinterChanged += PrinterChanged;
            // GCode print preview
            threedview = new ThreeDControl();
            threedview.Dock = DockStyle.Fill;
            tabPage3DView.Controls.Add(threedview);

            printPreview = new ThreeDView();
           // printPreview.Dock = DockStyle.Fill;
          //  splitContainerPrinterGraphic.Panel2.Controls.Add(printPreview);
            printPreview.SetEditor(false);
            printPreview.autoupdateable = true;
            printVisual = new GCodeVisual(conn.analyzer);
            printVisual.liveView = true;
            printPreview.models.AddLast(printVisual);
            basicTitle = Text;
            jobPreview = new ThreeDView();
         //   jobPreview.Dock = DockStyle.Fill;
         //   splitJob.Panel2.Controls.Add(jobPreview);
            jobPreview.SetEditor(false);
            jobPreview.models.AddLast(jobVisual);
            editor.contentChangedEvent += JobPreview;
            editor.commands = new Commands();
            editor.commands.Read("default", "en");
            UpdateHistory();
            UpdateConnections();
            Main.slic3r = new Slic3r();
            slicer = new Slicer();
            //toolShowLog_CheckedChanged(null, null);
            updateShowFilament();
            assign3DView();
            history = new TemperatureHistory();
            tempView = new TemperatureView();
            tempView.Dock = DockStyle.Fill;
            tabPageTemp.Controls.Add(tempView);
            if (IsMono)
                showWorkdirectoryToolStripMenuItem.Visible = false;
            new SoundConfig();
            stlComposer1.buttonSlice.Text = "Slice with " + slicer.SlicerName;

            // Customizations

            if(Custom.GetBool("removeTestgenerator",false)) {
                internalSlicingParameterToolStripMenuItem.Visible = false;
                testCaseGeneratorToolStripMenuItem.Visible = false;
            }
            string titleAdd = Custom.GetString("titleAddition", "");
            if (titleAdd.Length > 0)
            {
                int p = basicTitle.IndexOf(' ');
                basicTitle = basicTitle.Substring(0, p) + titleAdd + basicTitle.Substring(p);
                Text = basicTitle;
            }
            slicerPanel.UpdateSelection();
        }
Beispiel #23
0
 public Printjob(PrinterConnection c)
 {
     con = c;
 }
Beispiel #24
0
 public PrinterConnectionGCodeExecutor(PrinterConnection conn, bool startImmediatelly)
 {
     this.conn = conn;
     this.startImmediatelly = startImmediatelly;
 }
Beispiel #25
0
 private bool ValidatePreconditionsToSaveStateSnapshot(PrinterConnection conn)
 {
     return conn.connector.IsJobRunning();
 }
Beispiel #26
0
 public PrinterInfo()
 {
     con = Main.conn;
     InitializeComponent();
     timer_Tick(null, null);
 }
Beispiel #27
0
        public Main()
        {
            executeHostCall = new executeHostCommandDelegate(this.executeHostCommand);
            repetierKey = Registry.CurrentUser.CreateSubKey("SOFTWARE\\Repetier");
            repetierKey.SetValue("installPath", Application.StartupPath);
            if (Path.DirectorySeparatorChar != '\\' && IsRunningOnMac())
                IsMac = true;
            /*String[] parms = Environment.GetCommandLineArgs();
            string lastcom = "";
            foreach (string s in parms)
            {
                if (lastcom == "-home")
                {
                    repetierKey.SetValue("installPath",s);
                    lastcom = "";
                    continue;
                }
                if (s == "-macosx") IsMac = true;
                lastcom = s;
            }*/
            main = this;
            generator = new GCodeGenerator();
            globalSettings = new GlobalSettings();
            conn = new PrinterConnection();
            printerSettings = new FormPrinterSettings();
            conn.analyzer.start();
            threeDSettings = new ThreeDSettings();
            InitializeComponent();
            updateShowFilament();
            RegMemory.RestoreWindowPos("mainWindow", this);
            if (WindowState == FormWindowState.Maximized)
                Application.DoEvents();
            splitLog.SplitterDistance = RegMemory.GetInt("logSplitterDistance", splitLog.SplitterDistance);
            if (IsMono)
            {
                if (!IsMac)
                {
                    splitContainerPrinterGraphic.SplitterDistance += 52;
                    foreach (ToolStripItem m in menu.Items)
                    {
                        m.Text = m.Text.Replace("&", null);
                    }
                }
                if (IsMac)
                {
                    /*Application.Events.Quit += delegate (object sender, ApplicationEventArgs e) {
                        Application.Quit ();
                        e.Handled = true;
                    };
 
                    ApplicationEvents.Reopen += delegate (object sender, ApplicationEventArgs e) {
                        WindowState = FormWindowState.Normal;
                        e.Handled = true;
                    };*/

                    MinimumSize = new Size(500, 640);
                    tab.MinimumSize = new Size(500, 500);
                    splitLog.Panel1MinSize = 520;
                    splitLog.Panel2MinSize = 100;
                    splitLog.IsSplitterFixed = true;
                    splitJob.IsSplitterFixed = true;
                    //splitContainerPrinterGraphic.SplitterDistance -= 52;
                    splitLog.SplitterDistance = splitLog.Height - 100;
                }
            }
            toolShowLog.Checked = RegMemory.GetBool("logShow", true);
            conn.eventConnectionChange += OnPrinterConnectionChange;
            conn.eventPrinterAction += OnPrinterAction;
            conn.eventJobProgress += OnJobProgress;
            printPanel = new PrintPanel();
            printPanel.Dock = DockStyle.Fill;
            splitContainerPrinterGraphic.Panel1.Controls.Add(printPanel);
            printerSettings.formToCon();
            logView = new LogView();
            logView.Dock = DockStyle.Fill;
            splitLog.Panel2.Controls.Add(logView);
            skeinforge = new Skeinforge();
            PrinterChanged(printerSettings.currentPrinterKey, true);
            printerSettings.eventPrinterChanged += PrinterChanged;
            // GCode print preview
            printPreview = new ThreeDControl();
            printPreview.Dock = DockStyle.Fill;
            splitContainerPrinterGraphic.Panel2.Controls.Add(printPreview);
            printPreview.SetEditor(false);
            printPreview.AutoUpdateable = true;
            printVisual = new GCodeVisual(conn.analyzer);
            printVisual.liveView = true;
            printPreview.models.AddLast(printVisual);
            basicTitle = Text;
            jobPreview = new ThreeDControl();
            jobPreview.Dock = DockStyle.Fill;
            splitJob.Panel2.Controls.Add(jobPreview);
            jobPreview.SetEditor(false);
            jobPreview.models.AddLast(jobVisual);
            editor.contentChangedEvent += JobPreview;
            editor.commands = new Commands();
            editor.commands.Read("default", "en");
            UpdateHistory();
            UpdateConnections();
            Main.slic3r = new Slic3r();
            slicer = new Slicer();
            if (IsMac)
            {
                tabGCode.Controls.Remove(splitJob);
                tabPrint.Controls.Remove(splitContainerPrinterGraphic);
            }
            toolShowLog_CheckedChanged(null, null);
            updateShowFilament();
        }
 public VirtualPrinterConnector()
 {
     virtualPrinter = new VirtualPrinter(this);
     con = Main.conn;
     job = new Printjob(Main.conn);
 }
Beispiel #29
0
        public void Analyze(GCode code)
        {
            if (code.hostCommand)
            {
                string cmd = code.getHostCommand();
                if (cmd.Equals("@hide"))
                {
                    drawing = false;
                }
                else if (cmd.Equals("@show"))
                {
                    drawing = true;
                }
                else if (cmd.Equals("@isathome"))
                {
                    hasXHome = hasYHome = hasZHome = true;
                    x        = Main.printerSettings.XHomePos;
                    y        = Main.printerSettings.YHomePos;
                    z        = Main.printerSettings.ZHomePos;
                    xOffset  = yOffset = zOffset = 0;
                }
                return;
            }
            //if (code.forceAscii) return; // Don't analyse host commands and unknown commands
            if (code.hasN)
            {
                lastline = code.N;
            }
            if (uploading && !code.hasM && code.M != 29)
            {
                return;                                          // ignore upload commands
            }
            if (code.hasG)
            {
                switch (code.G)
                {
                case 0:
                case 1:
                    if (code.hasF)
                    {
                        f = code.F;
                    }
                    if (relative)
                    {
                        if (code.hasX)
                        {
                            x += code.X;
                        }
                        if (code.hasY)
                        {
                            y += code.Y;
                        }
                        if (code.hasZ)
                        {
                            z += code.Z;
                        }
                        if (code.hasE)
                        {
                            e += code.E;
                        }
                    }
                    else
                    {
                        if (code.hasX)
                        {
                            x = xOffset + code.X;
                        }
                        if (code.hasY)
                        {
                            y = yOffset + code.Y;
                        }
                        if (code.hasZ)
                        {
                            z = zOffset + code.Z;
                        }
                        if (code.hasE)
                        {
                            if (eRelative)
                            {
                                e += code.E;
                            }
                            else
                            {
                                e = eOffset + code.E;
                            }
                        }
                    }
                    if (x < Main.printerSettings.XMin)
                    {
                        x = Main.printerSettings.XMin; hasXHome = false;
                    }
                    if (y < Main.printerSettings.YMin)
                    {
                        y = Main.printerSettings.YMin; hasYHome = false;
                    }
                    if (z < 0)
                    {
                        z = 0; hasZHome = false;
                    }
                    if (x > Main.printerSettings.XMax)
                    {
                        hasXHome = false;
                    }
                    if (y > Main.printerSettings.YMax)
                    {
                        hasYHome = false;
                    }
                    if (z > printerHeight)
                    {
                        hasZHome = false;
                    }
                    if (e > emax)
                    {
                        emax = e;
                        if (z != lastZPrint)
                        {
                            layer++;
                            lastZPrint = z;
                            if (!privateAnalyzer && Main.conn.job.hasData() && Main.conn.job.maxLayer >= 0)
                            {
                                //PrinterConnection.logInfo("Printing layer " + layer.ToString() + " of " + Main.conn.job.maxLayer.ToString());
                                PrinterConnection.logInfo(Trans.T2("L_PRINTING_LAYER_X_OF_Y", layer.ToString(), Main.conn.job.maxLayer.ToString()));
                            }
                        }
                    }
                    if (eventPosChanged != null)
                    {
                        if (privateAnalyzer)
                        {
                            eventPosChanged(code, x, y, z);
                        }
                        else
                        {
                            Main.main.Invoke(eventPosChanged, code, x, y, z);
                        }
                    }
                    float dx = Math.Abs(x - lastX);
                    float dy = Math.Abs(y - lastY);
                    float dz = Math.Abs(z - lastZ);
                    float de = Math.Abs(e - lastE);
                    if (dx + dy + dz > 0.001)
                    {
                        printingTime += Math.Sqrt(dx * dx + dy * dy + dz * dz) * 60.0f / f;
                    }
                    else
                    {
                        printingTime += de * 60.0f / f;
                    }
                    lastX = x;
                    lastY = y;
                    lastZ = z;
                    lastE = e;
                    break;

                case 28:
                case 161:
                {
                    bool homeAll = !(code.hasX || code.hasY || code.hasZ);
                    if (code.hasX || homeAll)
                    {
                        xOffset = 0; x = Main.printerSettings.XHomePos; hasXHome = true;
                    }
                    if (code.hasY || homeAll)
                    {
                        yOffset = 0; y = Main.printerSettings.YHomePos; hasYHome = true;
                    }
                    if (code.hasZ || homeAll)
                    {
                        zOffset = 0; z = Main.printerSettings.ZHomePos; hasZHome = true;
                    }
                    if (code.hasE)
                    {
                        eOffset = 0; e = 0; emax = 0;
                    }
                    if (eventPosChanged != null)
                    {
                        if (privateAnalyzer)
                        {
                            eventPosChanged(code, x, y, z);
                        }
                        else
                        {
                            Main.main.Invoke(eventPosChanged, code, x, y, z);
                        }
                    }
                }
                break;

                case 162:
                {
                    bool homeAll = !(code.hasX || code.hasY || code.hasZ);
                    if (code.hasX || homeAll)
                    {
                        xOffset = 0; x = Main.printerSettings.XMax; hasXHome = true;
                    }
                    if (code.hasY || homeAll)
                    {
                        yOffset = 0; y = Main.printerSettings.YMax; hasYHome = true;
                    }
                    if (code.hasZ || homeAll)
                    {
                        zOffset = 0; z = Main.printerSettings.PrintAreaHeight; hasZHome = true;
                    }
                    if (eventPosChanged != null)
                    {
                        if (privateAnalyzer)
                        {
                            eventPosChanged(code, x, y, z);
                        }
                        else
                        {
                            Main.main.Invoke(eventPosChanged, code, x, y, z);
                        }
                    }
                }
                break;

                case 90:
                    relative = false;
                    break;

                case 91:
                    relative = true;
                    break;

                case 92:
                    if (code.hasX)
                    {
                        xOffset = x - code.X; x = xOffset;
                    }
                    if (code.hasY)
                    {
                        yOffset = y - code.Y; y = yOffset;
                    }
                    if (code.hasZ)
                    {
                        zOffset = z - code.Z; z = zOffset;
                    }
                    if (code.hasE)
                    {
                        eOffset = e - code.E; lastE = e = eOffset;
                    }
                    if (eventPosChanged != null)
                    {
                        if (privateAnalyzer)
                        {
                            eventPosChanged(code, x, y, z);
                        }
                        else
                        {
                            Main.main.Invoke(eventPosChanged, code, x, y, z);
                        }
                    }
                    break;
                }
            }
            else if (code.hasM)
            {
                switch (code.M)
                {
                case 28:
                    uploading = true;
                    break;

                case 29:
                    uploading = false;
                    break;

                case 80:
                    powerOn = true;
                    fireChanged();
                    break;

                case 81:
                    powerOn = false;
                    fireChanged();
                    break;

                case 82:
                    eRelative = false;
                    break;

                case 83:
                    eRelative = true;
                    break;

                case 104:
                case 109:
                    if (code.hasS)
                    {
                        extruderTemp = code.S;
                    }
                    fireChanged();
                    break;

                case 106:
                    fanOn = true;
                    if (code.hasS)
                    {
                        fanVoltage = code.S;
                    }
                    fireChanged();
                    break;

                case 107:
                    fanOn = false;
                    fireChanged();
                    break;

                case 110:
                    lastline = code.N;
                    break;

                case 111:
                    if (code.hasS)
                    {
                        debugLevel = code.S;
                    }
                    break;

                case 140:
                case 190:
                    if (code.hasS)
                    {
                        bedTemp = code.S;
                    }
                    fireChanged();
                    break;

                case 203:     // Temp monitor
                    if (code.hasS)
                    {
                        tempMonitor = code.S;
                    }
                    break;

                case 220:
                    if (code.hasS)
                    {
                        speedMultiply = code.S;
                    }
                    break;
                }
            }
            else if (code.hasT)
            {
                activeExtruder = code.T;
            }
        }
Beispiel #30
0
 public PrinterConnectionGCodeExecutor(PrinterConnection conn, bool startImmediatelly)
 {
     this.conn = conn;
     this.startImmediatelly = startImmediatelly;
 }