예제 #1
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;
 }
        /// <summary>
        /// Checks the state of the object.
        /// If it is outside print are it starts pulsing
        /// </summary>
        public void updateSTLState(STL stl)
        {
            FormPrinterSettings ps = Main.printerSettings;

            stl.UpdateBoundingBox();
            if (!ps.PointInside(stl.xMin, stl.yMin, stl.zMin) ||
                !ps.PointInside(stl.xMax, stl.yMin, stl.zMin) ||
                !ps.PointInside(stl.xMin, stl.yMax, stl.zMin) ||
                !ps.PointInside(stl.xMax, stl.yMax, stl.zMin) ||
                !ps.PointInside(stl.xMin, stl.yMin, stl.zMax) ||
                !ps.PointInside(stl.xMax, stl.yMin, stl.zMax) ||
                !ps.PointInside(stl.xMin, stl.yMax, stl.zMax) ||
                !ps.PointInside(stl.xMax, stl.yMax, stl.zMax))
            {
                stl.outside = true;
                if (Main.threeDSettings.pulseOutside.Checked && !stl.hasAnimationWithName("pulse"))
                {
                    stl.addAnimation(new PulseAnimation("pulse", 0.03, 0.03, 0.03, 0.3));
                }
            }
            else
            {
                stl.outside = false;
                stl.removeAnimationWithName("pulse");
            }
        }
예제 #3
0
 public FormPrinterSettingsSimple(FormPrinterSettings _printerSettings)
 {
     InitializeComponent();
     printerSettings = _printerSettings;
     SyncPortComboBox();
     Main.main.languageChanged += translate;
     translate();
 }
        /// <summary>
        /// Initialize the Form that lets the user setup the parameters of the Printer.
        /// </summary>
        public FormPrinterSettings()
        {
            ps = this;
            InitializeComponent();
            RegMemory.RestoreWindowPos("printerSettingsWindow", this);
            repetierKey = Custom.BaseKey; // Registry.CurrentUser.CreateSubKey("SOFTWARE\\Repetier");
            printerKey  = repetierKey.CreateSubKey("printer");
            con         = Main.connection;
            conToForm();
            comboPrinter.Items.Clear();
            foreach (string s in printerKey.GetSubKeyNames())
            {
                comboPrinter.Items.Add(s);
                // this.printerSettingsSimple.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;
             * }*/

            printerSettingsSimple      = new FormPrinterSettingsSimple(this);
            Main.main.languageChanged += translate;
            translate();
        }
예제 #5
0
        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 FormPrinterSettings()
 {
     ps = this;
     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;
     }*/
     Main.main.languageChanged += translate;
     translate();
 }
예제 #7
0
        /// <summary>
        /// Checks the state of the object.
        /// If it is outside print are it starts pulsing
        /// </summary>
        public void updateSTLState(STL stl)
        {
            FormPrinterSettings ps = Main.printerSettings;

            stl.UpdateBoundingBox();
            if (stl.xMin < ps.BedLeft || stl.yMin < ps.BedFront || stl.zMin < -0.001 || stl.xMax > ps.BedLeft + Main.printerSettings.PrintAreaWidth ||
                stl.yMax > ps.BedFront + Main.printerSettings.PrintAreaDepth || stl.zMax > Main.printerSettings.PrintAreaHeight)
            {
                stl.outside = true;
                if (Main.threeDSettings.pulseOutside.Checked && !stl.hasAnimationWithName("pulse"))
                {
                    stl.addAnimation(new PulseAnimation("pulse", 0.03, 0.03, 0.03, 0.3));
                }
            }
            else
            {
                stl.outside = false;
                stl.removeAnimationWithName("pulse");
            }
        }
