/// <summary>
        /// Opens a file in preparation for writing a series of image entries
        /// should load the manifest so we can add / remove entries from it
        /// </summary>
        /// <returns></returns>
        public bool OpenSceneFile(string scenefilename) 
        {
            try
            {
                mZip = ZipFile.Read(scenefilename);
                //open the manifest file                
                string xmlname = "manifest.xml";
                ZipEntry manifestentry = mZip[xmlname];
                //get memory stream
                MemoryStream manistream = new MemoryStream();
                //extract the stream
                manifestentry.Extract(manistream);
                //read from stream
                manistream.Seek(0, SeekOrigin.Begin); // rewind the stream for reading
                //create a new XMLHelper to load the stream into
                mManifest = new XmlHelper();
                //load the stream
                mManifest.LoadFromStream(manistream, "manifest");

                return true;
            }
            catch (Exception ex) 
            {
                DebugLogger.Instance().LogError(ex);
            }
            return false;
        }
 public bool Load(String filename)
 {
     try
     {
         XmlHelper xh = new XmlHelper();
         bool fileExist = xh.Start(filename, "ApplicationConfig");
         XmlNode ac = xh.m_toplevel;
         m_LastModelFilename = xh.GetString(ac, "LastModelName","");
         m_cursliceprofilename = UVDLPApp.Instance().m_PathProfiles + UVDLPApp.m_pathsep + xh.GetString(ac, "SliceProfileName", "default.slicing");
         m_curmachineeprofilename = UVDLPApp.Instance().m_PathMachines + UVDLPApp.m_pathsep + xh.GetString(ac, "MachineProfileName", "NullMachine.machine");
         m_autoconnect = xh.GetBool(ac, "AutoConnect", false);
         m_loadlastmodel = xh.GetBool(ac, "LoadLastModel", true);
         m_slic3rloc = xh.GetString(ac, "Slic3rLocation", "");
         m_foregroundcolor =  xh.GetColor(ac, "ForegroundColor", Color.White);
         m_backgroundcolor = xh.GetColor(ac, "BackgroundColor", Color.Black);
         m_previewslicesbuilddisplay = xh.GetBool(ac, "PreviewSlices", false);
         if (!fileExist)
         {
             xh.Save(FILE_VERSION);
         }
         return true;
     }
     catch (Exception ex)
     {
         DebugLogger.Instance().LogRecord(ex.Message);
         return false;
     }
 }
 /// <summary>
 /// This allows for retrieve arbitrary variables from the machine XML configuration
 /// </summary>
 /// <param name="varname"></param>
 /// <returns></returns>
 public string GetStringVar(string varname) 
 {
     XmlHelper xh = new XmlHelper();
     bool fileExist = xh.Start(m_filename, "MachineConfig");
     XmlNode mc = xh.m_toplevel;
     string retstr = xh.GetString(mc, varname,"");
     return retstr;        
 }
 public bool Load(XmlHelper xh, XmlNode xnode)
 {
     Name = xh.GetString(xnode, "Name", "Default");
     ZThick = xh.GetDouble(xnode, "SliceHeight", 0.05);
     layertime_ms = xh.GetInt(xnode, "LayerTime", 1000);
     firstlayertime_ms = xh.GetInt(xnode, "FirstLayerTime", 5000);
     numfirstlayers = xh.GetInt(xnode, "NumberofBottomLayers", 3);
     resinprice = xh.GetDouble(xnode, "ResinPriceL", 0.0);
     return true;
 }
 public bool Save(XmlHelper xh, XmlNode parent) // use new xml system -SHS
 {
     XmlNode cps = xh.FindSection(parent, "ComPortSettings");
     xh.SetParameter(cps, "PortName", comname);
     xh.SetParameter(cps, "Speed", speed);
     xh.SetParameter(cps, "Databits", databits);
     xh.SetParameter(cps, "Parity", parity);
     xh.SetParameter(cps, "Stopbits", stopbits);
     xh.SetParameter(cps, "Handshake", handshake);
     return true;
 }
 public bool Load(XmlHelper xh, XmlNode parent) // use new xml system -SHS
 {
     bool retval = false;
     XmlNode mdc = xh.FindSection(parent, "MotorsDriverConfig");
     m_drivertype = (eDriverType)xh.GetEnum(mdc, "DriverType", typeof(eDriverType), eDriverType.eGENERIC);
     if (m_connection.Load(xh, mdc))
     {
         retval = true;
     }
     return retval;
 }
 public bool Save(XmlHelper xh, XmlNode parent)
 {
     XmlNode xnode = xh.AddSection(parent, "InkConfig");
     xh.SetParameter(xnode, "Name", Name);
     xh.SetParameter(xnode, "SliceHeight", ZThick);
     xh.SetParameter(xnode, "LayerTime", layertime_ms);
     xh.SetParameter(xnode, "FirstLayerTime", firstlayertime_ms);
     xh.SetParameter(xnode, "NumberofBottomLayers", numfirstlayers);
     xh.SetParameter(xnode, "ResinPriceL", resinprice);
     return true;
 }
        public bool Load(XmlHelper xh, XmlNode parent)  // use new xml system -SHS
        {
            XmlNode cps = xh.FindSection(parent, "ComPortSettings");
            comname = xh.GetString(cps, "PortName", "Com1");
            speed = xh.GetInt(cps, "Speed", 115200);
            databits = xh.GetInt(cps, "Databits", 8);
            parity = (Parity)xh.GetEnum(cps, "Parity", typeof(Parity), Parity.None);
            stopbits = (StopBits)xh.GetEnum(cps, "Stopbits", typeof(StopBits), StopBits.One);
            handshake = (Handshake)xh.GetEnum(cps, "Handshake", typeof(Handshake), Handshake.None);
            return true;

        }
        public bool Save(XmlHelper xh, XmlNode parent) // use new xml system -SHS
        {
            bool retval = false;
            XmlNode mdc = xh.FindSection(parent, "MotorsDriverConfig");
            xh.SetParameter(mdc, "DriverType", m_drivertype);
            if (m_connection.Save(xh, mdc))
            {
                retval = true;
            }

            return retval;
        }
