Example #1
0
 private UVDLPApp()
 {
     m_supportmode          = eSupportEditMode.eNone;
     SceneFileName          = "";
     m_callbackhandler      = new CallbackHandler();
     m_appconfig            = new AppConfig();
     m_printerinfo          = new MachineConfig();
     m_buildparms           = new SliceBuildConfig();
     m_deviceinterface      = new DeviceInterface();
     m_buildmgr             = new BuildManager();
     m_slicer               = new Slicer();
     m_slicer.m_slicemethod = Slicer.eSliceMethod.eNormalCount;// configure the slicer to user the new normal count - Thanks Shai!!!
     m_slicer.Slice_Event  += new Slicer.SliceEvent(SliceEv);
     //m_dispmgr = DisplayManager.Instance(); // initialize the singleton for early event app binding
     //m_flexslice = new FlexSlice();
     m_gcode            = new GCodeFile(""); // create a blank gcode to start with
     m_supportconfig    = new SupportConfig();
     m_supportgenerator = new SupportGenerator();
     m_supportgenerator.SupportEvent += new SupportGeneratorEvent(SupEvent);
     CSG.Instance().CSGEvent += new CSG.CSGEventDel(CSGEvent);
     m_proj_cmd_lst    = new prjcmdlst();
     m_plugins         = new List <PluginEntry>(); // list of user plug-ins
     m_pluginstates    = PluginStates.Instance();  // initialize the plugin state singleton
     m_undoer          = new Undoer();
     m_2d_graphics     = new C2DGraphics();
     m_gui_config      = new GuiConfigManager();
     m_AuxBuildCmds    = AuxBuildCmds.Instance(); // make sure the singleton doesn't go away...
     m_sequencemanager = SequenceManager.Instance();
 }
 private void SliceEv(Slicer.eSliceEvent ev, int layer, int totallayers, SliceFile sf)
 {
     try
     {
         if (InvokeRequired)
         {
             BeginInvoke(new MethodInvoker(delegate() { SliceEv(ev, layer, totallayers, sf); }));
         }
         else
         {
             switch (ev)
             {
                 case Slicer.eSliceEvent.eSliceStarted:
                    
                     break;
                 case Slicer.eSliceEvent.eLayerSliced:
                     break;
                 case Slicer.eSliceEvent.eSliceCompleted:                            
                     SetNumLayers(totallayers);
                     break;
             }
         }
     }
     catch (Exception ex)
     {
         DebugLogger.Instance().LogError(ex.Message);
     }
 }
Example #3
0
 private UVDLPApp()
 {
     m_appconfig           = new AppConfig();
     m_printerinfo         = new MachineConfig();
     m_buildparms          = new SliceBuildConfig();
     m_deviceinterface     = new DeviceInterface();
     m_buildmgr            = new BuildManager();
     m_slicer              = new Slicer();
     m_slicer.Slice_Event += new Slicer.SliceEvent(SliceEv);
     m_gcode = null;
 }
 private UVDLPApp()
 {
     m_appconfig           = new AppConfig();
     m_printerinfo         = new MachineConfig();
     m_buildparms          = new SliceBuildConfig();
     m_deviceinterface     = new DeviceInterface();
     m_buildmgr            = new BuildManager();
     m_slicer              = new Slicer();
     m_slicer.Slice_Event += new Slicer.SliceEvent(SliceEv);
     m_flexslice           = new FlexSlice();
     m_gcode            = new GCodeFile(""); // create a blank gcode to start with
     m_supportconfig    = new SupportConfig();
     m_supportgenerator = new SupportGenerator();
     m_supportgenerator.SupportEvent += new SupportGeneratorEvent(SupEvent);
 }
 private UVDLPApp()
 {
     m_appconfig           = new AppConfig();
     m_printerinfo         = new MachineConfig();
     m_buildparms          = new SliceBuildConfig();
     m_deviceinterface     = new DeviceInterface();
     m_buildmgr            = new BuildManager();
     m_slicer              = new Slicer();
     m_slicer.Slice_Event += new Slicer.SliceEvent(SliceEv);
     //m_flexslice = new FlexSlice();
     m_gcode            = new GCodeFile(""); // create a blank gcode to start with
     m_supportconfig    = new SupportConfig();
     m_supportgenerator = new SupportGenerator();
     m_supportgenerator.SupportEvent += new SupportGeneratorEvent(SupEvent);
     m_proj_cmd_lst = new prjcmdlst();
     m_plugins      = new List <IPlugin>(); // list of user plug-ins
     m_undoer       = new Undoer();
 }
 private void SliceEv(Slicer.eSliceEvent ev, int layer, int totallayers,SliceFile sf)
 {
     try
     {
         if (InvokeRequired)
         {
             BeginInvoke(new MethodInvoker(delegate() { SliceEv(ev, layer, totallayers,sf); }));
         }
         else
         {
             switch (ev)
             {
                 case Slicer.eSliceEvent.eSliceStarted:
                     SetMainMessage("Slicing Started");
                     break;
                 case Slicer.eSliceEvent.eLayerSliced:
                     break;
                 case Slicer.eSliceEvent.eSliceCompleted:
                     //show the gcode
                     txtGCode.Text = UVDLPApp.Instance().m_gcode.RawGCode;
                     SetVScrollMax(totallayers);
                     SetMainMessage("Slicing Completed");
                     String timeest = BuildManager.EstimateBuildTime(UVDLPApp.Instance().m_gcode);
                     SetTimeMessage("Estimated Build Time: " + timeest);
                     //show the slice in the slice view
                     ViewLayer(0, null, BuildManager.SLICE_NORMAL);
                     break;
             }
         }
     }
     catch (Exception ex)
     {
         DebugLogger.Instance().LogError(ex.Message);
     }
 }
