예제 #1
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.GetBool(sbc, "ExportSVG", false);
            export    = xh.GetBool(sbc, "Export", 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
            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_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);
        }
 public void CreateDefault()
 {
     numfirstlayers    = 3;
     layertime_ms      = 1000; // 1 second default
     firstlayertime_ms = 5000;
     blanktime_ms      = 2000; // 2 seconds blank
     xres           = 1024;
     yres           = 768;
     ZThick         = .05;
     plat_temp      = 75;
     dpmmX          = 102.4;
     dpmmY          = 76.8;
     XOffset        = 0;
     YOffset        = 0;
     numfirstlayers = 3;
     //exportgcode = true;
     exportsvg    = 0;
     export       = false;
     exportpng    = false;
     direction    = eBuildDirection.Bottom_Up;
     liftdistance = 5.0;
     //raise_time_ms = 750;
     slidetiltval       = 0.0;
     antialiasing       = false;
     usemainliftgcode   = false;
     aaval              = 1.5;
     liftfeedrate       = 50.0;     // 50mm/s
     bottomliftfeedrate = 25.0;
     liftretractrate    = 100.0;    // 100mm/s
     m_exportopt        = "SUBDIR"; // default to saving in subdirectory
     m_flipX            = false;
     m_flipY            = false;
     m_notes            = "";
     m_resinprice       = 0.0;//
     //set the default gcode segments
     m_headercode       = DefGCodeHeader();
     m_footercode       = DefGCodeFooter();
     m_liftcode         = DefGCodeLift();
     m_preslicecode     = DefGCodePreslice();
     m_shutteropencode  = DefGCodeOpenShutter();
     m_shutterclosecode = DefGCodeCloseShutter();
     inks                  = new Dictionary <string, InkConfig>();
     selectedInk           = "Default";
     inks[selectedInk]     = new InkConfig(selectedInk);
     minExposure           = 500;
     m_createoutlines      = false;
     m_outlinewidth_inset  = 2.0;
     m_outlinewidth_outset = 0.0;
     exposureStep          = 200;
     exportpreview         = PreviewGenerator.ePreview.None;
     userParams            = new UserParameterList();
 }
 public bool UpdateCurrentInk()
 {
     if (inks.ContainsKey(selectedInk))
     {
         InkConfig ic = inks[selectedInk];
         ic.ZThick            = ZThick;
         ic.layertime_ms      = layertime_ms;
         ic.firstlayertime_ms = firstlayertime_ms;
         ic.numfirstlayers    = numfirstlayers;
         ic.resinprice        = m_resinprice;
         return(true);
     }
     return(false);
 }
 public bool SetCurrentInk(string inkname)
 {
     if (inks.ContainsKey(inkname))
     {
         selectedInk = inkname;
         InkConfig ic = inks[inkname];
         ZThick            = ic.ZThick;
         layertime_ms      = ic.layertime_ms;
         firstlayertime_ms = ic.firstlayertime_ms;
         numfirstlayers    = ic.numfirstlayers;
         m_resinprice      = ic.resinprice;
         return(true);
     }
     return(false);
 }
        public string AddNewResin(string resinName)
        {
            if (inks.ContainsKey(resinName))
            {
                return("Resin profile name already exists");
            }
            InkConfig ic = new InkConfig(resinName);

            if ((selectedInk != null) && inks.ContainsKey(selectedInk))
            {
                ic.CopyFrom(inks[selectedInk]);
            }
            inks[resinName] = ic;
            SetCurrentInk(resinName);
            return("OK");
        }
예제 #6
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_feed_thickness   = xh.GetDouble(sbc, "FeedThickness", 1);
            m_wall_thickness   = xh.GetDouble(sbc, "WallThickness", 1);
            m_speed_spareading = xh.GetDouble(sbc, "SpeedSpareading", 1);
            m_speed_printing   = xh.GetDouble(sbc, "SpeedPrinting", 1);
            m_roller_speed     = xh.GetDouble(sbc, "Speed_printing", 1);
            m_bottom_layers    = xh.GetDouble(sbc, "BottomLayers", 1);


            //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());
            m_layercode    = xh.GetString(sbc, "GCodeLayer", DefGCodeLayer());
            selectedInk    = xh.GetString(sbc, "SelectedInk", "Default");

            selectedpowder = xh.GetString(sbc, "SelectedPowder", "Default");

            selectedfluid = xh.GetString(sbc, "SelectedFluid", "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;
            }

            fluids = new Dictionary <string, FluidConfig>();
            List <XmlNode> fluidNodes = xh.FindAllChildElement(sbc, "FluidConfig");

            foreach (XmlNode xnode in fluidNodes)
            {
                string name = xh.GetString(xnode, "Name", "Default");
                var    ic   = new FluidConfig(name);
                ic.Load(xh, xnode);
                fluids[name] = ic;
            }
            if (!fluids.ContainsKey(selectedfluid))
            {
                FluidConfig ic = new FluidConfig(selectedfluid);
                ic.Load(xh, sbc); // try loading legacy settings from parent
                fluids[selectedfluid] = ic;
            }


            powders = new Dictionary <string, PowderConfig>();
            List <XmlNode> powderNodes = xh.FindAllChildElement(sbc, "PowderConfig");

            foreach (XmlNode xnode in powderNodes)
            {
                string name = xh.GetString(xnode, "Name", "Default");
                var    ic   = new PowderConfig(name);
                ic.Load(xh, xnode);
                powders[name] = ic;
            }
            if (!powders.ContainsKey(selectedpowder))
            {
                PowderConfig ic = new PowderConfig(selectedpowder);
                ic.Load(xh, sbc); // try loading legacy settings from parent
                powders[selectedpowder] = ic;
            }

            SetCurrentInk(selectedInk);

            SetCurrentPowder(selectedpowder);
            SetCurrentFluid(selectedfluid);

            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);
        }