Beispiel #1
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();
            }
        }
Beispiel #2
0
 public void RestoreConfigs()
 {
     if (profileConfig != null)
         profileConfig.writeOriginal();
     if (exportConfig != null)
         exportConfig.writeOriginal();
     if (extrusionConfig != null)
         extrusionConfig.writeOriginal();
     if (multiplyConfig != null)
         multiplyConfig.writeOriginal();
     profileConfig = null;
     exportConfig = null;
     extrusionConfig = null;
     multiplyConfig = null;
 }