Table of Contents

Class SiemensToolOffsetSyntax

Namespace
Hi.NcParsers.LogicSyntaxs.Siemens
Assembly
HiMech.dll

Siemens cutting-edge tool offset activation: consumes a standalone D word (D1 activates edge 1 of the active tool, D0 cancels compensation), resolves the effective length via GetToolHeightOffset_mm(int, int) ($TC_DP3, geometry − wear) for the (active tool, D) pair, and writes the same downstream state as the ISO sibling ToolHeightOffsetSyntax: the IToolHeightCompensationDef section (with Term = “D”) plus the ToolHeightCompensation entry in the ProgramToMcTransform chain — sharing the transform Source keeps the two brands' compensation mutually exclusive via AddOrReplaceTransform's in-place replacement.

The active tool number comes from the block's (or previous block's) ToolChange section; a string tool name resolves through FindToolNumberByName(string). Modal ownership follows the same yield protocol as the ISO sibling: blocks without a D word re-resolve only when the previous section's Term is ours ("D"); an ISO term (G43/G44/G49) leaves the section to ToolHeightOffsetSyntax — real Siemens files mix both dialects (G43H1 headers next to D1 blocks). Must therefore be placed after ToolHeightOffsetSyntax (and after ToolChangeSyntax) in the Logic bundle, and before the brand pivot gate (SiemensPivotTransformationSyntax in the Siemens list) so the pivot entry stays at the chain tail.

Consuming Parsing.D here (Logic) intentionally precedes RadiusCompensationSyntax (PostLogic): on Siemens, D selects the cutting edge — it is not the Fanuc G41 D5 radius argument, and radius state derives from the same (T, D) edge ($TC_DP6; wiring the radius value is a follow-up).

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

Examples

D2 with the active tool from the block's ToolChange section and a table mapping (T7, D2) → 50 mm (SUT dep configured in the test). Tool ≠ edge on purpose — the distinct Siemens feature is a two-key (tool, edge) lookup, so a transposed (edge, tool) or default-index resolve cannot pass. No ToolOrientation and no tilt entry, so the translation lies along UnitZ: #BeforeBuild:

{
  "Parsing": { "D": 2 },
  "ToolChange": { "ToolId": 7, "IsChange": false }
}

#AfterBuild:

{
  "ToolChange": { "ToolId": 7, "IsChange": false },
  "ToolHeightCompensation": {
    "Offset_mm": 50, "Term": "D", "OffsetId": 2
  },
  "ProgramToMcTransform": [
    {
      "Source": "ToolHeightCompensation",
      "Kind": "Static",
      "Mat4d": [1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,50,1]
    }
  ]
}

D0 cancel — sentinel section with Offset_mm = 0 and an identity matrix resets any previously composed translation: #BeforeBuild:

{ "Parsing": { "D": 0 } }

#AfterBuild:

{
  "ToolHeightCompensation": {
    "Offset_mm": 0, "Term": "D", "OffsetId": 0
  },
  "ProgramToMcTransform": [
    {
      "Source": "ToolHeightCompensation",
      "Kind": "Static",
      "Mat4d": [1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1]
    }
  ]
}

No D on the block but #Previous: carries an active D edge — modal re-resolve against the current tool keeps the section and chain entry per-block self-contained: #Previous:

{
  "ToolChange": { "ToolId": 7, "IsChange": false },
  "ToolHeightCompensation": {
    "Offset_mm": 50, "Term": "D", "OffsetId": 2
  }
}

#BeforeBuild:

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

#AfterBuild:

{
  "ToolChange": { "ToolId": 7, "IsChange": false },
  "ToolHeightCompensation": {
    "Offset_mm": 50, "Term": "D", "OffsetId": 2
  },
  "ProgramToMcTransform": [
    {
      "Source": "ToolHeightCompensation",
      "Kind": "Static",
      "Mat4d": [1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,50,1]
    }
  ]
}

Previous modal belongs to ISO G43 — this syntax yields (no write at all) so ToolHeightOffsetSyntax carries its own state: #Previous:

{
  "ToolHeightCompensation": {
    "Offset_mm": 99.98, "Term": "G43", "OffsetId": 1
  }
}

#BeforeBuild:

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

#AfterBuild:

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

Constructors

SiemensToolOffsetSyntax()

Initializes a new instance with default settings.

public SiemensToolOffsetSyntax()

SiemensToolOffsetSyntax(XElement)

Initializes a new instance by deserializing from the given XML element.

public SiemensToolOffsetSyntax(XElement src)

Parameters

src XElement

Source XML element.

Fields

DTerm

Term value marking the section as owned by the Siemens D-edge activation.

public const string DTerm = "D"

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