Table of Contents

Class ToolChangeSyntax

Namespace
Hi.NcParsers.LogicSyntaxs
Assembly
HiMech.dll

Consumes T (tool number) and M06 (tool change) from Parsing. T is modal — persists across blocks. M06 triggers the change. Writes resolved state to a ToolChange section: { “ToolId”: 1, “IsChange”: true, “Term”: “M06” }. TermKey records the trigger command and is only written when IsChangeKey is true (i.e. the block actually carried the tool-change M code); modal-only blocks omit it.

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

Examples

T5 + M06 — full tool change on one block; both T and M06 flag consumed, Term written: #BeforeBuild:

{ "Parsing": { "Flags": ["M06"], "T": 5 } }

#AfterBuild:

{ "ToolChange": { "ToolId": 5, "IsChange": true, "Term": "M06" } }

T5 alone alongside an unrelated flag — modal arming only, no actual change; IsChange=false and Term omitted. M03 is left in place because CleanupParsing only runs on the M06 branch: #BeforeBuild:

{ "Parsing": { "Flags": ["M03"], "T": 7 } }

#AfterBuild:

{
  "Parsing": { "Flags": ["M03"] },
  "ToolChange": { "ToolId": 7, "IsChange": false }
}

M06 alone — T comes from #Previous: modal lookback; IsChange=true, Term=“M06”: #Previous:

{ "ToolChange": { "ToolId": 5, "IsChange": false } }

#BeforeBuild:

{ "Parsing": { "Flags": ["M06"] } }

#AfterBuild:

{ "ToolChange": { "ToolId": 5, "IsChange": true, "Term": "M06" } }

Fields

IsChangeKey

Section key indicating whether the current block actually triggers a tool change.

public const string IsChangeKey = "IsChange"

Field Value

string

SectionName

JSON section name where the resolved tool-change state is written.

public const string SectionName = "ToolChange"

Field Value

string

TermKey

Section key recording the trigger command (e.g., M06) when IsChangeKey is true.

public const string TermKey = "Term"

Field Value

string

ToolIdKey

Section key holding the active tool number (modal).

public const string ToolIdKey = "ToolId"

Field Value

string

Properties

Name

Syntax kind name (typically the concrete type name).

public string Name { get; }

Property Value

string

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