Esempio n. 1
0
 public void AddMachine(clsMachine m)
 {
     mMachines.Add(m);
     Machine = m;
     if (MachineAdded != null)
     {
         MachineAdded(m);
     }
 }
        private void btnUnockMach_Click(object sender, EventArgs e)
        {
            ResetRemarks();


            LockCtrl();
            Cursor.Current = Cursors.WaitCursor;

            for (int i = 0; i < gv_avbl.DataRowCount; i++)
            {
                //check if selected...
                string tsel = gv_avbl.GetRowCellValue(i, "SEL").ToString();
                if (!Convert.ToBoolean(tsel))
                {
                    continue;
                }

                string ip    = gv_avbl.GetRowCellValue(i, "MachineIP").ToString();
                string ioflg = gv_avbl.GetRowCellValue(i, "IOFLG").ToString().Trim();

                clsMachine m   = new clsMachine(ip, ioflg);
                string     err = string.Empty;

                //try to connect
                m.Connect(out err);

                gv_avbl.SetRowCellValue(i, "Records", 0);
                gv_avbl.SetRowCellValue(i, "Remarks", err);


                string nerr = string.Empty;
                if (!string.IsNullOrEmpty(err))
                {
                    m.DisConnect(out nerr);
                    gv_avbl.SetRowCellValue(i, "Remarks", err + ";" + nerr);
                    continue;
                }


                m.Unlock(out err);
                gv_avbl.SetRowCellValue(i, "Remarks", err);

                if (string.IsNullOrEmpty(err))
                {
                    gv_avbl.SetRowCellValue(i, "Remarks", "Machine Unlocked...");
                }
                else
                {
                    gv_avbl.SetRowCellValue(i, "Remarks", err);
                }

                m.DisConnect(out nerr);
            }

            UnLockCtrl();
            Cursor.Current = Cursors.WaitCursor;
        }
Esempio n. 3
0
        private void mSetup_MachineActivated(clsMachine m)
        {
            {
                MG_Viewer1.RotaryDirection = (RotaryDirection)m.RotaryDir;
                MG_Viewer1.RotaryPlane     = (Axis)m.RotaryAxis;
                MG_Viewer1.RotaryType      = (RotaryMotionType)m.RotaryType;
                MG_Viewer1.ViewManipMode   = MG_CS_BasicViewer.ManipMode.SELECTION;

                MG_Viewer1.FindExtents();
                mViewer.Redraw(true);
            }
        }
Esempio n. 4
0
        private string[] download(string ip, string ioflg, int rowno)
        {
            string err = string.Empty;

            string[]       outary   = { rowno.ToString(), "0", "" };
            List <AttdLog> tempattd = new List <AttdLog>();

            try
            {
                clsMachine m = new clsMachine(ip, ioflg);
                m.Connect(out err);
                if (!string.IsNullOrEmpty(err))
                {
                    outary[0] = rowno.ToString();
                    outary[1] = "0";
                    outary[2] = err;

                    return(outary);
                }

                err = string.Empty;

                //pending
                //Path.Combine(Utils.Helper.GetLogFilePath, rowno.ToString() + "_attdlog.dat");

                //m.GetAttdRec(out tempattd, out err);
                if (!string.IsNullOrEmpty(err))
                {
                    //gv.SetRowCellValue(rowno, "Records", 0);
                    //gv.SetRowCellValue(rowno, "Remarks", err);
                    outary[0] = rowno.ToString();
                    outary[1] = "0";
                    outary[2] = err;
                    return(outary);
                }

                m.DisConnect(out err);
            }
            catch (Exception ex)
            {
                err       = ex.ToString();
                outary[0] = rowno.ToString();
                outary[1] = "0";
                outary[2] = err;
                return(outary);
            }
            outary[0] = rowno.ToString();
            outary[1] = tempattd.Count.ToString();
            outary[2] = "Download Complete";
            return(outary);
        }
