/// <summary> /// 单轴回原 /// </summary> /// <param name="nCardNum"></param> /// <param name="nAxis"></param> /// <param name="nType"></param> public void SingleAxisHome(short nCardNum, AXIS_TYPE nAxis, HOME_TYPE nType) { if (GetAxisMotionSts(nCardNum, AXIS_TYPE.ALL_AXIS)) { MessageBox.Show(@"请先等待轴停止!"); return; } _LIST_MOTION_WORK[nCardNum].StartSingleHome((short)nAxis, (short)nType, -1, 10, 1000000, 100); }
/// <summary> /// 点位运动 /// </summary> /// <param name="nCardNum"></param> /// <param name="nAxis">轴号</param> /// <param name="dPosition">位置</param> /// <param name="dVel">速度:默认10</param> /// <param name="dAcc">加速度:默认1</param> /// <returns></returns> public bool AxisAbsMotion(short nCardNum, AXIS_TYPE nAxis, double dPosition, double dVel = 10, double dAcc = 1) { if (GetAxisMotionSts(0, nAxis)) { MessageBox.Show(@"请等待轴停止!"); return(false); } return(_LIST_MOTION_WORK[nCardNum].AbsMove((short)nAxis, dPosition, dVel, dAcc)); }
/// <summary> /// 轴Jog运动 /// </summary> /// <param name="nType"></param> /// <param name="dVel"></param> /// <param name="dAcc"></param> /// <param name="nCardNum"></param> public void AxisJogMove(AXIS_TYPE nType, double dVel, double dAcc, short nCardNum = 0) { if (GetAxisMotionSts(nCardNum, AXIS_TYPE.ALL_AXIS)) { MessageBox.Show(@"请先等待轴停止!"); return; } _LIST_MOTION_WORK[nCardNum].JogMove((short)nType, dVel, dAcc); }
/// <summary> /// 阻塞式等待轴结束运动 /// </summary> /// <param name="nCardNum"></param> /// <param name="nAxis">轴号</param> public void WaitAxisOverMotion(short nCardNum, AXIS_TYPE nAxis) { var bAxisSts = GetAxisMotionSts(nCardNum, nAxis); //等待点位运动停止 while (bAxisSts) { bAxisSts = GetAxisMotionSts(nCardNum, nAxis); Thread.Sleep(1); } }
/// <summary> /// 得到轴运动状态 /// </summary> /// <param name="nCardNum"></param> /// <param name="nAxis">轴号</param> /// <returns>true:运动 false:静止</returns> public bool GetAxisMotionSts(short nCardNum, AXIS_TYPE nAxis) { //如果选择ALL_AXIS,返回整个板卡的运动状态 if (nAxis == AXIS_TYPE.ALL_AXIS) { var bAllAxisSts = false; for (short i = 1; i < _LIST_MOTION_WORK[nCardNum].m_nMaxAxisNum; i++) { var bAxisSts = _LIST_MOTION_WORK[nCardNum].IsMoving(i); bAllAxisSts = bAllAxisSts || bAxisSts; } return(bAllAxisSts); } return(_LIST_MOTION_WORK[nCardNum].IsMoving((short)nAxis)); }
/// <summary> /// 得到轴报警状态 /// </summary> /// <param name="nCardNum"></param> /// <param name="nAxis"></param> /// <returns></returns> public bool GetAxisAlarmSts(short nCardNum, AXIS_TYPE nAxis) { return(_LIST_MOTION_WORK[nCardNum].GetAxisAlarm((short)nAxis)); }
/// <summary> /// 得到轴Home状态 /// </summary> /// <param name="nCardNum"></param> /// <param name="nAxis">轴号</param> /// <returns></returns> public bool GetAxisHomeLimitSts(short nCardNum, AXIS_TYPE nAxis) { return(_LIST_MOTION_WORK[nCardNum].GetAxisHomeStatus((short)nAxis)); }
/// <summary> /// 轴平滑停止 /// </summary> /// <param name="nAxis"></param> /// <param name="nCardNum"></param> public void SmoothStopAxis(AXIS_TYPE nAxis, short nCardNum = 0) { _LIST_MOTION_WORK[nCardNum].SetSStop((short)nAxis); }
/// <summary> /// 割一刀轴位置信息 /// </summary> /// <param name="nCardNum"></param> /// <param name="nAxis"></param> /// <returns></returns> public double GetAxisCurPos(short nCardNum, AXIS_TYPE nAxis) { return(_LIST_MOTION_WORK[nCardNum].GetAxisCurPos((short)nAxis)); }