Пример #1
0
        /// <summary>
        /// Jog按键按下事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MotionBtn_MouseDown(object sender, MouseEventArgs e)
        {
            if (!m_oKernel.m_bMotionCardInit)
            {
                return;
            }

            double dVel = m_oKernel.GetMotionParaFromIni(@"Velocity", @"Jog");
            double dAcc = m_oKernel.GetMotionParaFromIni(@"Acceleration", @"Jog");

            var btn = (Button)sender;

            if (m_cBoxInchSel.Checked)
            {
                var distanceOfMotion = Convert.ToDouble(m_tBoxInchDis.Text);

                if (btn == m_rBtnXp)
                {
                    m_oKernel.AxisRMove(CKernel.ENUM_AXIS_TYPE.X_AXIS, dVel, 2, distanceOfMotion);
                }
                if (btn == m_rBtnXn)
                {
                    m_oKernel.AxisRMove(CKernel.ENUM_AXIS_TYPE.X_AXIS, dVel, 2, -distanceOfMotion);
                }

                if (btn == m_rBtnYp)
                {
                    m_oKernel.AxisRMove(CKernel.ENUM_AXIS_TYPE.Y_AXIS, dVel, 2, distanceOfMotion);
                }
                if (btn == m_rBtnYn)
                {
                    m_oKernel.AxisRMove(CKernel.ENUM_AXIS_TYPE.Y_AXIS, dVel, 2, -distanceOfMotion);
                }

                if (btn == m_rBtnZp)
                {
                    m_oKernel.AxisRMove(CKernel.ENUM_AXIS_TYPE.Z_AXIS, dVel, 2, distanceOfMotion);
                }
                if (btn == m_rBtnZn)
                {
                    m_oKernel.AxisRMove(CKernel.ENUM_AXIS_TYPE.Z_AXIS, dVel, 2, -distanceOfMotion);
                }
            }
            else
            {
                if (btn == m_rBtnXp)
                {
                    m_oKernel.AxisJogMove(CKernel.ENUM_AXIS_TYPE.X_AXIS, dVel, dAcc);
                }
                if (btn == m_rBtnXn)
                {
                    m_oKernel.AxisJogMove(CKernel.ENUM_AXIS_TYPE.X_AXIS, -dVel, dAcc);
                }

                if (btn == m_rBtnYp)
                {
                    m_oKernel.AxisJogMove(CKernel.ENUM_AXIS_TYPE.Y_AXIS, dVel, dAcc);
                }
                if (btn == m_rBtnYn)
                {
                    m_oKernel.AxisJogMove(CKernel.ENUM_AXIS_TYPE.Y_AXIS, -dVel, dAcc);
                }

                if (btn == m_rBtnZp)
                {
                    m_oKernel.AxisJogMove(CKernel.ENUM_AXIS_TYPE.Z_AXIS, dVel, dAcc);
                }
                if (btn == m_rBtnZn)
                {
                    m_oKernel.AxisJogMove(CKernel.ENUM_AXIS_TYPE.Z_AXIS, -dVel, dAcc);
                }
            }
        }