示例#1
0
            private static double getDistance()
            {
                diff.Max = 0;
                diff.XY  = ((xyPoint)codeLast.actualPos).DistanceTo((xyPoint)codeNext.actualPos);
                if (isTangentialZ)
                {
                    diff.Z = 0;
                }
                else
                {
                    diff.Z = Math.Abs(codeNext.actualPos.Z - codeLast.actualPos.Z);
                }
                diff.A = Math.Abs(codeNext.alpha - codeLast.alpha);

                if (diff.Max == 0)
                {
                    diff.Max = diff.A;
                }

                if (codeNext.motionMode < 2)
                {
                    diff.Max = Math.Max(diff.XY, diff.Z);
                    return(diff.Max);
                }
                arcMove  = gcodeMath.getArcMoveProperties((xyPoint)codeLast.actualPos, (xyPoint)codeNext.actualPos, codeNext.i, codeNext.j, (codeNext.motionMode == 2));
                angleTmp = arcMove.angleStart;
                diff.Arc = Math.Abs(arcMove.angleDiff * arcMove.radius);
                diff.Max = diff.Arc;
                return(diff.Max);
            }
示例#2
0
      public static ArcProperties getArcMoveProperties(xyPoint pOld, xyPoint pNew, double?I, double?J, bool isG2)
      {
          ArcProperties tmp = getArcMoveAngle(pOld, pNew, I, J);

          if (!isG2)
          {
              tmp.angleDiff = Math.Abs(tmp.angleEnd - tmp.angleStart + 2 * Math.PI);
          }
          if (tmp.angleDiff > (2 * Math.PI))
          {
              tmp.angleDiff -= (2 * Math.PI);
          }
          if (tmp.angleDiff < (-2 * Math.PI))
          {
              tmp.angleDiff += (2 * Math.PI);
          }

          if ((pOld.X == pNew.X) && (pOld.Y == pNew.Y))
          {
              if (isG2)
              {
                  tmp.angleDiff = -2 * Math.PI;
              }
              else
              {
                  tmp.angleDiff = 2 * Math.PI;
              }
          }
          return(tmp);
      }