示例#10
0
 // save to xml file -SHS
 public bool Save(String filename)
 {
     XmlHelper xh = new XmlHelper();
     xh.StartNew(filename, "ProjectorCmdList");
     foreach (ProjectorCommand pc in m_commands)
     {
         XmlNode nd = xh.AddSection(null, "Command");
         xh.SetParameter(nd, "Name", pc.name);
         xh.SetParameter(nd, "IsHex", pc.hex);
         xh.SetParameter(nd, "Cmd", pc.command);
     }
     return xh.Save(FILE_VERSION);
 }
 public void Save(String filename)
 {
     XmlHelper xh = new XmlHelper();
     xh.Start(filename, "SupportConfig");
     XmlNode sc = xh.m_toplevel;
     xh.SetParameter(sc, "XSpace", xspace);
     xh.SetParameter(sc, "YSpace", yspace);
     xh.SetParameter(sc, "HeadTopRadiusMM", htrad);
     xh.SetParameter(sc, "HeadBottomRadiusMM", hbrad);
     xh.SetParameter(sc, "FootTopRadiusMM", ftrad);
     xh.SetParameter(sc, "FootBottomRadiusMM", fbrad);
     xh.SetParameter(sc, "FootBottomIntraRadiusMM", fbrad2);
     xh.Save(FILE_VERSION);
 }
 public bool Load(XmlHelper xh, XmlNode thisnode)
 {
     XmlNode mdc = thisnode;// xh.FindSection(parent, "MonitorDriverConfig");
     m_XDLPRes = xh.GetDouble(mdc, "DLP_X_Res", 1024.0);
     m_YDLPRes = xh.GetDouble(mdc, "DLP_Y_Res", 768.0);
     m_monitorid = xh.GetString(mdc, "MonitorID", "");
     m_displayconnectionenabled = xh.GetBool(mdc, "DisplayCommEnabled", false);
     m_displayconnection.Load(xh, mdc);
     m_monitorrect.top = (float)xh.GetDouble(mdc, "MonitorTop", 0.0);
     m_monitorrect.left = (float)xh.GetDouble(mdc, "MonitorLeft", 0.0);
     m_monitorrect.right = (float)xh.GetDouble(mdc, "MonitorRight", 1.0);
     m_monitorrect.bottom = (float)xh.GetDouble(mdc, "MonitorBottom", 1.0);
     return true;
 }        