예제 #8
0
 public FormPrinterSettings()
 {
     ps = this;
     connectors.Add(new SerialConnector());
     connectors.Add(new VirtualPrinterConnector());
     InitializeComponent();
     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 void Autoposition()
        {
            if (autosizeFailed)
            {
                return;
            }
            RectPacker          packer = new RectPacker(1, 1);
            int                 border = 3;
            FormPrinterSettings ps = Main.printerSettings;
            float               maxW = ps.PrintAreaWidth;
            float               maxH = ps.PrintAreaDepth;
            float               xOff = ps.BedLeft, yOff = ps.BedFront;

            if (ps.printerType == 1)
            {
                if (ps.DumpAreaFront <= 0)
                {
                    yOff  = ps.BedFront + ps.DumpAreaDepth - ps.DumpAreaFront;
                    maxH -= yOff;
                }
                else if (ps.DumpAreaDepth + ps.DumpAreaFront >= maxH)
                {
                    yOff  = ps.BedFront + -(maxH - ps.DumpAreaFront);
                    maxH += yOff;
                }
                else if (ps.DumpAreaLeft <= 0)
                {
                    xOff  = ps.BedLeft + ps.DumpAreaWidth - ps.DumpAreaLeft;
                    maxW -= xOff;
                }
                else if (ps.DumpAreaWidth + ps.DumpAreaLeft >= maxW)
                {
                    xOff  = ps.BedLeft + maxW - ps.DumpAreaLeft;
                    maxW += xOff;
                }
            }
            foreach (STL stl in listSTLObjects.Items)
            {
                int w = 2 * border + (int)Math.Ceiling(stl.xMax - stl.xMin);
                int h = 2 * border + (int)Math.Ceiling(stl.yMax - stl.yMin);
                if (!packer.addAtEmptySpotAutoGrow(new PackerRect(0, 0, w, h, stl), (int)maxW, (int)maxH))
                {
                    autosizeFailed = true;
                }
            }
            if (autosizeFailed)
            {
                MessageBox.Show("Too many objects on printer bed for automatic packing.\r\nPacking disabled until elements are removed.",
                                "Printer bed full", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            float xAdd = (maxW - packer.w) / 2.0f;
            float yAdd = (maxH - packer.h) / 2.0f;

            foreach (PackerRect rect in packer.vRects)
            {
                STL   s    = (STL)rect.obj;
                float xPos = xOff + xAdd + rect.x + border;
                float yPos = yOff + yAdd + rect.y + border;
                s.Position.x += xPos - s.xMin;
                s.Position.y += yPos - s.yMin;
                s.UpdateBoundingBox();
            }
            Main.main.threedview.UpdateChanges();
        }
예제 #10
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();
        }
예제 #11
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();
        }
예제 #12
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));

        }
