Example #1
0
        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();
            userParams = new UserParameterList();
            xh.LoadUserParamList(userParams);
            return(retval);
        }
Example #2
0
 public MachineConfig()
 {
     m_PlatXSize    = 102.0;
     m_PlatYSize    = 77.0;
     m_PlatZSize    = 100; // 100 mm default, we have to load this
     m_XMaxFeedrate = 100;
     m_YMaxFeedrate = 100;
     m_ZMaxFeedrate = 100;
     XRenderSize    = 1024;
     YRenderSize    = 768;
     m_driverconfig = new DeviceDriverConfig();
     //m_monitorconfig = new MonitorConfig();
     m_lstMonitorconfigs = new List <MonitorConfig>(); // create a list of monitors attached to the system
     m_machinetype       = eMachineType.UV_DLP;
     m_multimontype      = eMultiMonType.eVertical;
     CalcPixPerMM();
 }
        private double m_ZMaxFeedrate; // in mm/min

        #endregion Fields

        #region Constructors

        public MachineConfig()
        {
            m_PlatXSize = 102.0;
            m_PlatYSize = 77.0;
            m_PlatZSize = 100; // 100 mm default, we have to load this
            m_XMaxFeedrate = 100;
            m_YMaxFeedrate = 100;
            m_ZMaxFeedrate = 100;
            XRenderSize = 1024;
            YRenderSize = 768;
            m_driverconfig = new DeviceDriverConfig();
            //m_monitorconfig = new MonitorConfig();
            m_lstMonitorconfigs = new List<MonitorConfig>(); // create a list of monitors attached to the system
            m_machinetype = eMachineType.UV_DLP;
            m_multimontype = eMultiMonType.eVertical;
            CalcPixPerMM();
        }
        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;
        }
        bool Load(XmlHelper xh)
        {
            bool retval = false;

            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);
            m_OverrideRenderSize = xh.GetBool(mc, "OverrideRenderSize", false);

            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);
            m_ip            = xh.GetString(mc, "ip", "192.168.1.6");
            var ComPortnodes = xh.FindAllChildElement(mc, "ComPortSettings");

            foreach (XmlNode node in ComPortnodes)
            {
                serialComPort  = xh.GetString(node, "PortName", "COM1");
                serialBaudRate = xh.GetString(node, "Speed", "9600");
                serialDataBits = xh.GetString(node, "Databits", "8");
                serialParity   = xh.GetString(node, "Parity", "0");
                serialStopBits = xh.GetString(node, "Stopbits", "1");
            }
            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 we have a special render size, don't wipe it out...
            if (m_OverrideRenderSize == false)
            {
                CorrectMonitorConfig();
            }
            userParams = new UserParameterList();
            xh.LoadUserParamList(userParams);
            return(retval);
        }
        bool Load(XmlHelper xh)
        {
            bool retval = false;

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

            CorrectMonitorConfig();
            userParams = new UserParameterList();
            xh.LoadUserParamList(userParams);
            return retval;
        }