示例#13
0
 // load from xml file -SHS
 public bool Load(String filename)
 {
     m_commands.Clear();
     XmlHelper xh = new XmlHelper();
     xh.Start(filename, "ProjectorCmdList");
     List<XmlNode> ndlist = xh.GetAllSections(null, "Command");
     foreach (XmlNode nd in ndlist)
     {
         ProjectorCommand pc = new ProjectorCommand();
         pc.name = xh.GetString(nd, "Name", "none");
         pc.hex = xh.GetBool(nd, "IsHex", false);
         pc.command = xh.GetString(nd, "Cmd", "");
         m_commands.Add(pc);
     }
     return true;
 }
        public bool Save(XmlHelper xh, XmlNode parent) // use new xml system -SHS
        {
           // XmlNode mdc = xh.FindSection(parent, "MonitorDriverConfig");
            XmlNode mdc = xh.AddSection(parent, "MonitorDriverConfig");
            xh.SetParameter(mdc, "DLP_X_Res", m_XDLPRes); // gotta make this auto..
            xh.SetParameter(mdc, "DLP_Y_Res", m_YDLPRes);
            xh.SetParameter(mdc, "MonitorID", m_monitorid);
            xh.SetParameter(mdc, "DisplayCommEnabled", m_displayconnectionenabled);
            m_displayconnection.Save(xh, mdc);

            xh.SetParameter(mdc, "MonitorTop", m_monitorrect.top);
            xh.SetParameter(mdc, "MonitorLeft", m_monitorrect.left);
            xh.SetParameter(mdc, "MonitorRight", m_monitorrect.right);
            xh.SetParameter(mdc, "MonitorBottom", m_monitorrect.bottom);

            return true;
        }
        public void Load(String filename)
        {
            XmlHelper xh = new XmlHelper();
            bool fileExist = xh.Start(filename, "SupportConfig");
            XmlNode sc = xh.m_toplevel;

            xspace = xh.GetDouble(sc, "XSpace", 5.0);
            yspace = xh.GetDouble(sc, "YSpace", 5.0);
            htrad = xh.GetDouble(sc, "HeadTopRadiusMM", 0.2);
            hbrad = xh.GetDouble(sc, "HeadBottomRadiusMM", 0.5);
            ftrad = xh.GetDouble(sc, "FootTopRadiusMM", 0.5);
            fbrad = xh.GetDouble(sc, "FootBottomRadiusMM", 2.0);
            fbrad2 = xh.GetDouble(sc, "FootBottomIntraRadiusMM", 0.2);

            if (!fileExist)
            {
                xh.Save(FILE_VERSION);
            }
        }
