Table of Contents

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

node LazyLinkedListNode<SyntaxPiece>

Returns

Vec3d

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

node LazyLinkedListNode<SyntaxPiece>

Returns

DVec3d

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

node LazyLinkedListNode<SyntaxPiece>

Returns

Vec3d

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

node LazyLinkedListNode<SyntaxPiece>
currentTransformation Mat4d

Returns

Vec3d

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

ncBlock JsonObject

Returns

DVec3d

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

xyzSource JsonNode

JSON node containing X/Y/Z keys (e.g., Parsing root, Parsing.G28, Parsing.L).

syntaxPieceNode LazyLinkedListNode<SyntaxPiece>

Current node for lookback.

transformation Mat4d

Current 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.