Class MachiningEquipmentUtil
- Namespace
- Hi.Machining.MachiningEquipmentUtils
- Assembly
- HiMech.dll
Utility methods for working with machining equipment.
public static class MachiningEquipmentUtil
- Inheritance
-
MachiningEquipmentUtil
- Inherited Members
Methods
GetProgramToPnMat4d(IMachiningEquipment)
Gets the rigid transform that maps a point in program (workpiece) coordinates — the ProgramZeroAnchor frame — into the kinematic Pn frame (the chain's table-mount anchor frame that XyzabcSolver solves in).
Both anchors live on the same rigid table-side subtree (the
table-mount→fixture→workpiece leg crosses no machine axis), so the
transform is pose-independent and is queried on the live assembly —
no MC-zero reflection needed (this runs per parsed motion block; a
whole-assembly TopoReflection clone here would dominate
large-file parse time). Falls back to identity (program frame ≡
table-mount frame) when the workpiece has no
ProgramZeroAnchor; returns null when
the chain has no table mount.
public static mat4d_t? GetProgramToPnMat4d(this IMachiningEquipment equipment)
Parameters
equipmentIMachiningEquipmentThe machining equipment.
Returns
- mat4d_t?
The program→Pn transform, or
null.
TryAlignWorkpieceProgramZeroToIso(IMachiningEquipment, vec3d_t, out vec3d_t, IProgress<IMessage>)
Places Fixture under the kinematic
chain so that ProgramZeroAnchor coincides with
the world position the spindle reaches when the machine coordinate
equals isoOffset (a G54/G55/… entry).
Other anchors (FixtureMount,
ProgramZeroAnchor,
WorkpieceMount) must already be at their intended
geometric positions (typically via the mount “general rule”:
bottom/top centers of geom). Only the transformer of the one branch
leading from GeomAnchor straight to
TableMount is mutated — replaced by a
StaticTranslation, or by a StaticFreeform
keeping the rotation the branch already carried. The fixture's topology is free, so
when no such branch exists, or it carries a dynamic transformer, the
alignment has nowhere to write: it reports the reason on
progress and returns false.
Answers the assigned translation in fixtureGeomToTable
and returns true; returns false — with nothing changed — when workpiece /
fixture / Xyzabc machine tool is missing or one of the four role anchors
it reads is unbound (no message), and, reported on
progress: when the fixture has no static
geometry-to-table branch, when a leg it measures is not connected (a
machine without its worktable end, a mount left unbound), or when
writing that branch would not move program zero onto the offset (the
way from the table to program zero passes elsewhere).
The alignment is computed in the machine-coordinate (MC) zero state: the
assembly is reflected and every IDynamicRegular axis is set
to Step = 0 before querying displacements. The live equipment may
have its axes moved, which would otherwise distort the
ToolMount -> FixtureTableMount leg (it crosses the X/Y/Z/A/B/C
axes) — isoOffset is itself an MC-zero quantity. A
rotation on that leg (a table-to-component transform that turns the
fixture) is carried through, not assumed away.
It is computed on the nominal chain as well: isoOffset
is controller data (a work offset), the fixture placement is derived
from it, and the controller solves on the nominal chain — so on the
reflection every branch marked as an error term
(IsErrorTerm) is taken as NoTransform.
The placement written therefore does not depend on which face of the
equipment (authored or runtime) is handed in, nor on the project switch
(EnableErrorTerms),
and TryGetMachinePositionAtProgramZero(IMachiningEquipment, out vec3d_t) reads the same
offset back from either face — as long as the fixture's
geometry-to-table branch itself is not marked as an error term: the
nominal chain would take the placement written on it out again (error
terms belong inside the machine).
public static bool TryAlignWorkpieceProgramZeroToIso(this IMachiningEquipment equipment, vec3d_t isoOffset, out vec3d_t fixtureGeomToTable, IProgress<IMessage> progress = null)
Parameters
equipmentIMachiningEquipmentThe equipment; its authored face, as alignment is setup data.
isoOffsetvec3d_tThe work-coordinate offset: tool mount to program zero at machine zero.
fixtureGeomToTablevec3d_tThe translation written on the fixture's geometry-to-table branch (its rotation kept), when the method returns true.
progressIProgress<IMessage>Receives the reason when the fixture's topology gives the alignment nowhere to write; may be null.
Returns
TryGetIsoCoordinatePosition(IMachiningEquipment, vec3d_t, out vec3d_t)
The place, at machine zero, of the program zero a work offset stands for: the
point fixed to the worktable that the tool end reaches when the linear axes stand
at g54seriesOffset (rotaries at zero). Measured on a reflection
of the assembly (the live axes are not moved): the tool end's position in the
worktable-end frame with X/Y/Z at the offset, carried into the chain's root frame
by the worktable end's pose at machine zero. Until 2026-10-03 the offset was added
unturned to the tool end's place, which is the same on an upright machine whose
axes run along the root frame but missed on a laid-down one (a legacy
IsVertical false machine turns its whole topology under the root).
The offset is controller data, and the controller solves on the nominal chain: on the reflection every branch marked as an error term (IsErrorTerm) is taken as NoTransform. The position therefore does not depend on which face of the equipment (authored or runtime) is handed in, nor on the project switch (EnableErrorTerms).
public static bool TryGetIsoCoordinatePosition(this IMachiningEquipment equipment, vec3d_t g54seriesOffset, out vec3d_t position)
Parameters
equipmentIMachiningEquipmentThe machining equipment.
g54seriesOffsetvec3d_tThe work-coordinate offset: the machine coordinates of program zero.
positionvec3d_tThe position in the chain's root frame, when the method returns true.
Returns
- bool
False when the machining chain is not an Xyzabc machine tool, has no tool end or worktable end, or either is unconnected; also when a linear axis role of the machine (X, Y or Z) is on a branch marked as an error term, as the offset then has no axis to stand on.
TryGetMachinePositionAtProgramZero(IMachiningEquipment, out vec3d_t)
Gets the machine coordinate when the attacher is at program zero. The machine coordinate are all assumed to be zero.
The result is controller data — the value a work offset holds — and the controller solves on the nominal chain. It is measured on a reflection of the assembly, with every axis at zero and every branch marked as an error term (IsErrorTerm) taken as NoTransform. The result therefore does not depend on which face of the equipment (authored or runtime) is handed in, nor on the project switch (EnableErrorTerms).
public static bool TryGetMachinePositionAtProgramZero(this IMachiningEquipment equipment, out vec3d_t mcXyz)
Parameters
equipmentIMachiningEquipmentThe machining equipment.
mcXyzvec3d_tThe machine coordinate vector, when the method returns true.
Returns
- bool
False when the tool end, or the workpiece and the table end, are missing or unconnected.
TryGetMachinePositionAtTableMountZero(IMachiningEquipment, out vec3d_t)
Gets the machine coordinate when the attacher is at table mount zero.
The result is controller data — a datum at the worktable end — and the controller solves on the nominal chain. It is measured on a reflection of the assembly, with every axis at zero and every branch marked as an error term (IsErrorTerm) taken as NoTransform. The result therefore does not depend on which face of the equipment (authored or runtime) is handed in, nor on the project switch (EnableErrorTerms).
public static bool TryGetMachinePositionAtTableMountZero(this IMachiningEquipment equipment, out vec3d_t mcXyz)
Parameters
equipmentIMachiningEquipmentThe machining equipment.
mcXyzvec3d_tThe machine coordinate vector, when the method returns true.
Returns
- bool
False when the machine lacks a tool end or a table end, or the two are unconnected.