示例#16
0
 public bool Load(String filename) 
 {
     try
     {
         XmlHelper xh = new XmlHelper();
         bool fileExist = xh.Start(filename, "ApplicationConfig");
         XmlNode ac = xh.m_toplevel;
         m_LastModelFilename = xh.GetString(ac, "LastModelName","");
         m_cursliceprofilename = UVDLPApp.Instance().m_PathProfiles + UVDLPApp.m_pathsep + xh.GetString(ac, "SliceProfileName", "default.slicing");
         m_curmachineeprofilename = UVDLPApp.Instance().m_PathMachines + UVDLPApp.m_pathsep + xh.GetString(ac, "MachineProfileName", "NullMachine.machine");
         m_autoconnect = xh.GetBool(ac, "AutoConnect", false);
         m_loadlastmodel = xh.GetBool(ac, "LoadLastModel", true);
         m_slic3rloc = xh.GetString(ac, "Slic3rLocation", "");
         m_slic3rparameters = xh.GetString(ac,"Slic3rParams","");
         m_foregroundcolor =  xh.GetColor(ac, "ForegroundColor", Color.White);
         m_backgroundcolor = xh.GetColor(ac, "BackgroundColor", Color.Black);
         m_previewslicesbuilddisplay = xh.GetBool(ac, "PreviewSlices", false);
         m_viewslice3d = xh.GetBool(ac, "Preview3dSlice", false);
         m_viewslice3dheight = xh.GetBool(ac, "Preview3dSliceHeight", false);
         m_driverdebuglog = xh.GetBool(ac, "DriverLogging", false);
         m_ignoreGCrsp = xh.GetBool(ac, "IgnoreGCRsp", false);
         m_showBoundingBox = xh.GetBool(ac, "ShowBoundingBox", true);
         m_showShaded = xh.GetBool(ac, "ShowShaded", false);
         m_showOutline = xh.GetBool(ac, "ShowOutline", false);
         m_licensekey = xh.GetString(ac, "LicenseKey", "00000000000000000000");
         m_serveraddress = xh.GetString(ac,"ServerAddress","www.buildyourownsla.com");
         m_contactform = xh.GetString(ac,"ContactForm","cwupdate.php");
         if (!fileExist)
         {
             xh.Save(FILE_VERSION);
         }
         return true;
     }
     catch (Exception ex) 
     {
         DebugLogger.Instance().LogRecord(ex.Message);
         return false;
     }
 }
 public bool Save(string filename)
 {
     bool retval = false;
     m_filename = filename;
     m_name = Path.GetFileNameWithoutExtension(filename);
     XmlHelper xh = new XmlHelper();
     bool fileExist = xh.Start(m_filename, "MachineConfig");
     XmlNode mc = xh.m_toplevel;
     xh.SetParameter(mc, "PlatformXSize", m_PlatXSize);
     xh.SetParameter(mc, "PlatformYSize", m_PlatYSize);
     xh.SetParameter(mc, "PlatformZSize", m_PlatZSize);
     xh.SetParameter(mc, "MaxXFeedRate", m_XMaxFeedrate);
     xh.SetParameter(mc, "MaxYFeedRate", m_YMaxFeedrate);
     xh.SetParameter(mc, "MaxZFeedRate", m_ZMaxFeedrate);
     xh.SetParameter(mc, "MachineType", m_machinetype);
     if (m_driverconfig.Save(xh, mc))
     {
         retval = true;
     }
     m_monitorconfig.Save(xh, mc);
     xh.Save(FILE_VERSION);
     return retval;
 }
        public bool Load(string filename)
        {
            m_filename = filename;
            m_lstMonitorconfigs.Clear(); // clear any previously loaded monitors
            m_name = Path.GetFileNameWithoutExtension(filename);
            bool retval = false;
            XmlHelper xh = new XmlHelper();
            bool fileExist = xh.Start(m_filename, "MachineConfig");
            XmlNode mc = xh.m_toplevel;

            m_PlatXSize = xh.GetDouble(mc, "PlatformXSize", 102.0);
            m_PlatYSize = xh.GetDouble(mc, "PlatformYSize", 77.0);
            m_PlatZSize = xh.GetDouble(mc, "PlatformZSize", 100.0);
            m_XMaxFeedrate = xh.GetDouble(mc, "MaxXFeedRate", 100.0);
            m_YMaxFeedrate = xh.GetDouble(mc, "MaxYFeedRate", 100.0);
            m_ZMaxFeedrate = xh.GetDouble(mc, "MaxZFeedRate", 100.0);
            XRenderSize = xh.GetInt(mc, "XRenderSize", 1024);
            YRenderSize = xh.GetInt(mc, "YRenderSize", 768);
            MachineControls = xh.GetString(mc, "DisplayedControls", "XYZPG");
            m_machinetype = (eMachineType)xh.GetEnum(mc, "MachineType", typeof(eMachineType), eMachineType.UV_DLP);
            m_multimontype = (eMultiMonType)xh.GetEnum(mc, "MultiMonType", typeof(eMultiMonType), eMultiMonType.eHorizontal);
            
            if (m_driverconfig.Load(xh, mc))
            {
                retval = true;
            }

            //m_monitorconfig.Load(xh, mc);
            List<XmlNode> monitornodes = xh.FindAllChildElement(mc, "MonitorDriverConfig");
            m_lstMonitorconfigs = new List<MonitorConfig>();
            foreach (XmlNode node in monitornodes) 
            {
                MonitorConfig monc = new MonitorConfig();
                monc.Load(xh, node);
                m_lstMonitorconfigs.Add(monc);
            }
            if (m_lstMonitorconfigs.Count > 0)
            {
                // we need at least 1 monitor
                //m_monitorconfig = m_lstMonitorconfigs[0];
            }
            else 
            {
                DebugLogger.Instance().LogError("No monitor configurations found!");
            }

            CalcPixPerMM();

            if (!fileExist)
            {
                xh.Save(FILE_VERSION);
            }
            CorrectMonitorConfig();
            return retval;
        }
        public bool Save(string filename)
        {
            bool retval = false;
            m_filename = filename;
            m_name = Path.GetFileNameWithoutExtension(filename);
            XmlHelper xh = new XmlHelper();
            // bool fileExist = xh.Start(m_filename, "MachineConfig");
            //bool fileExist = false;
            xh.StartNew(m_filename, "MachineConfig");
            XmlNode mc = xh.m_toplevel;
            xh.SetParameter(mc, "PlatformXSize", m_PlatXSize);
            xh.SetParameter(mc, "PlatformYSize", m_PlatYSize);
            xh.SetParameter(mc, "PlatformZSize", m_PlatZSize);
            xh.SetParameter(mc, "MaxXFeedRate", m_XMaxFeedrate);
            xh.SetParameter(mc, "MaxYFeedRate", m_YMaxFeedrate);
            xh.SetParameter(mc, "MaxZFeedRate", m_ZMaxFeedrate);
            xh.SetParameter(mc, "XRenderSize", XRenderSize);
            xh.SetParameter(mc, "YRenderSize", YRenderSize);
            xh.SetParameter(mc, "DisplayedControls", MachineControls);

            xh.SetParameter(mc, "MachineType", m_machinetype);
            xh.SetParameter(mc, "MultiMonType", m_multimontype);

            if (m_driverconfig.Save(xh, mc))
            {
                retval = true;
            }
            // save all the monitor configurations
            foreach (MonitorConfig monc in m_lstMonitorconfigs) 
            {
                monc.Save(xh, mc);
            }
            //m_monitorconfig.Save(xh, mc);
            xh.Save(FILE_VERSION);
            return retval;
        }
