Example #1
0
 /// constructor that the slicer calls to create
 /// <summary>
 /// </summary>
 /// <param name="config"></param>
 public SliceFile(SliceBuildConfig config)
 {
     m_config = new SliceBuildConfig(config); // copy the source
     m_xres = config.xres;
     m_yres = config.yres;
     m_mode = SFMode.eSliced;
 }
 protected override void OnShown(EventArgs e)
 {
     base.OnShown(e);
     /*string shortname = UVDLPApp.Instance().GetCurrentSliceProfileName();
     string fname = UVDLPApp.Instance().m_PathProfiles + UVDLPApp.m_pathsep + shortname + ".slicing";
     UVDLPApp.Instance().LoadBuildSliceProfile(fname);*/
     m_config = UVDLPApp.Instance().m_buildparms;
     m_config.UpdateFrom(UVDLPApp.Instance().m_printerinfo); // make sure we've got the correct display size and PixPerMM values
     txtMinExpose.Text = m_config.minExposure.ToString();
     txtStepExpose.Text = m_config.exposureStep.ToString();
     FillPattern();
 }
 private void cmdEdit_Click(object sender, EventArgs e)
 {
     if (lstSliceBuildProfiles.SelectedIndex != -1)
     {
         string fn = FNFromIndex(lstSliceBuildProfiles.SelectedIndex);
         if (fn != null)
         {
             SliceBuildConfig sbc = null;
             if (UVDLPApp.Instance().m_buildparms.m_filename.Equals(fn))
             {
                 sbc = UVDLPApp.Instance().m_buildparms; // current slicing profile
             }
             else
             {
                 sbc = new SliceBuildConfig(); // existing but not current
                 sbc.Load(fn);
             }
             frmSliceOptions m_frmsliceopt = new frmSliceOptions(ref sbc);
             m_frmsliceopt.ShowDialog();
         }
     }
 }
        private void lstSliceProfiles_SelectedIndexChanged(object sender, EventArgs e)
        {
            // get the item
            if (lstSliceProfiles.SelectedIndex == -1)
            {
                //blank items
                return;
            }
            else
            {
                string shortname = lstSliceProfiles.SelectedItem.ToString();
                m_config = LoadProfile(shortname);
                if (m_config != null)
                {
                    SetValues();
                }
                else
                {
                    //blank items
                }

            }
        }
 private SliceBuildConfig LoadProfile(string shortname)
 {
     SliceBuildConfig profile = new SliceBuildConfig();
     try
     {
         string fname = GetSlicingFilename(shortname);
         if (!profile.Load(fname))
         {
             DebugLogger.Instance().LogError("Could not load " + fname);
             return null;
         }
         else
         {
             return profile;
         }
     }
     catch (Exception ex)
     {
         DebugLogger.Instance().LogError(ex.Message);
     }
     return null;
 }
 private void cmdNew_Click(object sender, EventArgs e)
 {
     // prompt for a new name
     frmProfileName frm = new frmProfileName();
     if (frm.ShowDialog() == DialogResult.OK)
     {
         //create a new profile
         SliceBuildConfig bf = new SliceBuildConfig();
         //save it
         string shortname = frm.ProfileName;
         string fname = GetSlicingFilename(shortname);
         if (!bf.Save(fname))
         {
             MessageBox.Show("Error saving new profile " + fname);
         }
         //re-display the new list
         PopulateProfiles();
     }
 }
        private void cmdNew_Click(object sender, EventArgs e)
        {
            // create a new profile, give it a name
            frmProfileName fpn = new frmProfileName();
            fpn.ShowDialog();
            String pf = fpn.ProfileName;
            if (pf.Length > 0)
            {
                //create a new profile with that name
                String fn = UVDLPApp.Instance().m_PathProfiles;
                fn += UVDLPApp.m_pathsep;
                fn += pf;
                fn += ".slicing";
               // MachineConfig mc = new MachineConfig();
                SliceBuildConfig sbc = new SliceBuildConfig();

                if (!sbc.Save(fn))
                {
                    DebugLogger.Instance().LogRecord("Error Saving new slice and build profile " + fn);
                    return;
                }
                UpdateProfiles();
            }
        }
 // constructor that the slicer calls to create
 public SliceFile(SliceBuildConfig config)
 {
     m_config = new SliceBuildConfig(config); // copy the source
     m_slices = new ArrayList();
 }
        public ArrayList m_slices; // list of Slices

        #endregion Fields

        #region Constructors

        public SliceFile()
        {
            m_config = new SliceBuildConfig(); // going to be loaded
            m_slices = new ArrayList();
        }
