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_t>, 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_t> mcSeq, IMachineKinematics coordinateConverter, double toolHeightForComputingStepNum, IMachiningMotionResolution ncResolution, TimeSpan duration)
Parameters
mcSeqSeqPair<dvec3d_t>The machine coordinate sequence.
coordinateConverterIMachineKinematicsThe coordinate converter to use; null when no tool-tip travel is available.
toolHeightForComputingStepNumdoubleThe equipped tool's spindle-mount-to-tip length.
ncResolutionIMachiningMotionResolutionThe machining motion resolution.
durationTimeSpanThe act's duration, for the time criterion.
Returns
- int
The calculated step number.
GetStepNumOnPolarInterpolationMode(SeqPair<vec3d_t>, IMachiningMotionResolution)
Gets the step number for a polar interpolation mode.
public static int GetStepNumOnPolarInterpolationMode(SeqPair<vec3d_t> programPolarXczSeq, IMachiningMotionResolution ncResolution)
Parameters
programPolarXczSeqSeqPair<vec3d_t>The program polar XCZ sequence.
ncResolutionIMachiningMotionResolutionThe machining motion resolution.
Returns
- int
The calculated step number.
GetToolTipTravel(dvec3d_t, dvec3d_t, IMachineKinematics, double)
Real tool-tip travel between two machine coordinates: the chord between
the tips of the equipped tool (compensationHeight
below the spindle mount along the tool normal) at both poses.
public static double GetToolTipTravel(dvec3d_t mcXyzabc0, dvec3d_t mcXyzabc1, IMachineKinematics coordinateConverter, double compensationHeight)
Parameters
mcXyzabc0dvec3d_tmcXyzabc1dvec3d_tcoordinateConverterIMachineKinematicscompensationHeightdouble
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_t, dvec3d_t, IMachineKinematics, double, double, ref int)
Updates the step number based on cutter location points.
public static void UpdateStepNumByCl(dvec3d_t mcXyzabc0, dvec3d_t mcXyzabc1, IMachineKinematics coordinateConverter, double compensationHeight, double linearResolution_mm, ref int stepNum)
Parameters
mcXyzabc0dvec3d_tThe starting machine coordinate.
mcXyzabc1dvec3d_tThe ending machine coordinate.
coordinateConverterIMachineKinematicsThe coordinate converter to use.
compensationHeightdoubleThe compensation height value.
linearResolution_mmdoubleThe linear resolution in millimeters.
stepNumintThe step number to update.