示例#20
0
        public bool Load(String filename)
        {
            m_filename = filename;
            XmlHelper xh = new XmlHelper();
            bool fileExist = xh.Start(filename, "SliceBuildConfig");

            LoadInternal(ref xh);
            if (!fileExist)
            {
                return xh.Save(FILE_VERSION);
            }

            return true;
        }
示例#21
0
 /// <summary>
 /// Load the slice and build profile from a Stream
 /// This is used when we're serializing / deserializing from the 
 /// Memory stream pulled from a zip file
 /// </summary>
 /// <param name="stream"></param>
 /// <param name="filename"></param>
 /// <returns></returns>
 public bool Load(Stream stream, String filename)
 {
     m_filename = filename;
     XmlHelper xh = new XmlHelper();
     bool fileExist = xh.LoadFromStream(stream, "SliceBuildConfig");
     LoadInternal(ref xh);
     return true;
 }
示例#22
0
 public bool Save(MemoryStream stream, string filename)
 {
     m_filename = filename;
     XmlHelper xh = new XmlHelper();
     bool fileExist = xh.Start(filename, "SliceBuildConfig");
     SaveInternal(ref xh);
     xh.Save(FILE_VERSION, ref stream);
     return true;
 }
示例#23
0
 public bool Save(String filename)
 {
     m_filename = filename;
     XmlHelper xh = new XmlHelper();
     xh.StartNew(filename, "SliceBuildConfig");
     SaveInternal(ref xh);
     try
     {
         xh.Save(FILE_VERSION);
     }
     catch (Exception ex)
     {
         DebugLogger.Instance().LogRecord(ex.Message);
         return false;
     }
     return true;
 }
 public void CreateFromStream(Stream stream) 
 {
     XmlHelper manifest = new XmlHelper();
 }