예제 #13
0
        /// <summary>
        /// Runs the slicer
        /// </summary>
        /// <param name="file">path to .stl file to slice</param>
        /// <param name="centerx"></param>
        /// <param name="centery"></param>
        /// <returns></returns>
        public bool RunSliceNew(string file, float centerx, float centery)
        {
            // check to make sure the slicer isn't still running from last time
            if (procConvert != null)
            {
                MessageBox.Show(Trans.T("L_LAST_SLICE_RUNNING"), Trans.T("L_ERROR"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            // Make sure we have the path to the slicer and it is valid
            string exe = findSlic3rExecutable();

            if (exe == null)
            {
                MessageBox.Show(Trans.T("L_SLIC3R_NOT_FOUND"), Trans.T("L_ERROR"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            // Get the print settings and add the information to the slicing info panal. Analyze the .stl
            FormPrinterSettings ps = Main.printerSettings;

            SlicingInfo.Start("Slic3r");
            SlicingInfo.SetAction(Trans.T("L_ANALYSING_STL"));
            try
            {
                STL stl = new STL();
                stl.Load(file);
                stl.UpdateBoundingBox();
                if (stl.xMin > ps.BedLeft && stl.yMin > ps.BedFront && stl.xMax < ps.BedLeft + ps.PrintAreaWidth && stl.yMax < ps.BedFront + ps.PrintAreaDepth)
                {
                    // User assigned valid position, so we use this
                    centerx = stl.xMin + (stl.xMax - stl.xMin) / 2;
                    centery = stl.yMin + (stl.yMax - stl.yMin) / 2;
                }
                stl.Clear();
            }
            catch (Exception e)
            {
                Main.connection.log(e.ToString(), false, 2);
                SlicingInfo.Stop();
                return(false);
            }



            SlicingInfo.SetAction(Trans.T("L_SLICING_STL"));
            string dir    = Main.globalSettings.Workdir;
            string config = dir + Path.DirectorySeparatorChar + "slic3r.ini";

            // Problem is somewhere here. If I uncomment the next line and get rid of the other cdir declaration than it doesn't work. But as it is right now, it won't read the
            // ini files.
            string cdir = Main.main.slicerPanel.slic3rDirectory;
            //string cdir = dir;

            IniFile ini = new IniFile();
            //BasicConfiguration b = BasicConfiguration.basicConf;
            string fPrinter = cdir + Path.DirectorySeparatorChar + "print" + Path.DirectorySeparatorChar + Main.printerModel.Slic3rPrint + ".ini";

            ini.read(fPrinter);
            IniFile ini2 = new IniFile();

            ini2.read(cdir + Path.DirectorySeparatorChar + "printer" + Path.DirectorySeparatorChar + Main.printerModel.Slic3rPrinter + ".ini");

            IniFile ini3 = new IniFile();

            ini3.read(cdir + Path.DirectorySeparatorChar + "filament" + Path.DirectorySeparatorChar + Main.printerModel.Slic3rFilament1 + ".ini");
            // IniFile ini3_2 = new IniFile();
            //if(Main.conn.numberExtruder>1)
            //    ini3_2.read(cdir + Path.DirectorySeparatorChar + "filament" + Path.DirectorySeparatorChar + Main.printerModel.Slic3rFilament2 + ".ini");
            //IniFile ini3_3 = new IniFile();
            //if (Main.conn.numberExtruder > 2)
            //    ini3_3.read(cdir + Path.DirectorySeparatorChar + "filament" + Path.DirectorySeparatorChar + Main.printerModel.Slic3rFilament3 + ".ini");
            //if (Main.conn.numberExtruder > 1)
            //    ini3.merge(ini3_2);
            //if (Main.conn.numberExtruder > 2)
            //    ini3.merge(ini3_3);
            ini.add(ini2);
            ini.add(ini3);

            // If we are in developer mode then don't add support or rafts or calibrate the height
            if (!Main.main.DeveloperMode)
            {
                ini.AddSupportandRaft();
                ini.CalibrateHeight();
            }
            ini.flatten();
            ini.write(config);
            procConvert = new Process();
            try
            {
                string basedir = (string)Main.main.repetierKey.GetValue("installPath", "");

                /*string exname = "slic3r.exe";
                 * if (Environment.OSVersion.Platform == PlatformID.Unix)
                 *  exname = "slic3r.pl";
                 * if (Main.IsMac)
                 *  exname = "MacOS" + Path.DirectorySeparatorChar + "slic3r";
                 * string exe = basedir + Path.DirectorySeparatorChar + "Slic3r" + Path.DirectorySeparatorChar + exname;
                 * if (File.Exists(BasicConfiguration.basicConf.Slic3rExecutable))
                 *  exe = BasicConfiguration.basicConf.Slic3rExecutable;*/

                slicefile = file; // TODO: Not needed??
                string target = StlToGCode(file);
                if (File.Exists(target))
                {
                    File.Delete(target);
                }
                procConvert.EnableRaisingEvents = true;
                procConvert.Exited            += new EventHandler(ConversionExited);
                procConvert.StartInfo.FileName = Main.IsMono ? exe : wrapQuotes(exe);
                StringBuilder sb = new StringBuilder();
                sb.Append("--load ");
                sb.Append(wrapQuotes(config));
                sb.Append(" --print-center ");
                sb.Append(centerx.ToString("0", GCode.format));
                sb.Append(",");
                sb.Append(centery.ToString("0", GCode.format));
                sb.Append(" -o ");
                sb.Append(wrapQuotes(StlToGCode(file)));
                sb.Append(" ");
                sb.Append(wrapQuotes(file));
                procConvert.StartInfo.Arguments              = sb.ToString();
                procConvert.StartInfo.UseShellExecute        = false;
                procConvert.StartInfo.RedirectStandardOutput = true;
                procConvert.OutputDataReceived += new DataReceivedEventHandler(OutputDataHandler);
                procConvert.StartInfo.RedirectStandardError = true;
                procConvert.ErrorDataReceived += new DataReceivedEventHandler(OutputDataHandler);
                procConvert.Start();
                // Start the asynchronous read of the standard output stream.
                procConvert.BeginOutputReadLine();
                procConvert.BeginErrorReadLine();
                //Main.main.tab.SelectedTab = Main.main.tabPrint;
            }
            catch (Exception e)
            {
                Main.connection.log(e.ToString(), false, 2);
            }
            return(true);
        }
예제 #14
0
        public bool RunSliceNew(string file, float centerx, float centery)
        {
            if (procConvert != null)
            {
                MessageBox.Show(Trans.T("L_LAST_SLICE_RUNNING"), Trans.T("L_ERROR"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            string exe = findSlic3rExecutable();

            if (exe == null)
            {
                MessageBox.Show(Trans.T("L_SLIC3R_NOT_FOUND"), Trans.T("L_ERROR"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            FormPrinterSettings ps = Main.printerSettings;

            SlicingInfo.Start("Slic3r");
            SlicingInfo.SetAction(Trans.T("L_ANALYSING_STL"));
            try
            {
                STL stl = new STL();
                stl.Load(file);
                stl.UpdateBoundingBox();
                if (stl.xMin > ps.BedLeft && stl.yMin > ps.BedFront && stl.xMax < ps.BedLeft + ps.PrintAreaWidth && stl.yMax < ps.BedFront + ps.PrintAreaDepth)
                {
                    // User assigned valid position, so we use this
                    centerx = stl.xMin + (stl.xMax - stl.xMin) / 2;
                    centery = stl.yMin + (stl.yMax - stl.yMin) / 2;
                }
                stl.Clear();
            }
            catch (Exception e)
            {
                Main.conn.log(e.ToString(), false, 2);
                SlicingInfo.Stop();
                return(false);
            }
            SlicingInfo.SetAction(Trans.T("L_SLICING_STL"));
            string  dir    = Main.globalSettings.Workdir;
            string  config = dir + Path.DirectorySeparatorChar + "slic3r.ini";
            string  cdir   = Main.main.slicerPanel.slic3rDirectory;
            IniFile ini    = new IniFile();
            //BasicConfiguration b = BasicConfiguration.basicConf;
            string fPrinter = cdir + Path.DirectorySeparatorChar + "print" + Path.DirectorySeparatorChar + Main.printerModel.Slic3rPrint + ".ini";

            ini.read(fPrinter);
            IniFile ini2 = new IniFile();

            ini2.read(cdir + Path.DirectorySeparatorChar + "printer" + Path.DirectorySeparatorChar + Main.printerModel.Slic3rPrinter + ".ini");
            IniFile ini3 = new IniFile();

            ini3.read(cdir + Path.DirectorySeparatorChar + "filament" + Path.DirectorySeparatorChar + Main.printerModel.Slic3rFilament1 + ".ini");
            IniFile ini3_2 = new IniFile();

            if (Main.conn.numberExtruder > 1)
            {
                ini3_2.read(cdir + Path.DirectorySeparatorChar + "filament" + Path.DirectorySeparatorChar + Main.printerModel.Slic3rFilament2 + ".ini");
            }
            IniFile ini3_3 = new IniFile();

            if (Main.conn.numberExtruder > 2)
            {
                ini3_3.read(cdir + Path.DirectorySeparatorChar + "filament" + Path.DirectorySeparatorChar + Main.printerModel.Slic3rFilament3 + ".ini");
            }
            if (Main.conn.numberExtruder > 1)
            {
                ini3.merge(ini3_2);
            }
            if (Main.conn.numberExtruder > 2)
            {
                ini3.merge(ini3_3);
            }
            ini.add(ini2);
            ini.add(ini3);
            ini.flatten();
            ini.write(config);
            procConvert = new Process();
            try
            {
                string basedir = (string)Main.main.repetierKey.GetValue("installPath", "");

                /*string exname = "slic3r.exe";
                 * if (Environment.OSVersion.Platform == PlatformID.Unix)
                 *  exname = "slic3r.pl";
                 * if (Main.IsMac)
                 *  exname = "MacOS" + Path.DirectorySeparatorChar + "slic3r";
                 * string exe = basedir + Path.DirectorySeparatorChar + "Slic3r" + Path.DirectorySeparatorChar + exname;
                 * if (File.Exists(BasicConfiguration.basicConf.Slic3rExecutable))
                 *  exe = BasicConfiguration.basicConf.Slic3rExecutable;*/
                slicefile = file;
                string target = StlToGCode(file);
                if (File.Exists(target))
                {
                    File.Delete(target);
                }
                procConvert.EnableRaisingEvents = true;
                procConvert.Exited            += new EventHandler(ConversionExited);
                procConvert.StartInfo.FileName = Main.IsMono ? exe : wrapQuotes(exe);
                StringBuilder sb = new StringBuilder();
                sb.Append("--load ");
                sb.Append(wrapQuotes(config));
                sb.Append(" --print-center ");
                sb.Append(centerx.ToString("0", GCode.format));
                sb.Append(",");
                sb.Append(centery.ToString("0", GCode.format));
                sb.Append(" -o ");
                sb.Append(wrapQuotes(StlToGCode(file)));
                sb.Append(" ");
                sb.Append(wrapQuotes(file));
                procConvert.StartInfo.Arguments              = sb.ToString();
                procConvert.StartInfo.UseShellExecute        = false;
                procConvert.StartInfo.RedirectStandardOutput = true;
                procConvert.OutputDataReceived += new DataReceivedEventHandler(OutputDataHandler);
                procConvert.StartInfo.RedirectStandardError = true;
                procConvert.ErrorDataReceived += new DataReceivedEventHandler(OutputDataHandler);
                procConvert.Start();
                // Start the asynchronous read of the standard output stream.
                procConvert.BeginOutputReadLine();
                procConvert.BeginErrorReadLine();
                //Main.main.tab.SelectedTab = Main.main.tabPrint;
            }
            catch (Exception e)
            {
                Main.conn.log(e.ToString(), false, 2);
            }
            return(true);
        }
예제 #15
0
        /// <summary>
        /// Checks the state of the object.
        /// If it is outside print are it starts pulsing
        /// </summary>
        public void updateSTLState(PrintModel stl2)
        {
            bool dataChanged       = false;
            FormPrinterSettings ps = Main.printerSettings;

            stl2.UpdateBoundingBox();
            LinkedList <PrintModel> testList = ListObjects(false);

            foreach (PrintModel pm in testList)
            {
                pm.oldOutside = pm.outside;
                pm.outside    = false;
            }
            foreach (PrintModel pm in testList)
            {
                foreach (PrintModel pm2 in testList)
                {
                    if (pm == pm2)
                    {
                        continue;
                    }
                    if (pm2.bbox.IntersectsBox(pm.bbox))
                    {
                        pm.outside  = true;
                        pm2.outside = true;
                    }
                }
            }
            foreach (PrintModel stl in testList)
            {
                if (!ps.PointInside(stl.xMin, stl.yMin, stl.zMin) ||
                    !ps.PointInside(stl.xMax, stl.yMin, stl.zMin) ||
                    !ps.PointInside(stl.xMin, stl.yMax, stl.zMin) ||
                    !ps.PointInside(stl.xMax, stl.yMax, stl.zMin) ||
                    !ps.PointInside(stl.xMin, stl.yMin, stl.zMax) ||
                    !ps.PointInside(stl.xMax, stl.yMin, stl.zMax) ||
                    !ps.PointInside(stl.xMin, stl.yMax, stl.zMax) ||
                    !ps.PointInside(stl.xMax, stl.yMax, stl.zMax))
                {
                    stl.outside = true;
                }
            }
            foreach (PrintModel pm in testList)
            {
                if (pm.oldOutside != pm.outside)
                {
                    dataChanged = true;
                    pm.ForceViewRegeneration();
                    if (Main.threeDSettings.pulseOutside.Checked)
                    {
                        if (!pm.hasAnimationWithName("pulse") && pm.outside)
                        {
                            pm.addAnimation(new PulseAnimation("pulse", 0.03, 0.03, 0.03, 0.3));
                        }
                        if (pm.hasAnimationWithName("pulse") && !pm.outside)
                        {
                            pm.removeAnimationWithName("pulse");
                        }
                    }
                }
            }

            if (dataChanged)
            {
                listObjects.Refresh();
            }
        }