Example #7
0
 private void SliceEv(Slicer.eSliceEvent ev, int layer, int totallayers)
 {
     if (InvokeRequired)
     {
         BeginInvoke(new MethodInvoker(delegate() { SliceEv(ev,layer, totallayers); }));
     }
     else
     {
         switch (ev)
         {
             case Slicer.eSliceEvent.eSliceStarted:
                 SetMainMessage("Slicing Started");
                 break;
             case Slicer.eSliceEvent.eLayerSliced:
                 break;
             case Slicer.eSliceEvent.eSliceCompleted:
                 //show the gcode
                 txtGCode.Text = UVDLPApp.Instance().m_gcode.RawGCode;
                 vScrollBar1.Maximum = totallayers;
                 vScrollBar1.Value = 0;
                 SetMainMessage("Slicing Completed");
                 String timeest = BuildManager.EstimateBuildTime(UVDLPApp.Instance().m_gcode);
                 SetTimeMessage("Estimated Build Time: " + timeest);
                 break;
         }
     }
 }
        void SliceEv(Slicer.eSliceEvent ev, int layer, int totallayers,SliceFile sf)
        {
            String path = "";
            String fileName = "";
            switch (ev)
            {
                case Slicer.eSliceEvent.eSliceStarted:

                    break;
                case Slicer.eSliceEvent.eLayerSliced:

                    break;
                case Slicer.eSliceEvent.eSliceCompleted:
                    m_slicefile = sf;
                    //generate the GCode
                    m_gcode = GCodeGenerator.Generate(m_slicefile, m_printerinfo);

                    path = SliceFile.GetSliceFilePath(m_slicefile.modelname);
                    fileName = Path.GetFileNameWithoutExtension(m_slicefile.modelname) + ".gcode";
                    //see if we're exporting this to a zip file
                    if (sf.m_config.m_exportopt.Contains("ZIP"))
                    {
                        // open the existing zip file
                        //store the gcode
                        Stream stream = new MemoryStream(System.Text.Encoding.ASCII.GetBytes (m_gcode.RawGCode));
                        String zpath = path + ".zip";
                        if (!Utility.StoreInZip(zpath, fileName, stream))
                        {
                            DebugLogger.Instance().LogError("Could not store GCode in Zip " + zpath);
                        }
                    }
                    else  // or just to the disk
                    {
                        String sdn = path + UVDLPApp.m_pathsep + fileName;
                        SaveGCode(sdn);
                    }

                    //save the slicer object for later too
                    //save the slice file

                   // UVDLPApp.Instance().m_slicefile.Save(path + UVDLPApp.m_pathsep + fn + ".sliced");
                    break;
                case Slicer.eSliceEvent.eSliceCancelled:
                    DebugLogger.Instance().LogRecord("Slicing Cancelled");
                    break;

            }
        }
 private UVDLPApp()
 {
     m_appconfig = new AppConfig();
     m_printerinfo = new MachineConfig();
     m_buildparms = new SliceBuildConfig();
     m_deviceinterface = new DeviceInterface();
     m_buildmgr = new BuildManager();
     m_slicer = new Slicer();
     m_slicer.Slice_Event += new Slicer.SliceEvent(SliceEv);
     //m_flexslice = new FlexSlice();
     m_gcode = new GCodeFile(""); // create a blank gcode to start with
     m_supportconfig = new SupportConfig();
     m_supportgenerator = new SupportGenerator();
     m_supportgenerator.SupportEvent+= new SupportGeneratorEvent(SupEvent);
     CSG.Instance().CSGEvent += new CSG.CSGEventDel(CSGEvent);
     m_proj_cmd_lst = new prjcmdlst();
     m_plugins = new List<PluginEntry>(); // list of user plug-ins
     m_undoer = new Undoer();
 }
        void SliceEv(Slicer.eSliceEvent ev, int layer, int totallayers)
        {
            String path = "";
            switch (ev)
            {
                case Slicer.eSliceEvent.eSliceStarted:
                    // if we're exporting images
                    if (m_buildparms.exportimages)
                    {
                        m_zip = new ZipFile();
                        // get the model name, could be scene....
                        String modelname = m_selectedobject.m_fullname;
                        // strip off the file extension
                        path = Path.GetDirectoryName(modelname);
                        path += UVDLPApp.m_pathsep;
                        path += Path.GetFileNameWithoutExtension(modelname);// strip off the file extension
                        if (!Directory.Exists(path)) // check and see if a directory of that name exists,
                        {
                            Directory.CreateDirectory(path);// if not, create it
                        }
                    }
                    break;
                case Slicer.eSliceEvent.eLayerSliced:
                    //save the rendered image slice
                    //render the slice

                    if (m_buildparms.exportimages)
                    {
                        // get the model name
                        String modelname = m_selectedobject.m_fullname;
                        // strip off the file extension
                        path = Path.GetDirectoryName(modelname);
                        path += UVDLPApp.m_pathsep;
                        path += Path.GetFileNameWithoutExtension(modelname);// strip off the file extension
                        Bitmap bmp = null;
                        String imname = Path.GetFileNameWithoutExtension(modelname) + String.Format("{0:0000}",layer) + ".png";
                        String imagename = path + m_pathsep + imname;
                        bmp = UVDLPApp.Instance().m_slicefile.RenderSlice(layer);
                       // bmp.Save(imagename);
                        // create a memory stream for this to save into
                        MemoryStream ms = new MemoryStream();
                        bmp.Save(ms, ImageFormat.Png);
                        ms.Seek(0, SeekOrigin.Begin); // seek back to beginning
                        m_zip.AddEntry(imname, ms);
                    }

                    break;
                case Slicer.eSliceEvent.eSliceCompleted:

                    // save the zip file full of images
                    if (m_buildparms.exportimages)
                    {
                        String modelname = m_selectedobject.m_fullname;
                        // strip off the file extension
                        path = Path.GetDirectoryName(modelname);
                        path += UVDLPApp.m_pathsep;
                        path += Path.GetFileNameWithoutExtension(modelname);// strip off the file extension
                        path += ".zip";
                        m_zip.Save(path);
                    }

                    m_gcode = GCodeGenerator.Generate(m_slicefile, m_printerinfo);

                    //get the path of the current object file
                    path = Path.GetDirectoryName(m_selectedobject.m_fullname);
                    string fn = Path.GetFileNameWithoutExtension(m_selectedobject.m_fullname);
                    /*
                    if (!UVDLPApp.Instance().m_gcode.Save(path + UVDLPApp.m_pathsep + fn + ".gcode"))
                    {
                        DebugLogger.Instance().LogRecord("Cannot save GCode File " + path + m_pathsep + fn + ".gcode");
                    }
                    */
                    SaveGCode(path + UVDLPApp.m_pathsep + fn + ".gcode");
                    break;
                case Slicer.eSliceEvent.eSliceCancelled:
                    DebugLogger.Instance().LogRecord("Slicing Cancelled");
                    break;

            }
        }
