/// <summary>
        /// Adds the support settings to true of false to the configRaftSuppor SkeinConfig object.
        /// </summary>
        /// <param name="configRaftSupport"></param>
        private void AddSupportConfiguration(SkeinConfig configRaftSupport)
        {
            if (Main.main.slicerPanel.generateSupportCheckbox.Checked == true)
            {
                configRaftSupport.setValue("None", "False");
                configRaftSupport.setValue("Empty Layers Only", "False");
                configRaftSupport.setValue("Exterior Only", "False");
                configRaftSupport.setValue("Everywhere", "True");
            }
            else
            {
                configRaftSupport.setValue("None", "True");
                configRaftSupport.setValue("Everywhere", "False");
                configRaftSupport.setValue("Empty Layers Only", "False");
                configRaftSupport.setValue("Exterior Only", "False");
            }

            //throw new NotImplementedException();
        }
        /// <summary>
        /// Adds the Raft configuration to true or false based on the main printer settings. Modifies the SkienConfig object.
        /// </summary>
        /// <param name="configRaftSupport"></param>
        private void AddRaftConfiguration(SkeinConfig configRaftSupport)
        {
            if (Main.main.slicerPanel.generateRaftCheckbox.Checked == true)
            {
                configRaftSupport.setValue("Activate Raft", "True");
                configRaftSupport.setValue("Add Raft, Elevate Nozzle, Orbit:", "True");
                configRaftSupport.setValue("Base Layers (integer):", "5");
                configRaftSupport.setValue("Interface Layers (integer):", "3");
            }
            else
            {
                // These must be true, to allow support generation, but we will set the raft to 0 to remove the raft.
                configRaftSupport.setValue("Activate Raft", "True");
                configRaftSupport.setValue("Add Raft, Elevate Nozzle, Orbit:", "True");
                configRaftSupport.setValue("Base Layers (integer):", "0");
                configRaftSupport.setValue("Interface Layers (integer):", "0");
                ////configRaftSupport.setValue("Activate Raft", "False");
                ////configRaftSupport.setValue("Add Raft, Elevate Nozzle, Orbit:", "False");
            }

            // throw new NotImplementedException();
        }
