Table of Contents

Class ProgramXyzSyntax

Namespace
Hi.NcParsers.LogicSyntaxs
Assembly
HiMech.dll

Resolves ProgramXyz (leaf coordinate) from syntax XYZ tags. Writes ProgramXyz sub-object to SyntaxPiece.JsonObject. Must be placed after BundleSyntax since it uses cross-node lookback for last position.

McXyzSyntax (placed after this in the chain) reads ProgramXyz and writes MachineCoordinateState.

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

Examples

SUT uses Default so the default WorkingPathList points at the Parsing root. All cases stay on the identity-transform path so GetLastProgramXyz simply returns the previous block's MC.

Full X/Y/Z in Parsing — values are read directly (no lookback), Parsing.X/Y/Z are consumed, ProgramXyz section is written; CleanupParsing removes the now-empty Parsing:

#BeforeBuild:
{ "Parsing": { "X": 10, "Y": 20, "Z": 30 } }
#AfterBuild:
{ "ProgramXyz": { "X": 10, "Y": 20, "Z": 30 } }
Only Z in Parsing with a #Previous: block carrying MachineCoordinateState=(50,60,70) — under the identity transform GetLastProgramXyz equals previous MC, so X/Y are inherited from prev and Z is taken from the parsed literal: #Previous:
{ "MachineCoordinateState": { "X": 50, "Y": 60, "Z": 70 } }
#BeforeBuild:
{ "Parsing": { "Z": 0 } }
#AfterBuild:
{ "ProgramXyz": { "X": 50, "Y": 60, "Z": 0 } }
Parsing present but with no X/Y/Z (e.g. an unrelated M03 flag) — ResolveProgramXyz returns null and the syntax early-returns; the block is unchanged: #BeforeBuild:
{ "Parsing": { "Flags": ["M03"] } }
#AfterBuild:
{ "Parsing": { "Flags": ["M03"] } }

Remarks

The term “Program” is absolute positioning coordinate that can be end-user editing. The coordinate is usually the final node from the chain of coordinate transformation.

Constructors

ProgramXyzSyntax(List<List<string>>)

Initializes a new instance with the given working path list.

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

Parameters

workingPathList List<List<string>>

JSON paths to scan for axis values; see WorkingPathList.

ProgramXyzSyntax(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 ProgramXyzSyntax(XElement src)

Parameters

src XElement

Source XML element.

Properties

Default

Default instance with the working path resolving to the Parsing root.

public static ProgramXyzSyntax Default { get; }

Property Value

ProgramXyzSyntax

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). Each path is a list of segments navigating nested JSON objects. First match is used. Empty list means root level.

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

Property Value

List<List<string>>

Examples

[["L"]]       → fullJsonSrc["L"]
[[]]          → fullJsonSrc (root)
[["L"], []]   → try fullJsonSrc["L"], fallback to root

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