Table of Contents

Class ActUtil

Namespace
Hi.Numerical.Acts
Assembly
HiMech.dll

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

int

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

actClMove IActClMove

The cutter location movement action.

stepNum int

The number of steps to split into.

ncResolution IMachiningMotionResolution

The 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:

With a posture change the tip travel is never divided by a feed-derived linear resolution: that resolution describes the controller's commanded CL point, and under RTCP the real tip can sweep hundreds of millimetres while the CL point stands still. Without a posture change the tip translates with the CL point, so the tip travel over the linear resolution is the CL point's own count — the act keeps the distance form, exactly the number the XYZ-only splitters produce (Soft/Hard parity on a 3-axis move that one engine wraps as an XYZABC act; a time count would differ by one on TimeSpan tick rounding).
public static int GetStepNum(SeqPair<DVec3d> mcSeq, IMachineKinematics coordinateConverter, double toolHeightForComputingStepNum, IMachiningMotionResolution ncResolution, TimeSpan duration)

Parameters

mcSeq SeqPair<DVec3d>

The machine coordinate sequence.

coordinateConverter IMachineKinematics

The coordinate converter to use; null when no tool-tip travel is available.

toolHeightForComputingStepNum double

The equipped tool's spindle-buckle-to-tip length.

ncResolution IMachiningMotionResolution

The machining motion resolution.

duration TimeSpan

The 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

programPolarXczSeq SeqPair<Vec3d>

The program polar XCZ sequence.

ncResolution IMachiningMotionResolution

The 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

mcXyzabc0 DVec3d
mcXyzabc1 DVec3d
coordinateConverter IMachineKinematics
compensationHeight double

Returns

double

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

stepQuotient double

Returns

int

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

mcXyzabc0 DVec3d

The starting machine coordinate.

mcXyzabc1 DVec3d

The ending machine coordinate.

coordinateConverter IMachineKinematics

The coordinate converter to use.

compensationHeight double

The compensation height value.

linearResolution_mm double

The linear resolution in millimeters.

stepNum int

The step number to update.