Exemplo n.º 1
0
        private void buttonMoveStart_Click(object sender, EventArgs e)
        {
            bool checkResult = false;

            double[] angle = new double[5];

            try
            {
                myUart.Pack_Debug_out(null, "[5 Axis] Move Start");

                angle[0] = Convert.ToDouble(textBoxAxisA.Text);
                angle[1] = Convert.ToDouble(textBoxAxisB.Text);
                angle[2] = Convert.ToDouble(textBoxAxisX.Text);
                angle[3] = Convert.ToDouble(textBoxAxisY.Text);
                angle[4] = Convert.ToDouble(textBoxAxisZ.Text);

                checkResult = FormChildMeasure.checkFiveAxisAngleRange_Single(angle[0], -30, 75);
                if (!checkResult)
                {
                    FormDeviceInit.showErrorMessageBox("α轴数据范围错误!(-30~75)");
                    return;
                }

                checkResult = FormChildMeasure.checkFiveAxisAngleRange_Single(angle[1], 0, 360);
                if (!checkResult)
                {
                    FormDeviceInit.showErrorMessageBox("β轴数据范围错误!(0~360)");
                    return;
                }

                checkResult = FormChildMeasure.checkFiveAxisAngleRange_Single(angle[2], -30, 30);
                if (!checkResult)
                {
                    FormDeviceInit.showErrorMessageBox("X轴数据范围错误!(-30~+30)");
                    return;
                }

                checkResult = FormChildMeasure.checkFiveAxisAngleRange_Single(angle[3], -30, 30);
                if (!checkResult)
                {
                    FormDeviceInit.showErrorMessageBox("Y轴数据范围错误!(-30~+30)");
                    return;
                }

                checkResult = FormChildMeasure.checkFiveAxisAngleRange_Single(angle[4], -2, 48);
                if (!checkResult)
                {
                    FormDeviceInit.showErrorMessageBox("Z轴数据范围错误!(-2~48)");
                    return;
                }

                myApi.SendAngleABXYZ(angle);
                timerUartRecv.Interval = 1000 * 60;
                timerUartRecv.Enabled  = true;
            }
            catch (Exception ex)
            {
                myUart.Pack_Debug_out(null, "Exception" + "[" + ex.ToString() + "]");
            }
        }