Beispiel #1
0
        //-----------------------------------------------------------------------------------------------------------------//
        //------------------------------ Initialize MachineTool -----------------------------------------------------------//
        //-----------------------------------------------------------------------------------------------------------------//

        public MachineTool()
        {
            InitializeComponent();

            reportProc1 = new Report(this);
            reportProc2 = new Report(this);
            xml         = new WriteXML(this);

            // Load saved settings if available
            if (File.Exists("settings.ini"))
            {
                loadSettings();
            }

            stop.Enabled = false;

            // Check Number Of Axes
            if (threeAxis.Checked)
            {
                axis3 = true;
            }
            if (fourAxis.Checked)
            {
                axis4 = true;
            }
            if (fiveAxis.Checked)
            {
                axis5 = true;
            }

            if (threeAxisP2.Checked)
            {
                axis3P2 = true;
            }
            if (fourAxisP2.Checked)
            {
                axis4P2 = true;
            }
            if (fiveAxisP2.Checked)
            {
                axis5P2 = true;
            }

            if (gifu.Checked)
            {
                gifuChanger = true;
            }
            else
            {
                gifuChanger = false;
            }

            if (gantry.Checked)
            {
                gantryChecked = true;
            }
            else if (fixedBridge.Checked)
            {
                fixedBridgeChecked = true;
            }
            else if (highRail.Checked)
            {
                highRailChecked = true;
            }

            nickName = cncName.Text;
            cncModel = model.Text;
            hostIP   = this.hostname.Text;
            fanucIP  = cncField.Text;
            portP1   = this.port.Text;
            portP2   = this.port2.Text;
            try
            {
                axisXmNum = Convert.ToInt16(xAxisID.Text); // X Master Axis Number
                axisYNum  = Convert.ToInt16(yAxisID.Text); // Y Axis Number
                axisZNum  = Convert.ToInt16(zAxisID.Text); // Z Axis Number
                if (cAxisID.Text != "-")
                {
                    axisCNum = Convert.ToInt16(cAxisID.Text);  // C Axis Number
                }
                if (aAxisID.Text != "-")
                {
                    axisANum = Convert.ToInt16(aAxisID.Text);  // A Axis Number
                }
                if (uAxisID.Text != "-")
                {
                    axisUNum = Convert.ToInt16(uAxisID.Text);  // U Axis Number
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Axis ID's must be a valid number or a '-' if the axis is not being used. X, Y & Z must be a valid integer only.");
            }

            WindowState = FormWindowState.Minimized;
            this.Hide();
        }
Beispiel #2
0
        //-----------------------------------------------------------------------------------------------------------------//
        //------------------------------ Initialize MachineTool -----------------------------------------------------------//
        //-----------------------------------------------------------------------------------------------------------------//

        public MachineTool()
        {
            InitializeComponent();
            
            reportProc1 = new Report(this);
            reportProc2 = new Report(this);
            xml = new WriteXML(this);

            // Load saved settings if available
            if (File.Exists("settings.ini"))
            {
                loadSettings();
            }

            stop.Enabled = false;

            // Check Number Of Axes
            if (threeAxis.Checked)
            {
                axis3 = true;
            }
            if (fourAxis.Checked)
            {
                axis4 = true;
            }
            if (fiveAxis.Checked)
            {
                axis5 = true;
            }

            if (threeAxisP2.Checked)
            {
                axis3P2 = true;
            }
            if (fourAxisP2.Checked)
            {
                axis4P2 = true;
            }
            if (fiveAxisP2.Checked)
            {
                axis5P2 = true;
            }

            if (gifu.Checked)
            {
                gifuChanger = true;
            }
            else gifuChanger = false;

            if (gantry.Checked)
            {
                gantryChecked = true;
            }
            else if (fixedBridge.Checked)
            {
                fixedBridgeChecked = true;
            }
            else if (highRail.Checked)
            {
                highRailChecked = true;
            }

            nickName = cncName.Text;
            cncModel = model.Text;
            hostIP = this.hostname.Text;
            fanucIP = cncField.Text;
            portP1 = this.port.Text;
            portP2 = this.port2.Text;
            try
            {
                axisXmNum = Convert.ToInt16(xAxisID.Text); // X Master Axis Number
                axisYNum = Convert.ToInt16(yAxisID.Text);  // Y Axis Number
                axisZNum = Convert.ToInt16(zAxisID.Text);  // Z Axis Number
                if (cAxisID.Text != "-")
                    axisCNum = Convert.ToInt16(cAxisID.Text);  // C Axis Number
                if (aAxisID.Text != "-")
                    axisANum = Convert.ToInt16(aAxisID.Text);  // A Axis Number
                if (uAxisID.Text != "-")
                    axisUNum = Convert.ToInt16(uAxisID.Text);  // U Axis Number
            }
            catch(Exception ex)
            {
                MessageBox.Show("Axis ID's must be a valid number or a '-' if the axis is not being used. X, Y & Z must be a valid integer only.");
            }

            WindowState = FormWindowState.Minimized;
            this.Hide();
        }
Beispiel #3
0
        //------------------------------------------------------------------------------------------------------------------//
        //---------------------------------- Create Devices.XML ------------------------------------------------------------//
        //------------------------------------------------------------------------------------------------------------------//

        private void genXML_Click(object sender, EventArgs e)
        {
            // Create an instance of WriteXML
            WriteXML xml1 = new WriteXML(this);

            // MessageBox asking to to generate new XML and CFG files
            var confirmSave = MessageBox.Show("This will Generate an XML file for the current configuration. Would you like to continue?", "Generate XML", MessageBoxButtons.YesNo);

            if (confirmSave == DialogResult.Yes)
            {
                // Check if Dual Process
                if (dualProc.Checked)
                {
                    string[] buffer  = new string[9];
                    string[] buffer2 = new string[2];
                    // Call the functions to write the XML and CFG for P1 and P2
                    xml1.proc1(buffer);
                    xml1.proc2(buffer);
                    xml1.agentCFG(buffer2);

                    // Check to see if directory exists and write all lines to the files
                    if (Directory.Exists("./agent/bin"))
                    {
                        File.WriteAllLines(@"./agent/bin/Devices.xml", buffer);
                        File.WriteAllLines(@"./agent/bin/agent.cfg", buffer2);
                    }
                    else
                    {
                        MessageBox.Show("Directory /agnet/bin does not exist!", "Error");
                    }
                    // Ask to save the configuration to settings.ini
                    var askSave = MessageBox.Show("Configuration files have been written! Would you like to save the current configuration?", "Save", MessageBoxButtons.YesNo);
                    if (askSave == DialogResult.Yes)
                    {
                        saveSettings();
                        editModeDisable();
                    }
                }
                else
                {
                    // If the machine is single process
                    string[] buffer  = new string[6];
                    string[] buffer2 = new string[2];
                    // Call the functions to generate the XML and CFG for P1 only
                    xml1.proc1(buffer);
                    xml1.agentCFG(buffer2);

                    // Check to see if the directory exists
                    if (Directory.Exists("./agent/bin"))
                    {
                        File.WriteAllLines(@"./agent/bin/Devices.xml", buffer);
                        File.WriteAllLines(@"./agent/bin/agent.cfg", buffer2);
                    }
                    else
                    {
                        MessageBox.Show("Directory /agent/bin does not exist!", "Error");
                    }
                    // ask to save the current configuration to settings.ini
                    var askSave = MessageBox.Show("Configuration files have been written! Would you like to save the current configuration?", "Save", MessageBoxButtons.YesNo);
                    if (askSave == DialogResult.Yes)
                    {
                        saveSettings();
                        editModeDisable();
                    }
                }
            }
        }
Beispiel #4
0
        //------------------------------------------------------------------------------------------------------------------//
        //---------------------------------- Create Devices.XML ------------------------------------------------------------//
        //------------------------------------------------------------------------------------------------------------------//

        private void genXML_Click(object sender, EventArgs e)
        {
            // Create an instance of WriteXML
            WriteXML xml1 = new WriteXML(this);

            // MessageBox asking to to generate new XML and CFG files
            var confirmSave = MessageBox.Show("This will Generate an XML file for the current configuration. Would you like to continue?", "Generate XML", MessageBoxButtons.YesNo);
            if (confirmSave == DialogResult.Yes)
            {
                // Check if Dual Process
                if (dualProc.Checked)
                {
                    string[] buffer = new string[9];
                    string[] buffer2 = new string[2];
                    // Call the functions to write the XML and CFG for P1 and P2
                    xml1.proc1(buffer);
                    xml1.proc2(buffer);
                    xml1.agentCFG(buffer2);

                    // Check to see if directory exists and write all lines to the files
                    if (Directory.Exists("./agent/bin"))
                    {
                        File.WriteAllLines(@"./agent/bin/Devices.xml", buffer);
                        File.WriteAllLines(@"./agent/bin/agent.cfg", buffer2);
                    }
                    else
                    {
                        MessageBox.Show("Directory /agnet/bin does not exist!", "Error");
                    }
                    // Ask to save the configuration to settings.ini
                    var askSave = MessageBox.Show("Configuration files have been written! Would you like to save the current configuration?", "Save", MessageBoxButtons.YesNo);
                    if (askSave == DialogResult.Yes)
                    {
                        saveSettings();
                        editModeDisable();
                    }
                }
                else
                {
                    // If the machine is single process
                    string[] buffer = new string[6];
                    string[] buffer2 = new string[2];
                    // Call the functions to generate the XML and CFG for P1 only
                    xml1.proc1(buffer);
                    xml1.agentCFG(buffer2);

                    // Check to see if the directory exists
                    if (Directory.Exists("./agent/bin"))
                    {
                        File.WriteAllLines(@"./agent/bin/Devices.xml", buffer);
                        File.WriteAllLines(@"./agent/bin/agent.cfg", buffer2);
                    }
                    else
                    {
                        MessageBox.Show("Directory /agent/bin does not exist!", "Error");
                    }
                    // ask to save the current configuration to settings.ini
                    var askSave = MessageBox.Show("Configuration files have been written! Would you like to save the current configuration?", "Save", MessageBoxButtons.YesNo);
                    if (askSave == DialogResult.Yes)
                    {
                        saveSettings();
                        editModeDisable();
                    }

                }
            }
        }