Class ProgramXyzUtil
- Namespace
- Hi.NcParsers.LogicSyntaxs
- Assembly
- HiMech.dll
Shared utilities for ProgramXyz and MachineCoordinate lookback and resolution. Used by ProgramXyzSyntax, ReferenceReturnSyntax, and semantic resolvers that need position lookback.
public static class ProgramXyzUtil
- Inheritance
-
ProgramXyzUtil
- Inherited Members
Methods
FindPreviousMc(LazyLinkedListNode<SyntaxPiece>)
Finds the most recent MachineCoordinate from previous SyntaxPiece nodes. Returns null if no previous position found.
public static Vec3d FindPreviousMc(LazyLinkedListNode<SyntaxPiece> node)
Parameters
Returns
FindPreviousMcXyzabc(LazyLinkedListNode<SyntaxPiece>)
Finds the most recent MachineCoordinate XYZABC from previous nodes as DVec3d. Point = XYZ (mm), Normal = ABC (radians, converted from degrees in JSON). Returns null if no previous position found.
public static DVec3d FindPreviousMcXyzabc(LazyLinkedListNode<SyntaxPiece> node)
Parameters
Returns
GetLastProgramXyz(LazyLinkedListNode<SyntaxPiece>)
Gets the last ProgramXyz using the composed transform found from previous nodes (FindPrevious pattern). Use when current node's transform is not yet available.
public static Vec3d GetLastProgramXyz(LazyLinkedListNode<SyntaxPiece> node)
Parameters
Returns
GetLastProgramXyz(LazyLinkedListNode<SyntaxPiece>, Mat4d)
Gets the last ProgramXyz by finding the last MachineCoordinate from backward nodes and inverse-transforming with the given Transformation. This handles Transformation changes between blocks correctly.
public static Vec3d GetLastProgramXyz(LazyLinkedListNode<SyntaxPiece> node, Mat4d currentTransformation)
Parameters
nodeLazyLinkedListNode<SyntaxPiece>currentTransformationMat4d
Returns
ReadMcXyzabc(JsonObject)
Reads XYZABC from a MachineCoordinate section as DVec3d. Point = XYZ (mm), Normal = ABC (radians, converted from degrees in JSON). Missing axes are NaN. Returns null if the section doesn't exist or has no XYZ.
public static DVec3d ReadMcXyzabc(JsonObject ncBlock)
Parameters
ncBlockJsonObject
Returns
ResolveProgramXyz(JsonNode, LazyLinkedListNode<SyntaxPiece>, Mat4d)
Resolves X/Y/Z from a JSON section into absolute program coordinates. Fills missing axes from last program position via lookback.
public static Vec3d ResolveProgramXyz(JsonNode xyzSource, LazyLinkedListNode<SyntaxPiece> syntaxPieceNode, Mat4d transformation)
Parameters
xyzSourceJsonNodeJSON node containing X/Y/Z keys (e.g.,
Parsingroot,Parsing.G28,Parsing.L).syntaxPieceNodeLazyLinkedListNode<SyntaxPiece>Current node for lookback.
transformationMat4dCurrent composed ProgramToMc transform, needed by GetLastProgramXyz(LazyLinkedListNode<SyntaxPiece>, Mat4d) for inverse lookback.
Returns
- Vec3d
Absolute program coordinates, or null if no X/Y/Z found in
xyzSource.