Example #11
0
        void SliceEv(Slicer.eSliceEvent ev, int layer, int totallayers)
        {
            String path = "";
            switch (ev)
            {
                case Slicer.eSliceEvent.eSliceStarted:
                    // if we're exporting images
                    if (m_buildparms.exportimages)
                    {
                        // get the model name
                        String modelname = m_selectedobject.m_fullname;
                        // strip off the file extension
                        path = Path.GetDirectoryName(modelname);
                        path += UVDLPApp.m_pathsep;
                        path += Path.GetFileNameWithoutExtension(modelname);// strip off the file extension
                        if (!Directory.Exists(path)) // check and see if a directory of that name exists,
                        {
                            Directory.CreateDirectory(path);// if not, create it
                        }
                    }
                    break;
                case Slicer.eSliceEvent.eLayerSliced:
                    //save the rendered image slice
                    //render the slice

                    if (m_buildparms.exportimages)
                    {
                        // get the model name
                        String modelname = m_selectedobject.m_fullname;
                        // strip off the file extension
                        path = Path.GetDirectoryName(modelname);
                        path += UVDLPApp.m_pathsep;
                        path += Path.GetFileNameWithoutExtension(modelname);// strip off the file extension
                        Bitmap bmp = null;
                        String imagename = path + m_pathsep + Path.GetFileNameWithoutExtension(modelname) + String.Format("{0:0000}",layer) + ".png";
                        bmp = UVDLPApp.Instance().m_slicefile.RenderSlice(layer);
                        bmp.Save(imagename);
                    }
                    break;
                case Slicer.eSliceEvent.eSliceCompleted:
                    m_gcode = GCodeGenerator.Generate(m_slicefile, m_printerinfo);

                    //get the path of the current object file
                    path = Path.GetDirectoryName(m_selectedobject.m_fullname);
                    string fn = Path.GetFileNameWithoutExtension(m_selectedobject.m_fullname);
                    /*
                    if (!UVDLPApp.Instance().m_gcode.Save(path + UVDLPApp.m_pathsep + fn + ".gcode"))
                    {
                        DebugLogger.Instance().LogRecord("Cannot save GCode File " + path + m_pathsep + fn + ".gcode");
                    }
                    */
                    SaveGCode(path + UVDLPApp.m_pathsep + fn + ".gcode");
                    break;
                case Slicer.eSliceEvent.eSliceCancelled:
                    DebugLogger.Instance().LogRecord("Slicing Cancelled");
                    break;

            }
        }
