Class StrokeLimitUtil
- Namespace
- Hi.NcParsers.Dependencys
- Assembly
- HiMech.dll
Load-time audit helpers for IStrokeLimitConfig: which
machine-coordinate axes the chain has, and which of them the stroke limit
check cannot judge because no limit is configured. Both checks — the
per-block StrokeLimitCheckSemantic and the per-step
CheckStrokeLimit(DVec3d, IProgress<IMessage>) — compare only axes that
carry a limit, so a machine file without limits passes every position
silently while EnableStrokeLimitCheck reads as on. The session
begin reports that gap once through these helpers.
public static class StrokeLimitUtil
- Inheritance
-
StrokeLimitUtil
- Inherited Members
Fields
McAxisNames
Machine-coordinate axis names, linear first then rotary.
public static readonly string[] McAxisNames
Field Value
- string[]
Tolerance
Slack, in mm or degrees, past which a position counts as over a
stroke limit. A machine coordinate that arrives through a work
offset, a tilt and a kinematic solve carries rounding noise of the
order of 1e-12; a program that parks an axis exactly on its limit
(CHEM20180926: G28 Z0 on a machine whose Z travel ends at 0)
used to be reported as “0.0000 > 0.0000” on every such block and
step. A tenth of a micrometre / microdegree is far below any
control's resolution and above any arithmetic noise.
public const double Tolerance = 0.0001
Field Value
Methods
DescribeUnlimitedAxes(IEnumerable<string>, Func<string, double?>, Func<string, double?>)
Describes the axes among axisNames that the stroke
limit check cannot judge: an axis with neither end configured is
listed by name, an axis with one end only is listed with the missing
end ("Z (no negative limit)"). Empty when every axis has both
ends. A limit of NaN or ±infinity counts as not configured (the legacy
HardNcEnv boxes default to an infinite box).
public static List<string> DescribeUnlimitedAxes(IEnumerable<string> axisNames, Func<string, double?> positiveLimit, Func<string, double?> negativeLimit)
Parameters
axisNamesIEnumerable<string>The axes to audit, normally GetChainAxisNames(IXyzabcChain, bool).
positiveLimitFunc<string, double?>Positive-end limit per axis; null when not configured.
negativeLimitFunc<string, double?>Negative-end limit per axis; null when not configured.
Returns
GetChainAxisNames(IXyzabcChain, bool)
The machine-coordinate axes chain actually has: an
axis counts when a transformer is bound to its name
(GetTransformerX() …
GetTransformerC()). A three-axis chain yields
X, Y, Z only; a null chain yields nothing.
public static List<string> GetChainAxisNames(IXyzabcChain chain, bool linearOnly = false)
Parameters
chainIXyzabcChainThe machine chain, or null.
linearOnlyboolWhen true, only the translation axes (X, Y, Z) are returned. A travel audit wants this: a linear axis always has a finite travel, so a missing limit is unambiguously a gap, while a rotary table that turns continuously legitimately has none and cannot be given one.
Returns
IsWithinRotaryTravel(double, double?, double?)
Whether a rotary angle (degrees) lies within a travel given by its two ends, either of which may be absent. A span of a full turn or more admits every angle; otherwise the angle is wrapped into the turn starting at the negative end before the test.
public static bool IsWithinRotaryTravel(double angle_deg, double? negative_deg, double? positive_deg)
Parameters
angle_degdoubleThe angle to test.
negative_degdouble?The negative end, or null when unbounded.
positive_degdouble?The positive end, or null when unbounded.
Returns
RotaryAdmissibility(IEnumerable<INcDependency>)
The rotary-travel admissibility test for an inverse-kinematics solve (OrientationToMcAbc(Vec3d, Func<Vec3d, bool>, out Vec3d)): accepts a machine ABC (radians) whose configured A/B/C limits on the list's IStrokeLimitConfig (degrees) are all met, so a tilt solve prefers the branch the machine can reach. Null — admit everything — when the list carries no stroke config or no rotary limit at all. An axis whose two limits span a full turn or more is always admissible; a narrower span is tested on the angle wrapped into the turn that starts at the negative limit (the solver reports atan2 angles, the limits are wherever the builder put them); a NaN component (an axis the chain does not have) is not tested.
public static Func<Vec3d, bool> RotaryAdmissibility(IEnumerable<INcDependency> dependencyList)
Parameters
dependencyListIEnumerable<INcDependency>The runner's effective dependency list.