Table of Contents

Class IncrementalResolveSyntax

Namespace
Hi.NcParsers.LogicSyntaxs
Assembly
HiMech.dll

Resolves G91 incremental axis values to absolute in-place within Parsing and its sub-sections. Reads Term written by PositioningSyntax.

WorkingPathList specifies which JSON paths contain axis values that need incremental-to-absolute conversion. Default: [["Parsing"], ["Parsing", "G28"]]. All matching paths are converted.

Canned cycle paths (Parsing.G81, G82, G83, …) are intentionally excluded — their Z/R incremental semantics differ from normal axes (R is relative to init level, Z is relative to R-point). Resolution is handled by ResolveCycleCoordinates(JsonObject, Vec3d, double?, double?, double, double) inside each cycle syntax class, which runs before this syntax.

Uses AxisNames to determine which tags are motion axes. Traces backward nodes for last known ProgramXyz to resolve incremental values. After this syntax, all axis values in the working paths are absolute — ProgramXyzSyntax can consume them without incremental logic.

public class IncrementalResolveSyntax : ISituNcSyntax, INcSyntax, IMakeXmlSource
Inheritance
IncrementalResolveSyntax
Implements
Inherited Members
Extension Methods

Examples

G90 (absolute) on the block — the syntax early-returns without touching Parsing.X/Y/Z, even though the values look like incremental deltas: #BeforeBuild:

{
  "Positioning": { "Term": "G90", "Mode": "Absolute" },
  "Parsing": { "X": 10, "Y": 20, "Z": 30 }
}

#AfterBuild:

{
  "Positioning": { "Term": "G90", "Mode": "Absolute" },
  "Parsing": { "X": 10, "Y": 20, "Z": 30 }
}

G91 (incremental) with a #Previous: block carrying MachineCoordinateState=(100,200,300). Under the identity ProgramToMcTransform chain, GetLastProgramXyz recovers program XYZ equal to MC, so each axis in Parsing is rewritten to lastAbs + incremental: #Previous:

{ "MachineCoordinateState": { "X": 100, "Y": 200, "Z": 300 } }

#BeforeBuild:

{
  "Positioning": { "Term": "G91", "Mode": "Incremental" },
  "Parsing": { "X": 10, "Y": 20, "Z": 30 }
}

#AfterBuild:

{
  "Positioning": { "Term": "G91", "Mode": "Incremental" },
  "Parsing": { "X": 110, "Y": 220, "Z": 330 }
}

G91 + Parsing.G28 sub-section — exercises the second entry of the default WorkingPathList; the root Parsing has no X/Y/Z so the first path no-ops, but the [“Parsing”,“G28”] path picks up the G28 intermediate axes and resolves them against the same lastProgramXyz: #Previous:

{ "MachineCoordinateState": { "X": 100, "Y": 200, "Z": 300 } }

#BeforeBuild:

{
  "Positioning": { "Term": "G91", "Mode": "Incremental" },
  "Parsing": { "G28": { "X": 5, "Y": 10, "Z": 15 } }
}

#AfterBuild:

{
  "Positioning": { "Term": "G91", "Mode": "Incremental" },
  "Parsing": { "G28": { "X": 105, "Y": 210, "Z": 315 } }
}

Constructors

IncrementalResolveSyntax(List<List<string>>)

Initializes a new instance with the given working path list.

public IncrementalResolveSyntax(List<List<string>> workingPathList)

Parameters

workingPathList List<List<string>>

JSON paths to scan for incremental axis values; see WorkingPathList.

IncrementalResolveSyntax(XElement)

Initializes a new instance by deserializing the working path list from the given XML element. Falls back to Default.WorkingPathList when the element has no Path children.

public IncrementalResolveSyntax(XElement src)

Parameters

src XElement

Source XML element.

Properties

Default

Default instance with working paths covering the Parsing root and the Parsing.G28 intermediate XYZ subsection.

public static IncrementalResolveSyntax Default { get; }

Property Value

IncrementalResolveSyntax

Name

Syntax kind name (typically the concrete type name).

public string Name { get; }

Property Value

string

WorkingPathList

JSON paths where this syntax searches for axis values (X/Y/Z) to convert from incremental to absolute when G91 is active. Each path is a list of segments navigating nested JSON objects. All matching paths are converted.

public List<List<string>> WorkingPathList { get; }

Property Value

List<List<string>>

Examples

[["Parsing"]]              → Parsing root (normal XYZ)
[["Parsing", "G28"]]       → Parsing.G28 (G28 intermediate XYZ)

XName

XML element name used to register this syntax with XFactory.

public static string XName { get; }

Property Value

string

Methods

Build(LazyLinkedListNode<SyntaxPiece>, List<INcDependency>, NcDiagnosticProgress)

Build syntax arrangement into the syntaxPieceNode in-place.

public void Build(LazyLinkedListNode<SyntaxPiece> syntaxPieceNode, List<INcDependency> ncDependencyList, NcDiagnosticProgress ncDiagnosticProgress)

Parameters

syntaxPieceNode LazyLinkedListNode<SyntaxPiece>
ncDependencyList List<INcDependency>
ncDiagnosticProgress NcDiagnosticProgress

MakeXmlSource(string, string, bool)

Creates an XML representation of the object. This method may also generate additional resources such as related files.

public XElement MakeXmlSource(string baseDirectory, string relFile, bool exhibitionOnly)

Parameters

baseDirectory string

The base directory for resolving relative paths

relFile string

The relative file path for the XML source

exhibitionOnly bool

if true, the extended file creation is suppressed.

Returns

XElement

An XML element representing the object's state

Remarks

For the demand of easy moving source folder (especially project folder) without configuration file path corruption, the relative file path is applied. The baseDirectory is typically the folder at the nearest configuration file folder. Since the folder can be moving with the configuration file.

Reg(XFactory)

Registers this type's deserializer with the given XFactory (or Default when factory is null). Idempotent.

public static void Reg(XFactory factory = null)

Parameters

factory XFactory