Esempio n. 5
0
    public void MatchMachineToFile(string sFullfile)
    {
        int ln = 0;

        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        string sTemp = null;

        System.IO.StreamReader fileReader = default(System.IO.StreamReader);

        if (mMachines.Count == 0)
        {
            Machine = null;
            return;
        }
        //Open CNC file and get 50 lines of text
        fileReader = new System.IO.StreamReader(sFullfile);
        while (fileReader.Peek() >= 0)
        {
            if (ln >= 50)
            {
                break;
            }
            sb.Append(fileReader.ReadLine());
            ln += 1;
        }
        fileReader.Close();
        sTemp = sb.ToString();
        foreach (clsMachine m in mMachines)
        {
            if (sTemp.Contains(m.Searchstring))
            {
                Machine = m;
                if (MachineMatched != null)
                {
                    MachineMatched(Machine);
                }
                return;
            }
        }
    }
Esempio n. 6
0
    public void Init(clsMachine machineSetup)
    {
        {
            mCurMachine = machineSetup;
            const string REG_NCWORDS = "[A-Z]([-+]?[0-9]*[\\.,]?[0-9]*)";

            if (machineSetup == null)
            {
                return;
            }
            string skipChars = "";
            foreach (char c in mCurMachine.BlockSkip.ToCharArray())
            {
                skipChars += Regex.Escape(c.ToString());
            }

            BuildCommentMatch();

            mRegWords = new Regex(InsertCommment() + "[" + skipChars + "][0-9]?|\\n|" + REG_NCWORDS, RegexOptions.Compiled | RegexOptions.IgnoreCase);
            //[:\$O]+([0-9]+) This will return the label and value of each program.
            string progId = Regex.Escape(mCurMachine.ProgramId);
            mRegSubs = new Regex(InsertCommment() + "[" + progId + "]([0-9]+)", RegexOptions.Compiled);
        }
    }
Esempio n. 7
0
        private void mSetup_MachineActivated(clsMachine m)
        {
            {
                MG_Viewer1.RotaryDirection = (RotaryDirection)m.RotaryDir;
                MG_Viewer1.RotaryPlane = (Axis)m.RotaryAxis;
                MG_Viewer1.RotaryType = (RotaryMotionType)m.RotaryType;
                MG_Viewer1.ViewManipMode = MG_CS_BasicViewer.ManipMode.SELECTION;

                MG_Viewer1.FindExtents();
                mViewer.Redraw(true);

            }
        }
