예제 #1
0
        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);
        }
예제 #2
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);
        }
예제 #3
0
        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);
        }