Example #12
0
 private UVDLPApp()
 {
     m_appconfig = new AppConfig();
     m_printerinfo = new MachineConfig();
     m_buildparms = new SliceBuildConfig();
     m_deviceinterface = new DeviceInterface();
     m_buildmgr = new BuildManager();
     m_slicer = new Slicer();
     m_slicer.Slice_Event += new Slicer.SliceEvent(SliceEv);
     m_flexslice = new FlexSlice();
     m_gcode = null;
 }
Example #13
0
 private UVDLPApp()
 {
     m_callbackhandler = new CallbackHandler();
     m_appconfig = new AppConfig();
     m_printerinfo = new MachineConfig();
     m_buildparms = new SliceBuildConfig();
     m_deviceinterface = new DeviceInterface();
     m_buildmgr = new BuildManager();
     m_slicer = new Slicer();
     m_slicer.Slice_Event += new Slicer.SliceEvent(SliceEv);
     //m_dispmgr = DisplayManager.Instance(); // initialize the singleton for early event app binding
     //m_flexslice = new FlexSlice();
     m_gcode = new GCodeFile(""); // create a blank gcode to start with
     m_supportconfig = new SupportConfig();
     m_supportgenerator = new SupportGenerator();
     m_supportgenerator.SupportEvent+= new SupportGeneratorEvent(SupEvent);
     CSG.Instance().CSGEvent += new CSG.CSGEventDel(CSGEvent);
     m_proj_cmd_lst = new prjcmdlst();
     m_plugins = new List<PluginEntry>(); // list of user plug-ins
     m_undoer = new Undoer();
     m_2d_graphics = new C2DGraphics();
     m_gui_config = new GuiConfig();
 }