Exemple #3
0
        public void RunSlice(string file, string profile)
        {
            if (procConvert != null)
            {
                MessageBox.Show(Trans.T("L_SKEIN_STILL_RUNNING") /*"Last slice job still running. Slicing of new job is canceled."*/, Trans.T("L_ERROR"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            profileConfig   = new SkeinConfig(BasicConfiguration.basicConf.SkeinforgeProfileDir + Path.DirectorySeparatorChar + "skeinforge_profile.csv");
            extrusionConfig = new SkeinConfig(BasicConfiguration.basicConf.SkeinforgeProfileDir + Path.DirectorySeparatorChar + "extrusion.csv");
            exportConfig    = new SkeinConfig(BasicConfiguration.basicConf.SkeinforgeProfileDir + Path.DirectorySeparatorChar + "extrusion" +
                                              Path.DirectorySeparatorChar + profile + Path.DirectorySeparatorChar + "export.csv");
            multiplyConfig = new SkeinConfig(BasicConfiguration.basicConf.SkeinforgeProfileDir + Path.DirectorySeparatorChar + "extrusion" +
                                             Path.DirectorySeparatorChar + profile + Path.DirectorySeparatorChar + "multiply.csv");
            // Set profile to extrusion

            /* cutting	False
             * extrusion	True
             * milling	False
             * winding	False
             */
            profileConfig.setValue("cutting", "False");
            profileConfig.setValue("milling", "False");
            profileConfig.setValue("extrusion", "True");
            profileConfig.setValue("winding", "False");
            profileConfig.writeModified();
            // Set used profile
            extrusionConfig.setValue("Profile Selection:", profile);
            extrusionConfig.writeModified();
            // Set export to correct values
            exportConfig.setValue("Activate Export", "True");
            exportConfig.setValue("Add Profile Extension", "False");
            exportConfig.setValue("Add Profile Name to Filename", "False");
            exportConfig.setValue("Add Timestamp Extension", "False");
            exportConfig.setValue("Add Timestamp to Filename", "False");
            exportConfig.setValue("Add Description to Filename", "False");
            exportConfig.setValue("Add Descriptive Extension", "False");
            exportConfig.writeModified();

            multiplyConfig.setValue("Activate Multiply:", "False");
            multiplyConfig.setValue("Activate Multiply: ", "False");
            multiplyConfig.setValue("Activate Multiply", "False");
            multiplyConfig.writeModified();

            string target = StlToGCode(file);

            if (File.Exists(target))
            {
                File.Delete(target);
            }
            procConvert = new Process();
            try
            {
                SlicingInfo.Start(name);
                SlicingInfo.SetAction(Trans.T("L_SLICING_STL_FILE...")); //"Slicing STL file ...");
                slicefile = file;
                procConvert.EnableRaisingEvents = true;
                procConvert.Exited += new EventHandler(ConversionExited);

                procConvert.StartInfo.FileName               = Main.IsMono ? PyPy : wrapQuotes(PyPy);
                procConvert.StartInfo.Arguments              = wrapQuotes(textSkeinforgeCraft.Text) + " " + wrapQuotes(file);
                procConvert.StartInfo.UseShellExecute        = false;
                procConvert.StartInfo.WorkingDirectory       = textWorkingDirectory.Text;
                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);
                RestoreConfigs();
            }
        }
        public void RunSlice(string file, string profile)
        {
            if (procConvert != null)
            {
                MessageBox.Show(Trans.T("L_SKEIN_STILL_RUNNING") /*"Last slice job still running. Slicing of new job is canceled."*/, Trans.T("L_ERROR"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            string py = PyPy;

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

            string craft = findCraft();

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

            string profdir = findSkeinforgeProfiles();

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

            profileConfig   = new SkeinConfig(Path.Combine(profdir, "skeinforge_profile.csv"));
            extrusionConfig = new SkeinConfig(Path.Combine(profdir, "extrusion.csv"));
            exportConfig    = new SkeinConfig(Path.Combine(profdir, "extrusion" + Path.DirectorySeparatorChar + profile + Path.DirectorySeparatorChar + "export.csv"));
            multiplyConfig  = new SkeinConfig(Path.Combine(profdir, "extrusion" +
                                                           Path.DirectorySeparatorChar + profile + Path.DirectorySeparatorChar + "multiply.csv"));
            raftAndSupportConfig = new SkeinConfig(Path.Combine(profdir, "extrusion" +
                                                                Path.DirectorySeparatorChar + profile + Path.DirectorySeparatorChar + "raft.csv"));
            // Set profile to extrusion

            /* cutting	False
             * extrusion	True
             * milling	False
             * winding	False
             */
            profileConfig.setValue("cutting", "False");
            profileConfig.setValue("milling", "False");
            profileConfig.setValue("extrusion", "True");
            profileConfig.setValue("winding", "False");
            profileConfig.writeModified();
            // Set used profile
            extrusionConfig.setValue("Profile Selection:", profile);
            extrusionConfig.writeModified();
            // Set export to correct values
            exportConfig.setValue("Activate Export", "True");
            exportConfig.setValue("Add Profile Extension", "False");
            exportConfig.setValue("Add Profile Name to Filename", "False");
            exportConfig.setValue("Add Timestamp Extension", "False");
            exportConfig.setValue("Add Timestamp to Filename", "False");
            exportConfig.setValue("Add Description to Filename", "False");
            exportConfig.setValue("Add Descriptive Extension", "False");
            exportConfig.writeModified();

            multiplyConfig.setValue("Activate Multiply:", "False");
            multiplyConfig.setValue("Activate Multiply: ", "False");
            multiplyConfig.setValue("Activate Multiply", "False");
            multiplyConfig.writeModified();

            string target = StlToGCode(file);

            if (File.Exists(target))
            {
                File.Delete(target);
            }

            // If we are in developer mode then don't add support or rafts or calibrate the height
            if (!Main.main.DeveloperMode)
            {
                // Modify Start Code, Raft, and Support settings to reflect the current user settings
                CalibrateHeightStartGcode(profdir);
                AddRaftConfiguration(raftAndSupportConfig);
                AddSupportConfiguration(raftAndSupportConfig);
                raftAndSupportConfig.writeModified(); // write the modified raft.csv
            }

            procConvert = new Process();
            try
            {
                SlicingInfo.Start(name);
                SlicingInfo.SetAction(Trans.T("L_SLICING_STL_FILE...")); //"Slicing STL file ...");
                slicefile = file;
                procConvert.EnableRaisingEvents = true;
                procConvert.Exited += new EventHandler(ConversionExited);

                procConvert.StartInfo.FileName               = Main.IsMono ? py : wrapQuotes(py);
                procConvert.StartInfo.Arguments              = wrapQuotes(craft) + " " + wrapQuotes(file);
                procConvert.StartInfo.UseShellExecute        = false;
                procConvert.StartInfo.WorkingDirectory       = textWorkingDirectory.Text;
                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);
                RestoreConfigs();
            }
        }