Class HeidenhainCoordinateOffsetSyntax
- Namespace
- Hi.NcParsers.LogicSyntaxs.Heidenhain
- Assembly
- HiMech.dll
Heidenhain-specific: resolves coordinate offset from CYCL DEF 247 (Datum Preset) and CYCL DEF 7 (Datum Shift).
CYCL DEF 247 Q339=N: selects datum preset table entry N — written to the shared CoordinateOffset section (kept alive modally by IsoCoordinateOffsetSyntax via HeidenhainDatumTable synthetic-id resolution).
CYCL DEF 7 (#N table row or direct X/Y/Z) is additive on top
of the active preset (TNC semantics; HardNc oracle composes
-preset + shift): it is written to its own DatumShift
section with a separate ProgramToMcTransform entry
(DatumShiftTransformSource) so preset and shift compose
in the transform chain instead of replacing each other. The shift is
carried modally by this syntax itself: on blocks without a CYCL DEF,
a numbered row re-resolves from the table and a direct shift carries
its values forward. Cancelling is a zero shift
(CYCL DEF 7.1 X+0 Y+0 Z+0).
public class HeidenhainCoordinateOffsetSyntax : ISituNcSyntax, INcSyntax, IMakeXmlSource
- Inheritance
-
HeidenhainCoordinateOffsetSyntax
- Implements
- Inherited Members
- Extension Methods
Examples
Mat4d arrays are 16 plain doubles in column-major order; pure
translation by (tx,ty,tz) is
[1,0,0,0, 0,1,0,0, 0,0,1,0, tx,ty,tz,1]. The cycle keys are
consumed (block text stays authoritative for round-trip emission), so
datum declarations replay without unconsumed-parsing noise.
CYCL DEF 247 Q339=+1 with a
HeidenhainDatumTable populated so preset
row 1 = (50, 50, 0) — the syntax looks up the row and writes
a synthetic CoordinateId = "DATUM_PRESET_1" reflecting the
resolved preset index:
{ "Parsing": { "CYCL DEF": 247, "Q339": "+1" } }
#AfterBuild:
{
"CoordinateOffset": {
"CoordinateId": "DATUM_PRESET_1",
"Offset_X": 50, "Offset_Y": 50, "Offset_Z": 0
},
"ProgramToMcTransform": [
{
"Source": "CoordinateOffset",
"Kind": "Static",
"Mat4d": [1,0,0,0, 0,1,0,0, 0,0,1,0, 50,50,0,1]
}
]
}
CYCL DEF 7 #5 — datum shift table lookup via the #
index (here mapped to (100, 200, 0)); the shift lands in its
own DatumShift section and transform entry so it composes
with (instead of replacing) an active preset:
#BeforeBuild:
{ "Parsing": { "CYCL DEF": 7, "#": 5 } }
#AfterBuild:
{
"DatumShift": {
"ShiftId": "DATUM_SHIFT_5",
"Offset_X": 100, "Offset_Y": 200, "Offset_Z": 0
},
"ProgramToMcTransform": [
{
"Source": "DatumShift",
"Kind": "Static",
"Mat4d": [1,0,0,0, 0,1,0,0, 0,0,1,0, 100,200,0,1]
}
]
}
CYCL DEF 7.0/7.1 X+10 Y+20 Z+5 — direct X/Y/Z form: the
values are read from the nested Parsing["DATUM SHIFT"] record
written by the datum-shift cycle parser; no
HeidenhainDatumTable dep is required.
ShiftId is the literal "DATUM_SHIFT_DIRECT" sentinel:
#BeforeBuild:
{ "Parsing": { "CYCL DEF": 7, "DATUM SHIFT": { "X": 10, "Y": 20, "Z": 5 } } }
#AfterBuild:
{
"DatumShift": {
"ShiftId": "DATUM_SHIFT_DIRECT",
"Offset_X": 10, "Offset_Y": 20, "Offset_Z": 5
},
"ProgramToMcTransform": [
{
"Source": "DatumShift",
"Kind": "Static",
"Mat4d": [1,0,0,0, 0,1,0,0, 0,0,1,0, 10,20,5,1]
}
]
}
Constructors
HeidenhainCoordinateOffsetSyntax()
Initializes a new instance with default settings.
public HeidenhainCoordinateOffsetSyntax()
HeidenhainCoordinateOffsetSyntax(XElement)
Initializes a new instance by deserializing from the given XML element.
public HeidenhainCoordinateOffsetSyntax(XElement src)
Parameters
srcXElementSource XML element.
Fields
DatumShiftSection
JSON section name for the additive datum shift (CYCL DEF 7).
public const string DatumShiftSection = "DatumShift"
Field Value
DatumShiftTransformSource
Transform-stack source key for the datum-shift translation (separate from the preset's so both compose).
public const string DatumShiftTransformSource = "DatumShift"
Field Value
DirectShiftId
ShiftIdKey sentinel for the direct-XYZ form.
public const string DirectShiftId = "DATUM_SHIFT_DIRECT"
Field Value
ShiftIdKey
Section key holding the shift identity (row id or the DIRECT sentinel).
public const string ShiftIdKey = "ShiftId"
Field Value
Properties
Name
Syntax kind name (typically the concrete type name).
public string Name { get; }
Property Value
XName
XML element name used to register this syntax with XFactory.
public static string XName { get; }
Property Value
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
syntaxPieceNodeLazyLinkedListNode<SyntaxPiece>ncDependencyListList<INcDependency>ncDiagnosticProgressNcDiagnosticProgress
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
baseDirectorystringThe base directory for resolving relative paths
relFilestringThe relative file path for the XML source
exhibitionOnlyboolif 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
factoryXFactory