示例#25
0
 /// <summary>
 /// This function assumes that the file has already been saved
 /// after setting the variable, it will re-save the file
 /// </summary>
 /// <param name="varname"></param>
 /// <param name="value"></param>
 public void SetStringVar(string varname, string value)
 {
     //m_filename = filename;
     XmlHelper xh = new XmlHelper();
     xh.StartNew(m_filename, "SliceBuildConfig");
     SaveInternal(ref xh);
     //save the var
     XmlNode sbc = xh.m_toplevel;
     xh.SetParameter(sbc, varname, value);
     try
     {
         xh.Save(FILE_VERSION);
     }
     catch (Exception ex)
     {
         DebugLogger.Instance().LogRecord(ex.Message);
     }
 }
 public bool Save(String filename)
 {
     try
     {
         XmlHelper xh = new XmlHelper();
         bool fileExist = xh.Start(filename, "ApplicationConfig");
         XmlNode ac = xh.m_toplevel;
         xh.SetParameter(ac, "LastModelName", m_LastModelFilename);
         xh.SetParameter(ac, "SliceProfileName", Path.GetFileName(m_cursliceprofilename));
         xh.SetParameter(ac, "MachineProfileName", Path.GetFileName(m_curmachineeprofilename));
         xh.SetParameter(ac, "AutoConnect", m_autoconnect ? "True" : "False");
         xh.SetParameter(ac, "LoadLastModel", m_loadlastmodel ? "True" : "False");
         xh.SetParameter(ac, "Slic3rLocation", m_slic3rloc);
         xh.SetParameter(ac, "ForegroundColor", m_foregroundcolor);
         xh.SetParameter(ac, "BackgroundColor", m_backgroundcolor);
         xh.SetParameter(ac, "PreviewSlices", m_previewslicesbuilddisplay);
         xh.Save(FILE_VERSION);
         return true;
     }catch(Exception ex)
     {
         DebugLogger.Instance().LogRecord(ex.Message);
         return false;
     }
 }
示例#27
0
 public bool Save(String filename)
 {
     try
     {
         XmlHelper xh = new XmlHelper();
         bool fileExist = xh.Start(filename, "ApplicationConfig");
         XmlNode ac = xh.m_toplevel;
         xh.SetParameter(ac, "LastModelName", m_LastModelFilename);
         xh.SetParameter(ac, "SliceProfileName", Path.GetFileName(m_cursliceprofilename));
         xh.SetParameter(ac, "MachineProfileName", Path.GetFileName(m_curmachineeprofilename));
         xh.SetParameter(ac, "AutoConnect", m_autoconnect ? "True" : "False");
         xh.SetParameter(ac, "LoadLastModel", m_loadlastmodel ? "True" : "False");
         xh.SetParameter(ac, "Slic3rLocation", m_slic3rloc);
         xh.SetParameter(ac, "Slic3rParams", m_slic3rparameters);
         xh.SetParameter(ac, "ForegroundColor", m_foregroundcolor);
         xh.SetParameter(ac, "BackgroundColor", m_backgroundcolor);
         xh.SetParameter(ac, "PreviewSlices", m_previewslicesbuilddisplay);
         xh.SetParameter(ac, "Preview3dSlice", m_viewslice3d);
         xh.SetParameter(ac, "Preview3dSliceHeight", m_viewslice3dheight);
         xh.SetParameter(ac, "DriverLogging", m_driverdebuglog);
         xh.SetParameter(ac, "IgnoreGCRsp", m_ignoreGCrsp);
         xh.SetParameter(ac, "ShowBoundingBox", m_showBoundingBox);
         xh.SetParameter(ac, "LicenseKey", m_licensekey);
         xh.Save(FILE_VERSION);
         return true;
     }catch(Exception ex)
     {
         DebugLogger.Instance().LogRecord(ex.Message);
         return false;
     }
 }