Esempio n. 8
0
    public void Init(clsMachine machineSetup)
    {

        {
            mCurMachine = machineSetup;
            const string REG_NCWORDS = "[A-Z]([-+]?[0-9]*[\\.,]?[0-9]*)";

            if (machineSetup == null) return;
            string skipChars = "";
            foreach (char c in mCurMachine.BlockSkip.ToCharArray())
            {
                skipChars += Regex.Escape(c.ToString());
            }

            BuildCommentMatch();

            mRegWords = new Regex(InsertCommment() + "[" + skipChars + "][0-9]?|\\n|" + REG_NCWORDS, RegexOptions.Compiled | RegexOptions.IgnoreCase);
            //[:\$O]+([0-9]+) This will return the label and value of each program. 
            string progId = Regex.Escape(mCurMachine.ProgramId);
            mRegSubs = new Regex(InsertCommment() + "[" + progId + "]([0-9]+)", RegexOptions.Compiled);
        } 
    }
        private void btnClearMach_Click(object sender, EventArgs e)
        {
            string msg = "Make Sure to Download all data in multiple application if running with common machines" + Environment.NewLine +
                         "However Application will download data first, which only accounted in running application. " + Environment.NewLine +
                         "Are You Sure to Clear selected machine ?";


            DialogResult dr = MessageBox.Show(msg, "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dr != DialogResult.Yes)
            {
                return;
            }

            ResetRemarks();
            btnDownload_Click(sender, e);
            ResetRemarks();
            LockCtrl();

            Cursor.Current = Cursors.WaitCursor;

            for (int i = 0; i < gv_avbl.DataRowCount; i++)
            {
                //check if selected...
                string tsel = gv_avbl.GetRowCellValue(i, "SEL").ToString();
                if (!Convert.ToBoolean(tsel))
                {
                    continue;
                }

                string ip    = gv_avbl.GetRowCellValue(i, "MachineIP").ToString();
                string ioflg = gv_avbl.GetRowCellValue(i, "IOFLG").ToString().Trim();

                clsMachine m   = new clsMachine(ip, ioflg);
                string     err = string.Empty;


                //try to connect
                m.Connect(out err);

                gv_avbl.SetRowCellValue(i, "Records", 0);
                gv_avbl.SetRowCellValue(i, "Remarks", err);


                string nerr = string.Empty;

                if (!string.IsNullOrEmpty(err))
                {
                    m.DisConnect(out nerr);
                    gv_avbl.SetRowCellValue(i, "Remarks", err + ";" + nerr);
                    continue;
                }

                //Clear Machine
                m.AttdLogClear(out err);
                if (string.IsNullOrEmpty(err))
                {
                    gv_avbl.SetRowCellValue(i, "Remarks", "Log Clear...");
                }
                else
                {
                    gv_avbl.SetRowCellValue(i, "Remarks", err);
                }
                m.DisConnect(out nerr);
            }

            UnLockCtrl();
            Cursor.Current = Cursors.WaitCursor;
        }
Esempio n. 10
0
        private void btnGetRegCount_Click(object sender, EventArgs e)
        {
            ResetRemarks();


            LockCtrl();
            Cursor.Current = Cursors.WaitCursor;



            for (int i = 0; i < gv_avbl.DataRowCount; i++)
            {
                //check if selected...
                string tsel = gv_avbl.GetRowCellValue(i, "SEL").ToString();
                if (!Convert.ToBoolean(tsel))
                {
                    continue;
                }

                string ip    = gv_avbl.GetRowCellValue(i, "MachineIP").ToString();
                string ioflg = gv_avbl.GetRowCellValue(i, "IOFLG").ToString().Trim();

                clsMachine m   = new clsMachine(ip, ioflg);
                string     err = string.Empty;

                //try to connect
                m.Connect(out err);

                gv_avbl.SetRowCellValue(i, "Records", 0);
                gv_avbl.SetRowCellValue(i, "Remarks", err);


                string nerr = string.Empty;
                if (!string.IsNullOrEmpty(err))
                {
                    m.DisConnect(out nerr);
                    gv_avbl.SetRowCellValue(i, "Remarks", err + ";" + nerr);
                    continue;
                }

                int    UserCount    = 0;
                int    UserCapacity = 0;
                string sql          = "Select FACE from ReaderConfig where MachineIP ='" + ip + "'";
                string tcnt         = Utils.Helper.GetDescription(sql, Utils.Helper.constr);

                //set duplicate punch count
                m.SetDuplicatePunchDuration(3);


                if (Convert.ToBoolean(tcnt))
                {
                    m.Get_StatusInfo_Face(out UserCount, out UserCapacity, out err);
                }
                else
                {
                    m.Get_StatusInfo_Users(out UserCount, out UserCapacity, out err);
                }


                if (string.IsNullOrEmpty(err))
                {
                    gv_avbl.SetRowCellValue(i, "Remarks", UserCapacity.ToString());
                    gv_avbl.SetRowCellValue(i, "Records", UserCount.ToString());
                }

                m.DisConnect(out nerr);
            }

            UnLockCtrl();
            Cursor.Current = Cursors.WaitCursor;
        }
Esempio n. 11
0
    public void LoadMachine(string sName)
    {
        XmlReaderSettings settings = new XmlReaderSettings();
        int r = 0;

        Machine = new clsMachine();
        {
            settings.IgnoreWhitespace             = true;
            settings.IgnoreComments               = true;
            settings.IgnoreProcessingInstructions = true;
            settings.ProhibitDtd = true;
            settings.CloseInput  = true;
        }
        using (XmlReader xReader = XmlReader.Create(sName, settings)) {
            {
                xReader.MoveToContent();
                xReader.ReadToDescendant("Name");
                Machine.Name         = xReader.ReadElementContentAsString();
                Machine.Description  = xReader.ReadElementContentAsString();
                Machine.AbsArcCenter = bool.Parse(xReader.ReadElementContentAsString());
                Machine.LatheMinus   = bool.Parse(xReader.ReadElementContentAsString());
                Machine.HelixPitch   = bool.Parse(xReader.ReadElementContentAsString());
                Machine.BlockSkip    = xReader.ReadElementContentAsString();
                Machine.Comments     = xReader.ReadElementContentAsString();
                Machine.Endmain      = xReader.ReadElementContentAsString();
                Machine.MachineType  = (MachineType)Enum.Parse(typeof(MachineType), xReader.ReadElementContentAsString());
                Machine.RotaryAxis   = (Axis)Enum.Parse(typeof(Axis), xReader.ReadElementContentAsString());
                Machine.RotaryDir    = (RotaryDirection)Enum.Parse(typeof(RotaryDirection), xReader.ReadElementContentAsString());
                Machine.Precision    = int.Parse(xReader.ReadElementContentAsString());
                Machine.ProgramId    = xReader.ReadElementContentAsString();
                Machine.SubReturn    = xReader.ReadElementContentAsString();
                Machine.RotPrecision = int.Parse(xReader.ReadElementContentAsString());
                Machine.RotaryType   = (RotaryMotionType)Enum.Parse(typeof(RotaryMotionType), xReader.ReadElementContentAsString());
                Machine.Searchstring = xReader.ReadElementContentAsString();
                for (r = 0; r <= Machine.ViewAngles.Length - 1; r++)
                {
                    Machine.ViewAngles[r] = float.Parse(xReader.ReadElementContentAsString());
                }
                for (r = 0; r <= Machine.ViewShift.Length - 1; r++)
                {
                    Machine.ViewShift[r] = float.Parse(xReader.ReadElementContentAsString());
                }
                Machine.Absolute    = xReader.ReadElementContentAsString();
                Machine.Incremental = xReader.ReadElementContentAsString();
                Machine.CCArc       = xReader.ReadElementContentAsString();
                Machine.CWArc       = xReader.ReadElementContentAsString();
                Machine.DrillRapid  = xReader.ReadElementContentAsString();
                for (r = 0; r <= Machine.Drills.Length - 1; r++)
                {
                    Machine.Drills[r] = xReader.ReadElementContentAsString();
                }
                Machine.Linear         = xReader.ReadElementContentAsString();
                Machine.Rapid          = xReader.ReadElementContentAsString();
                Machine.ReturnLevel[0] = xReader.ReadElementContentAsString();
                Machine.ReturnLevel[1] = xReader.ReadElementContentAsString();
                Machine.Rotary         = xReader.ReadElementContentAsString();
                Machine.XYplane        = xReader.ReadElementContentAsString();
                Machine.XZplane        = xReader.ReadElementContentAsString();
                Machine.YZplane        = xReader.ReadElementContentAsString();
                Machine.Subcall        = xReader.ReadElementContentAsString();
                Machine.SubRepeats     = xReader.ReadElementContentAsString();
            }
        }
        mMachines.Add(Machine);
        if (MachineLoaded != null)
        {
            MachineLoaded(Machine);
        }
    }
Esempio n. 12
0
    public void SaveMachine(clsMachine MySetup)
    {
        string            sName     = DatFolder + MySetup.Name + DATEXTENSION;
        XmlWriterSettings xSettings = new XmlWriterSettings();
        int r = 0;

        xSettings.Indent          = true;
        xSettings.CheckCharacters = false;
        xSettings.CloseOutput     = true;
        using (XmlWriter xWriter = XmlWriter.Create(sName, xSettings)) {
            {
                xWriter.WriteStartDocument(true);
                xWriter.WriteStartElement("Machine");
                xWriter.WriteElementString("Name", MySetup.Name);
                xWriter.WriteElementString("Description", MySetup.Description);
                xWriter.WriteElementString("AbsArcCenter", MySetup.AbsArcCenter.ToString());
                xWriter.WriteElementString("LatheMinus", MySetup.LatheMinus.ToString());
                xWriter.WriteElementString("HelixPitch", MySetup.HelixPitch.ToString());
                xWriter.WriteElementString("BlockSkip", MySetup.BlockSkip);
                xWriter.WriteElementString("Comments", MySetup.Comments);
                xWriter.WriteElementString("Endmain", MySetup.Endmain.ToString());
                xWriter.WriteElementString("MachineType", MySetup.MachineType.ToString());
                xWriter.WriteElementString("RotaryAxis", MySetup.RotaryAxis.ToString());
                xWriter.WriteElementString("RotaryDir", MySetup.RotaryDir.ToString());
                xWriter.WriteElementString("Precision", MySetup.Precision.ToString());
                xWriter.WriteElementString("ProgramId", MySetup.ProgramId);
                xWriter.WriteElementString("SubReturn", MySetup.SubReturn);
                xWriter.WriteElementString("RotPrecision", MySetup.RotPrecision.ToString());
                xWriter.WriteElementString("RotaryType", MySetup.RotaryType.ToString());
                xWriter.WriteElementString("Searchstring", MySetup.Searchstring);
                for (r = 0; r <= 2; r++)
                {
                    xWriter.WriteElementString("ViewAngles_" + r.ToString(), MySetup.ViewAngles[r].ToString());
                }
                for (r = 0; r <= 2; r++)
                {
                    xWriter.WriteElementString("ViewShift_" + r.ToString(), MySetup.ViewShift[r].ToString());
                }
                xWriter.WriteElementString("Absolute", MySetup.Absolute);
                xWriter.WriteElementString("Incremental", MySetup.Incremental);
                xWriter.WriteElementString("CCArc", MySetup.CCArc);
                xWriter.WriteElementString("CWArc", MySetup.CWArc);
                xWriter.WriteElementString("DrillRapid", MySetup.DrillRapid);
                for (r = 0; r <= MySetup.Drills.Length - 1; r++)
                {
                    xWriter.WriteElementString("Drills_" + r.ToString(), MySetup.Drills[r]);
                }
                xWriter.WriteElementString("Linear", MySetup.Linear);
                xWriter.WriteElementString("Rapid", MySetup.Rapid);
                xWriter.WriteElementString("ReturnLevel_0", MySetup.ReturnLevel[0]);
                xWriter.WriteElementString("ReturnLevel_1", MySetup.ReturnLevel[1]);
                xWriter.WriteElementString("Rotary", MySetup.Rotary);
                xWriter.WriteElementString("XYplane", MySetup.XYplane);
                xWriter.WriteElementString("XZplane", MySetup.XZplane);
                xWriter.WriteElementString("YZplane", MySetup.YZplane);
                xWriter.WriteElementString("Subcall", MySetup.Subcall);
                xWriter.WriteElementString("SubRepeats", MySetup.SubRepeats);
                xWriter.WriteEndElement();
                //Machine
            }
        }
    }
Esempio n. 13
0
 public void LoadMachine(string sName) 
 { 
     XmlReaderSettings settings = new XmlReaderSettings(); 
     int r = 0; 
     Machine = new clsMachine(); 
     { 
         settings.IgnoreWhitespace = true; 
         settings.IgnoreComments = true; 
         settings.IgnoreProcessingInstructions = true; 
         settings.ProhibitDtd = true; 
         settings.CloseInput = true; 
     } 
     using (XmlReader xReader = XmlReader.Create(sName, settings)) { 
         { 
             xReader.MoveToContent(); 
             xReader.ReadToDescendant("Name"); 
             Machine.Name = xReader.ReadElementContentAsString(); 
             Machine.Description = xReader.ReadElementContentAsString();
             Machine.AbsArcCenter = bool.Parse(xReader.ReadElementContentAsString());
             Machine.LatheMinus = bool.Parse(xReader.ReadElementContentAsString());
             Machine.HelixPitch = bool.Parse(xReader.ReadElementContentAsString()); 
             Machine.BlockSkip = xReader.ReadElementContentAsString(); 
             Machine.Comments = xReader.ReadElementContentAsString(); 
             Machine.Endmain = xReader.ReadElementContentAsString(); 
             Machine.MachineType = (MachineType)Enum.Parse(typeof(MachineType), xReader.ReadElementContentAsString()); 
             Machine.RotaryAxis = (Axis)Enum.Parse(typeof(Axis), xReader.ReadElementContentAsString()); 
             Machine.RotaryDir = (RotaryDirection)Enum.Parse(typeof(RotaryDirection), xReader.ReadElementContentAsString()); 
             Machine.Precision = int.Parse(xReader.ReadElementContentAsString()); 
             Machine.ProgramId = xReader.ReadElementContentAsString(); 
             Machine.SubReturn = xReader.ReadElementContentAsString(); 
             Machine.RotPrecision = int.Parse(xReader.ReadElementContentAsString()); 
             Machine.RotaryType = (RotaryMotionType)Enum.Parse(typeof(RotaryMotionType), xReader.ReadElementContentAsString()); 
             Machine.Searchstring = xReader.ReadElementContentAsString(); 
             for (r = 0; r <= Machine.ViewAngles.Length - 1; r++) { 
                 Machine.ViewAngles[r] = float.Parse(xReader.ReadElementContentAsString()); 
             } 
             for (r = 0; r <= Machine.ViewShift.Length - 1; r++) { 
                 Machine.ViewShift[r] = float.Parse(xReader.ReadElementContentAsString()); 
             } 
             Machine.Absolute = xReader.ReadElementContentAsString(); 
             Machine.Incremental = xReader.ReadElementContentAsString(); 
             Machine.CCArc = xReader.ReadElementContentAsString(); 
             Machine.CWArc = xReader.ReadElementContentAsString(); 
             Machine.DrillRapid = xReader.ReadElementContentAsString(); 
             for (r = 0; r <= Machine.Drills.Length - 1; r++) { 
                 Machine.Drills[r] = xReader.ReadElementContentAsString(); 
             } 
             Machine.Linear = xReader.ReadElementContentAsString(); 
             Machine.Rapid = xReader.ReadElementContentAsString(); 
             Machine.ReturnLevel[0] = xReader.ReadElementContentAsString(); 
             Machine.ReturnLevel[1] = xReader.ReadElementContentAsString(); 
             Machine.Rotary = xReader.ReadElementContentAsString(); 
             Machine.XYplane = xReader.ReadElementContentAsString(); 
             Machine.XZplane = xReader.ReadElementContentAsString(); 
             Machine.YZplane = xReader.ReadElementContentAsString(); 
             Machine.Subcall = xReader.ReadElementContentAsString(); 
             Machine.SubRepeats = xReader.ReadElementContentAsString(); 
         } 
     } 
     mMachines.Add(Machine); 
     if (MachineLoaded != null) { 
         MachineLoaded(Machine); 
     } 
 } 
Esempio n. 14
0
 public void MatchMachineToFile(string sFullfile) 
 { 
     int ln = 0; 
     System.Text.StringBuilder sb = new System.Text.StringBuilder(); 
     string sTemp = null; 
     System.IO.StreamReader fileReader = default(System.IO.StreamReader); 
     
     if (mMachines.Count == 0) { 
         Machine = null; 
         return; 
     } 
     //Open CNC file and get 50 lines of text 
     fileReader = new System.IO.StreamReader(sFullfile);
     while (fileReader.Peek() >= 0) { 
         if (ln >= 50) break;
         sb.Append(fileReader.ReadLine()); 
         ln += 1; 
     } 
     fileReader.Close(); 
     sTemp = sb.ToString(); 
     foreach (clsMachine m in mMachines) { 
         if (sTemp.Contains(m.Searchstring)) { 
             Machine = m; 
             if (MachineMatched != null) { 
                 MachineMatched(Machine); 
             } 
             return; 
         } 
     } 
 } 
Esempio n. 15
0
 public void AddMachine(clsMachine m) 
 { 
     mMachines.Add(m); 
     Machine = m; 
     if (MachineAdded != null) { 
         MachineAdded(m); 
     } 
 } 
Esempio n. 16
0
 public void SaveMachine(clsMachine MySetup) 
 { 
     string sName = DatFolder + MySetup.Name + DATEXTENSION; 
     XmlWriterSettings xSettings = new XmlWriterSettings(); 
     int r = 0; 
     xSettings.Indent = true; 
     xSettings.CheckCharacters = false; 
     xSettings.CloseOutput = true; 
     using (XmlWriter xWriter = XmlWriter.Create(sName, xSettings)) { 
         { 
             xWriter.WriteStartDocument(true); 
             xWriter.WriteStartElement("Machine"); 
             xWriter.WriteElementString("Name", MySetup.Name); 
             xWriter.WriteElementString("Description", MySetup.Description); 
             xWriter.WriteElementString("AbsArcCenter", MySetup.AbsArcCenter.ToString()); 
             xWriter.WriteElementString("LatheMinus", MySetup.LatheMinus.ToString()); 
             xWriter.WriteElementString("HelixPitch", MySetup.HelixPitch.ToString()); 
             xWriter.WriteElementString("BlockSkip", MySetup.BlockSkip); 
             xWriter.WriteElementString("Comments", MySetup.Comments); 
             xWriter.WriteElementString("Endmain", MySetup.Endmain.ToString()); 
             xWriter.WriteElementString("MachineType", MySetup.MachineType.ToString()); 
             xWriter.WriteElementString("RotaryAxis", MySetup.RotaryAxis.ToString()); 
             xWriter.WriteElementString("RotaryDir", MySetup.RotaryDir.ToString()); 
             xWriter.WriteElementString("Precision", MySetup.Precision.ToString()); 
             xWriter.WriteElementString("ProgramId", MySetup.ProgramId); 
             xWriter.WriteElementString("SubReturn", MySetup.SubReturn); 
             xWriter.WriteElementString("RotPrecision", MySetup.RotPrecision.ToString()); 
             xWriter.WriteElementString("RotaryType", MySetup.RotaryType.ToString()); 
             xWriter.WriteElementString("Searchstring", MySetup.Searchstring); 
             for (r = 0; r <= 2; r++) { 
                 xWriter.WriteElementString("ViewAngles_" + r.ToString(), MySetup.ViewAngles[r].ToString()); 
             } 
             for (r = 0; r <= 2; r++) { 
                 xWriter.WriteElementString("ViewShift_" + r.ToString(), MySetup.ViewShift[r].ToString()); 
             } 
             xWriter.WriteElementString("Absolute", MySetup.Absolute); 
             xWriter.WriteElementString("Incremental", MySetup.Incremental); 
             xWriter.WriteElementString("CCArc", MySetup.CCArc); 
             xWriter.WriteElementString("CWArc", MySetup.CWArc); 
             xWriter.WriteElementString("DrillRapid", MySetup.DrillRapid); 
             for (r = 0; r <= MySetup.Drills.Length - 1; r++) { 
                 xWriter.WriteElementString("Drills_" + r.ToString(), MySetup.Drills[r]); 
             } 
             xWriter.WriteElementString("Linear", MySetup.Linear); 
             xWriter.WriteElementString("Rapid", MySetup.Rapid); 
             xWriter.WriteElementString("ReturnLevel_0", MySetup.ReturnLevel[0]); 
             xWriter.WriteElementString("ReturnLevel_1", MySetup.ReturnLevel[1]); 
             xWriter.WriteElementString("Rotary", MySetup.Rotary); 
             xWriter.WriteElementString("XYplane", MySetup.XYplane); 
             xWriter.WriteElementString("XZplane", MySetup.XZplane); 
             xWriter.WriteElementString("YZplane", MySetup.YZplane); 
             xWriter.WriteElementString("Subcall", MySetup.Subcall); 
             xWriter.WriteElementString("SubRepeats", MySetup.SubRepeats); 
             xWriter.WriteEndElement(); 
             //Machine 
         } 
     } 
 }