示例#1
0
 public bool Operate(int axis, int length, int speed, bool isContinue)
 {
     if (CanOperate(axis) || isContinue)
     {
         decimal resolution = AxisSet.GetResolution(axis);
         if (Contra.StepLength != 0 && !IsMove(axis))
         {
             if (!CheckSoftLimit(axis, length, Contra.StepLength))
             {
                 return(false);
             }
             CtrlCard.Sym_RelativeMove(axis, (int)((length > 0 ? Contra.StepLength : (0 - Contra.StepLength)) * resolution), speed, (int)AxisSet.GetSpeed(axis), (double)Contra.AddSpeedTime);
             form.isM21    = false;
             form.isEndM21 = false;
             moveState     = 0;
         }
         else if (!IsMove(axis))
         {
             if (!CheckSoftLimit(axis, length, length))
             {
                 return(false);
             }
             CtrlCard.Sym_RelativeMove(axis, length, Contra.StartSpeed, speed, Contra.AddSpeedTime);
             form.isM21    = false;
             form.isEndM21 = false;
             moveState     = 0;
         }
         isOperate = true;
         return(true);
     }
     return(false);
 }
示例#2
0
        private int GetMovePosition(string axisType, Nullable <decimal> infoValue, decimal lastPosition, decimal logPosition, bool flag, bool flag2, out decimal jianxi)
        {
            decimal value = logPosition;

            jianxi = 0;
            if (infoValue.HasValue)
            {
                value += infoValue.Value;
                if (isG90)
                {
                    value -= lastPosition;
                }
            }
            decimal resolution = AxisSet.GetResolution(axisType);

            value = Contra.GetRealValue(axisType, value, AxisSet, flag, flag2, out jianxi);
            return(Convert.ToInt32(value * 1000 / resolution));
        }