Example #10
0
        private void cmdSlice_Click(object sender, EventArgs e)
        {
            LoadSelectedProfile();
            try
            {
                if (cmbSliceEngine.SelectedIndex == -1)
                {
                    return;
                }
                if (cmbSliceEngine.SelectedIndex == 0)
                {
                    if (UVDLPApp.Instance().m_slicer.IsSlicing)
                    {
                        UVDLPApp.Instance().m_slicer.CancelSlicing();
                    }
                    else
                    {
                        SliceBuildConfig sp = UVDLPApp.Instance().m_buildparms;
                        sp.UpdateFrom(UVDLPApp.Instance().m_printerinfo);                   // make sure we've got the correct display size and PixPerMM values
                        int numslices = UVDLPApp.Instance().m_slicer.GetNumberOfSlices(sp); // determine the number of slices\

                        /* // not using this yet...
                         * // if the user has not specificed a scenename yet, prompt thm here...
                         * if (UVDLPApp.Instance().SceneFileName.Length == 0)
                         * {
                         *  saveFileDialog1.Title = "Save Scene";
                         *  saveFileDialog1.Filter = "Scene files (*.cws)|*.cws";
                         *  //set a default name of the loaded object
                         *  if (UVDLPApp.Instance().SelectedObject != null)
                         *  {
                         *      //UVDLPApp.Instance().SelectedObject.m_fullname;
                         *      //String fname = ()
                         *      String fname = Path.GetFileNameWithoutExtension(UVDLPApp.Instance().SelectedObject.m_fullname);
                         *      String pth = Path.GetDirectoryName(UVDLPApp.Instance().SelectedObject.m_fullname);
                         *      String ext = ".cws"; // Creation Workshop Scene file
                         *      String fsn = pth + UVDLPApp.m_pathsep + fname + ext;
                         *      saveFileDialog1.FileName = fsn;
                         *  }
                         *
                         *  if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                         *  {
                         *      String fname = Path.GetFileNameWithoutExtension(saveFileDialog1.FileName);
                         *      String pth = Path.GetDirectoryName(saveFileDialog1.FileName);
                         *      String ext = ".cws"; // Creation Workshop Scene file
                         *      String fsn = pth + UVDLPApp.m_pathsep + fname + ext;
                         *      UVDLPApp.Instance().SceneFileName = fsn;
                         *
                         *  }
                         *
                         * }
                         */
                        UVDLPApp.Instance().m_slicefile = UVDLPApp.Instance().m_slicer.Slice(sp); // start slicing the scene
                    }
                }
                else
                {
                    if (cmdSlice.Text.Contains("Cancel")) // cancel Slic3r
                    {
                        if (exeProcess != null)
                        {
                            exeProcess.Kill();
                        }
                    }
                    else // start slicing using Slic3r
                    {
                        //save the scene object to a temp name
                        UVDLPApp.Instance().CalcScene(); // calc the scene object
                        if (UVDLPApp.Instance().m_engine3d.m_objects.Count > 1)
                        {
                            UVDLPApp.Instance().Scene.SaveSTL_Binary(UVDLPApp.Instance().Scene.m_fullname);
                        } // else already saved

                        StartThread();
                    }
                }
            }
            catch (Exception ex)
            {
                DebugLogger.Instance().LogError(ex);
            }
        }
 private SliceBuildConfig LoadProfile(string shortname)
 {
     SliceBuildConfig profile = new SliceBuildConfig();
     try
     {
         string fname = GetSlicingFilename(shortname);
         if (!profile.Load(fname))
         {
             DebugLogger.Instance().LogError("Could not load " + fname);
             return null;
         }
         else
         {
             UVDLPApp.Instance().RaiseAppEvent(eAppEvent.eSlicedLoaded, "Slice Profile loaded");
             UVDLPApp.Instance().RaiseAppEvent(eAppEvent.eSliceProfileChanged, "Slice Profile loaded");
             return profile;
         }
     }
     catch (Exception ex)
     {
         DebugLogger.Instance().LogError(ex.Message);
     }
     return null;
 }
        private void cmbSliceProfiles_SelectedIndexChanged(object sender, EventArgs e)
        {
            // get the item
            if (cmbSliceProfiles.SelectedIndex == -1)
            {
                //blank items
                return;
            }
            else
            {
                //set this profile to be the active one for the program
                string shortname = cmbSliceProfiles.SelectedItem.ToString();
                string fname = GetSlicingFilename(shortname);
                UVDLPApp.Instance().LoadBuildSliceProfile(fname); // load it globally
                try
                {
                    m_config = LoadProfile(shortname); // and again here for this control
                    if (m_config != null)
                    {
                        SetValues();
                        lbGCodeSection_SelectedIndexChanged(this, null);
                    }
                }
                catch (Exception ex)
                {
                    DebugLogger.Instance().LogError(ex);
                }

            }
        }
 private SliceBuildConfig LoadProfile(string shortname)
 {
     SliceBuildConfig profile = new SliceBuildConfig();
     try
     {
         string fname = UVDLPApp.Instance().m_PathProfiles;
         fname += UVDLPApp.m_pathsep + shortname + ".slicing";
         if (!profile.Load(fname))
         {
             DebugLogger.Instance().LogError("Could not load " + fname);
             return null;
         }
         else
         {
             return profile;
         }
     }
     catch (Exception ex)
     {
         DebugLogger.Instance().LogError(ex.Message);
     }
     return null;
 }