Class ActUtil
Provides utility methods for numerical control actions.
public static class ActUtil
- Inheritance
-
ActUtil
- Inherited Members
Fields
MaxStepNumPerAct
Hard cap on the number of steps one act may split into. The finest
machining resolution the runner accepts (1/4096 mm, the lower bound of
the machining-resolution clamp) over a one-metre traverse is ~4M steps; a real quotient
beyond that means a degenerate resolution or geometry, not a finer
request. Without the cap, (int) of an infinite or huge
quotient saturates to MaxValue on .NET 9+ and the
act plays as 2^31 zero-duration steps — the “one line, frozen cycle
time, step index climbing forever” hang.
public const int MaxStepNumPerAct = 4000000
Field Value
Methods
GetClSteps(IActClMove, int, IMachiningMotionResolution)
Splits a cutter location movement into a sequence of steps according to the NC resolution and desired step count.
public static IEnumerable<ActClStep> GetClSteps(this IActClMove actClMove, int stepNum, IMachiningMotionResolution ncResolution)
Parameters
actClMoveIActClMoveThe cutter location movement action.
stepNumintThe number of steps to split into.
ncResolutionIMachiningMotionResolutionThe machining motion resolution.
Returns
- IEnumerable<ActClStep>
An enumerable sequence of ActClStep.
GetStepNum(SeqPair<DVec3d>, IMachineKinematics, double, IMachiningMotionResolution, TimeSpan)
Gets the step number for a rotary-bearing (XYZABC) machine coordinate move. Two motions are bounded separately and the larger count wins:
- the posture change — each rotary axis delta over RotaryAxisResolution_rad;
- the travel — by the resolution's time criterion (GetStepNumByDuration(TimeSpan, double), one step per spindle cycle) when it applies, otherwise the real tool-tip travel of the equipped tool over LinearResolution_mm.
public static int GetStepNum(SeqPair<DVec3d> mcSeq, IMachineKinematics coordinateConverter, double toolHeightForComputingStepNum, IMachiningMotionResolution ncResolution, TimeSpan duration)
Parameters
mcSeqSeqPair<DVec3d>The machine coordinate sequence.
coordinateConverterIMachineKinematicsThe coordinate converter to use; null when no tool-tip travel is available.
toolHeightForComputingStepNumdoubleThe equipped tool's spindle-buckle-to-tip length.
ncResolutionIMachiningMotionResolutionThe machining motion resolution.
durationTimeSpanThe act's duration, for the time criterion.
Returns
- int
The calculated step number.
GetStepNumOnPolarInterpolationMode(SeqPair<Vec3d>, IMachiningMotionResolution)
Gets the step number for a polar interpolation mode.
public static int GetStepNumOnPolarInterpolationMode(SeqPair<Vec3d> programPolarXczSeq, IMachiningMotionResolution ncResolution)
Parameters
programPolarXczSeqSeqPair<Vec3d>The program polar XCZ sequence.
ncResolutionIMachiningMotionResolutionThe machining motion resolution.
Returns
- int
The calculated step number.
GetToolTipTravel(DVec3d, DVec3d, IMachineKinematics, double)
Real tool-tip travel between two machine coordinates: the chord between
the tips of the equipped tool (compensationHeight
below the spindle buckle along the tool normal) at both poses.
public static double GetToolTipTravel(DVec3d mcXyzabc0, DVec3d mcXyzabc1, IMachineKinematics coordinateConverter, double compensationHeight)
Parameters
mcXyzabc0DVec3dmcXyzabc1DVec3dcoordinateConverterIMachineKinematicscompensationHeightdouble
Returns
ToStepNum(double)
Converts a real-valued step quotient (total / unitPerStep)
into a bounded step count: NaN or non-positive → 0; otherwise the
ceiling, clamped to MaxStepNumPerAct. Every act's
step-number derivation goes through here so no division can turn
into a saturated integer.
public static int ToStepNum(double stepQuotient)
Parameters
stepQuotientdouble
Returns
UpdateStepNumByCl(DVec3d, DVec3d, IMachineKinematics, double, double, ref int)
Updates the step number based on cutter location points.
public static void UpdateStepNumByCl(DVec3d mcXyzabc0, DVec3d mcXyzabc1, IMachineKinematics coordinateConverter, double compensationHeight, double linearResolution_mm, ref int stepNum)
Parameters
mcXyzabc0DVec3dThe starting machine coordinate.
mcXyzabc1DVec3dThe ending machine coordinate.
coordinateConverterIMachineKinematicsThe coordinate converter to use.
compensationHeightdoubleThe compensation height value.
linearResolution_mmdoubleThe linear resolution in millimeters.
stepNumintThe step number to update.