Example #14
0
 private void SliceEv(Slicer.eSliceEvent ev, int layer, int totallayers)
 {
     if (InvokeRequired)
     {
         BeginInvoke(new MethodInvoker(delegate() { SliceEv(ev,layer, totallayers); }));
     }
     else
     {
         switch (ev)
         {
             case Slicer.eSliceEvent.eSliceStarted:
                 break;
             case Slicer.eSliceEvent.eLayerSliced:
                 break;
             case Slicer.eSliceEvent.eSliceCompleted:
                 //show the gcode
                 txtGCode.Text = UVDLPApp.Instance().m_gcode.RawGCode;
                 vScrollBar1.Maximum = totallayers;
                 vScrollBar1.Value = 0;
                 break;
         }
     }
 }
        void SliceEv(Slicer.eSliceEvent ev, int layer, int totallayers,SliceFile sf)
        {
            //  String path = "";
               // String fileName = "";
            switch (ev)
            {
                case Slicer.eSliceEvent.eSliceStarted:

                    break;
                case Slicer.eSliceEvent.eLayerSliced:

                    break;
                case Slicer.eSliceEvent.eSliceCompleted: // this all needs to be changed....
                    m_slicefile = sf;
                    //generate the GCode
                    m_gcode = GCodeGenerator.Generate(m_slicefile, m_printerinfo);
                    //we only need the file name of the gcode if we're saving it somewhere...
                    //see if we're exporting this to a zip file
                    //if (sf.m_config.m_exportopt.Contains("ZIP") && sf.m_config.export)
                    if (sf.m_config.export)
                    {
                        // open the existing scene file
                        //store the gcode
                        MemoryStream stream = new MemoryStream(System.Text.Encoding.ASCII.GetBytes(m_gcode.RawGCode));
                        String gcn = Path.GetFileNameWithoutExtension(UVDLPApp.Instance().SceneFileName) + ".gcode";
                        //SceneFile.Instance().RemoveExistingGCode(UVDLPApp.Instance().SceneFileName);
                        SceneFile.Instance().RemoveResourcesFromFile(UVDLPApp.Instance().SceneFileName, "GCode", ".gcode");
                        SceneFile.Instance().AddGCodeToFile(UVDLPApp.Instance().SceneFileName, stream, gcn);
                    }
                    //save the slicer object for later too
                    //save the slice file

                   // UVDLPApp.Instance().m_slicefile.Save(path + UVDLPApp.m_pathsep + fn + ".sliced");
                    break;
                case Slicer.eSliceEvent.eSliceCancelled:
                    DebugLogger.Instance().LogRecord("Slicing Cancelled");
                    break;

            }
        }
 private UVDLPApp()
 {
     m_supportmode = eSupportEditMode.eNone;
     SceneFileName = "";
     m_callbackhandler = new CallbackHandler();
     m_appconfig = new AppConfig();
     m_printerinfo = new MachineConfig();
     m_buildparms = new SliceBuildConfig();
     m_deviceinterface = new DeviceInterface();
     m_buildmgr = new BuildManager();
     m_slicer = new Slicer();
     m_slicer.m_slicemethod = Slicer.eSliceMethod.eNormalCount;// configure the slicer to user the new normal count - Thanks Shai!!!
     m_slicer.Slice_Event += new Slicer.SliceEvent(SliceEv);
     //m_dispmgr = DisplayManager.Instance(); // initialize the singleton for early event app binding
     //m_flexslice = new FlexSlice();
     m_gcode = new GCodeFile(""); // create a blank gcode to start with
     m_supportconfig = new SupportConfig();
     m_supportgenerator = new SupportGenerator();
     m_supportgenerator.SupportEvent+= new SupportGeneratorEvent(SupEvent);
     CSG.Instance().CSGEvent += new CSG.CSGEventDel(CSGEvent);
     m_proj_cmd_lst = new prjcmdlst();
     m_plugins = new List<PluginEntry>(); // list of user plug-ins
     m_pluginstates =  PluginStates.Instance(); // initialize the plugin state singleton
     m_undoer = new Undoer();
     m_2d_graphics = new C2DGraphics();
     m_gui_config = new GuiConfigManager();
     m_AuxBuildCmds = AuxBuildCmds.Instance(); // make sure the singleton doesn't go away...
     m_sequencemanager = SequenceManager.Instance();
     m_exporter = new frmExport();
     m_exporter.RegisterExporter(new B9JExporter());
 }
        private ZipFile m_zip; // for storing image slices

        #endregion Fields

        #region Constructors

        private UVDLPApp()
        {
            m_appconfig = new AppConfig();
            m_printerinfo = new MachineConfig();
            m_buildparms = new SliceBuildConfig();
            m_deviceinterface = new DeviceInterface();
            m_buildmgr = new BuildManager();
            m_slicer = new Slicer();
            m_slicer.Slice_Event += new Slicer.SliceEvent(SliceEv);
            m_flexslice = new FlexSlice();
            m_gcode = new GCodeFile(""); // create a blank gcode to start with
            m_supportconfig = new SupportConfig();
            m_supportgenerator = new SupportGenerator();
            m_supportgenerator.SupportEvent+= new SupportGeneratorEvent(SupEvent);
        }