示例#28
0
        private void SaveInternal(ref XmlHelper xh)
        {
            XmlNode sbc = xh.m_toplevel;
            xh.SetParameter(sbc, "DotsPermmX", dpmmX);
            xh.SetParameter(sbc, "DotsPermmY", dpmmY);
            xh.SetParameter(sbc, "XResolution", xres);
            xh.SetParameter(sbc, "YResolution", yres);
            //xh.SetParameter(sbc, "SliceHeight", ZThick);
            //xh.SetParameter(sbc, "LayerTime", layertime_ms);
            //xh.SetParameter(sbc, "FirstLayerTime", firstlayertime_ms);
            xh.SetParameter(sbc, "BlankTime", blanktime_ms);
            xh.SetParameter(sbc, "PlatformTemp", plat_temp);
            // xh.SetParameter(sbc, "ExportGCode", exportgcode);
            xh.SetParameter(sbc, "ExportSVG", exportsvg);
            xh.SetParameter(sbc, "Export", export);
            xh.SetParameter(sbc, "ExportPNG", exportpng);

            xh.SetParameter(sbc, "XOffset", XOffset);
            xh.SetParameter(sbc, "YOffset", YOffset);
            //xh.SetParameter(sbc, "NumberofBottomLayers", numfirstlayers);
            xh.SetParameter(sbc, "Direction", direction);
            xh.SetParameter(sbc, "LiftDistance", liftdistance);
            xh.SetParameter(sbc, "SlideTiltValue", slidetiltval);
            xh.SetParameter(sbc, "AntiAliasing", antialiasing);
            xh.SetParameter(sbc, "UseMainLiftGCode", usemainliftgcode);
            xh.SetParameter(sbc, "AntiAliasingValue", aaval);
            xh.SetParameter(sbc, "LiftFeedRate", liftfeedrate);
            xh.SetParameter(sbc, "BottomLiftFeedRate", bottomliftfeedrate);
            xh.SetParameter(sbc, "LiftRetractRate", liftretractrate);
            xh.SetParameter(sbc, "ExportOption", m_exportopt);
            xh.SetParameter(sbc, "RenderOutlines", m_createoutlines);
            xh.SetParameter(sbc, "OutlineWidth_Inset", m_outlinewidth_inset);
            xh.SetParameter(sbc, "OutlineWidth_Outset", m_outlinewidth_outset);

            xh.SetParameter(sbc, "FlipX", m_flipX);
            xh.SetParameter(sbc, "FlipY", m_flipY);
            xh.SetParameter(sbc, "Notes", m_notes);
            //xh.SetParameter(sbc, "ResinPriceL", m_resinprice);
            xh.SetParameter(sbc, "GCodeHeader", m_headercode);
            xh.SetParameter(sbc, "GCodeFooter", m_footercode);
            xh.SetParameter(sbc, "GCodePreslice", m_preslicecode);
            xh.SetParameter(sbc, "GCodeLift", m_liftcode);

            xh.SetParameter(sbc, "SelectedInk", selectedInk);
            foreach (KeyValuePair<string, InkConfig> entry in inks)
            {
                inks[entry.Key].Save(xh, sbc);
            }
            xh.SetParameter(sbc, "MinTestExposure", minExposure);
            xh.SetParameter(sbc, "TestExposureStep", exposureStep);
            xh.SetParameter(sbc, "ExportPreview", exportpreview);

            xh.SaveUserParamList(userParams);
        }
示例#29
0
        private void LoadInternal(ref XmlHelper xh)
        {
            XmlNode sbc = xh.m_toplevel;
            dpmmX = xh.GetDouble(sbc, "DotsPermmX", 102.4);
            dpmmY = xh.GetDouble(sbc, "DotsPermmY", 76.8);
            xres = xh.GetInt(sbc, "XResolution", 1024);
            yres = xh.GetInt(sbc, "YResolution", 768);
            //ZThick = xh.GetDouble(sbc, "SliceHeight", 0.05);
            //layertime_ms = xh.GetInt(sbc, "LayerTime", 1000); // 1 second default
            //firstlayertime_ms = xh.GetInt(sbc, "FirstLayerTime", 5000);
            blanktime_ms = xh.GetInt(sbc, "BlankTime", 2000); // 2 seconds blank
            plat_temp = xh.GetInt(sbc, "PlatformTemp", 75);
            //exportgcode = xh.GetBool(sbc, "ExportGCode"));

            exportsvg = xh.GetInt(sbc, "ExportSVG", 0); // the problem is this was previously a boolean variable

            if ((exportsvg < 0) || (exportsvg > 4))
                exportsvg = 0;
            export = xh.GetBool(sbc, "Export", false); ;
            exportpng = xh.GetBool(sbc, "ExportPNG", false); ;

            XOffset = xh.GetInt(sbc, "XOffset", 0);
            YOffset = xh.GetInt(sbc, "YOffset", 0);
            //numfirstlayers = xh.GetInt(sbc, "NumberofBottomLayers", 3);
            direction = (eBuildDirection)xh.GetEnum(sbc, "Direction", typeof(eBuildDirection), eBuildDirection.Bottom_Up);
            liftdistance = xh.GetDouble(sbc, "LiftDistance", 5.0);
            slidetiltval = xh.GetDouble(sbc, "SlideTiltValue", 0.0);
            antialiasing = xh.GetBool(sbc, "AntiAliasing", false);
            usemainliftgcode = xh.GetBool(sbc, "UseMainLiftGCode", false);
            aaval = xh.GetDouble(sbc, "AntiAliasingValue", 1.5);
            liftfeedrate = xh.GetDouble(sbc, "LiftFeedRate", 50.0); // 50mm/s
            bottomliftfeedrate = xh.GetDouble(sbc, "BottomLiftFeedRate", 25.0); // 50mm/s
            liftretractrate = xh.GetDouble(sbc, "LiftRetractRate", 100.0); // 100mm/s
            m_exportopt = xh.GetString(sbc, "ExportOption", "SUBDIR"); // default to saving in subdirectory
            m_flipX = xh.GetBool(sbc, "FlipX", false);
            m_flipY = xh.GetBool(sbc, "FlipY", false);
            m_notes = xh.GetString(sbc, "Notes", "");
            m_createoutlines = xh.GetBool(sbc, "RenderOutlines", false);
            m_outlinewidth_inset = xh.GetDouble(sbc, "OutlineWidth_Inset", 2.0);
            m_outlinewidth_outset = xh.GetDouble(sbc, "OutlineWidth_Outset", 0.0);

            //m_resinprice = xh.GetDouble(sbc, "ResinPriceL", 0.0);

            m_headercode = xh.GetString(sbc, "GCodeHeader", DefGCodeHeader());
            m_footercode = xh.GetString(sbc, "GCodeFooter", DefGCodeFooter());
            m_preslicecode = xh.GetString(sbc, "GCodePreslice", DefGCodePreslice());
            m_liftcode = xh.GetString(sbc, "GCodeLift", DefGCodeLift());
            selectedInk = xh.GetString(sbc, "SelectedInk", "Default");
            inks = new Dictionary<string, InkConfig>();
            List<XmlNode> inkNodes = xh.FindAllChildElement(sbc, "InkConfig");
            foreach (XmlNode xnode in inkNodes)
            {
                string name = xh.GetString(xnode, "Name", "Default");
                InkConfig ic = new InkConfig(name);
                ic.Load(xh, xnode);
                inks[name] = ic;
            }
            if (!inks.ContainsKey(selectedInk))
            {
                InkConfig ic = new InkConfig(selectedInk);
                ic.Load(xh, sbc); // try loading legacy settings from parent
                inks[selectedInk] = ic;
            }
            SetCurrentInk(selectedInk);
            minExposure = xh.GetInt(sbc, "MinTestExposure", 500);
            exposureStep = xh.GetInt(sbc, "TestExposureStep", 200);
            exportpreview = (PreviewGenerator.ePreview)xh.GetEnum(sbc, "ExportPreview", typeof(PreviewGenerator.ePreview), PreviewGenerator.ePreview.None);
            xh.LoadUserParamList(userParams);
        }
        public bool Load(string filename)
        {
            m_filename = filename;
            m_name = Path.GetFileNameWithoutExtension(filename);
            bool retval = false;
            XmlHelper xh = new XmlHelper();
            bool fileExist = xh.Start(m_filename, "MachineConfig");
            XmlNode mc = xh.m_toplevel;

            m_PlatXSize = xh.GetDouble(mc, "PlatformXSize", 102.0);
            m_PlatYSize = xh.GetDouble(mc, "PlatformYSize", 77.0);
            m_PlatZSize = xh.GetDouble(mc, "PlatformZSize", 100.0);
            m_XMaxFeedrate = xh.GetDouble(mc, "MaxXFeedRate", 100.0);
            m_YMaxFeedrate = xh.GetDouble(mc, "MaxYFeedRate", 100.0);
            m_ZMaxFeedrate = xh.GetDouble(mc, "MaxZFeedRate", 100.0);
            m_machinetype = (eMachineType)xh.GetEnum(mc, "MachineType", typeof(eMachineType), eMachineType.UV_DLP);

            if (m_driverconfig.Load(xh, mc))
            {
                retval = true;
            }

            m_monitorconfig.Load(xh, mc);
            CalcPixPerMM();

            if (!fileExist)
            {
                xh.Save(FILE_VERSION);
            }
            return retval;
        }