Class HeidenhainMirrorTransformSyntax
- Namespace
- Hi.NcParsers.LogicSyntaxs.Heidenhain
- Assembly
- HiMech.dll
Simulates the Heidenhain DIN/ISO G28 MIRROR IMAGE function
(the CYCL DEF 8 twin): consumes the statement list
HeidenhainMirrorImageSyntax recorded under
Parsing.MirrorImage, keeps the modal mirror set in the root
SectionKey section (each statement REPLACES the set —
course 62192's four-quadrant idiom relies on G28 Y after
G28 X Y leaving only Y mirrored; bare G28 resets), and
writes the sign-flip matrix into
ProgramToMcTransform as the
TransformSource entry.
Must run before every other transform writer (HeidenhainPlaneTiltSyntax downward) so the mirror entry is the chain's first — the mirror flips program coordinates about the current datum inside the active working plane, i.e. innermost: tilt, tool-height and coordinate-offset entries compose after it and are never themselves mirrored. Because every motion semantic resolves contours in program coordinates and maps each interpolated point through the composed chain (CreateProgramPosToMcFunc(LazyLinkedListNode<SyntaxPiece>, IMachineAxisConfig)), the arc-handedness flip (G02↔G03) and the radius-compensation side flip (G41↔G42) a real control performs under a single-axis mirror emerge from the pointwise mapping — no re-tagging of IsCcw or the compensation side happens, and none is needed.
Two statement shapes stay recognized-but-not-simulated:
a rotary axis letter (RotaryUnsupportedId — a rotary
mirror is not representable in the XYZ transform chain; the letter is
dropped from the set, the statement still replaces) and the
Fanuc-shaped valued form (ValuedUnsupportedId — the
manual's mirror idiom is bare letters, so G91 G28 X0 Y0 Z0 in
a mislabeled .I file must not arm a full-XYZ mirror; the
statement is consumed with zero effect).
public class HeidenhainMirrorTransformSyntax : ISituNcSyntax, INcSyntax, IMakeXmlSource
- Inheritance
-
HeidenhainMirrorTransformSyntax
- Implements
- Inherited Members
- Extension Methods
Examples
Activation — a single-axis statement arms the mirror: the modal section appears and the chain gets the sign-flip entry: #BeforeBuild:
{ "Parsing": { "MirrorImage": [ { "Axes": ["X"] } ] } }
#AfterBuild:
{
"MirrorImage": { "Axes": ["X"] },
"ProgramToMcTransform": [
{
"Source": "MirrorImage",
"Kind": "Static",
"Mat4d": [-1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1]
}
]
}
Replace semantics — a new statement replaces the previous set (never a union): Y-only survives after an X-mirror block: #Previous:
{ "MirrorImage": { "Axes": ["X"] } }
#BeforeBuild:
{ "Parsing": { "MirrorImage": [ { "Axes": ["Y"] } ] } }
#AfterBuild:
{
"MirrorImage": { "Axes": ["Y"] },
"ProgramToMcTransform": [
{
"Source": "MirrorImage",
"Kind": "Static",
"Mat4d": [1,0,0,0, 0,-1,0,0, 0,0,1,0, 0,0,0,1]
}
]
}
Modal carry — a statement-free block re-writes the active set and its chain entry (single-step lookback, the DatumShift pattern): #Previous:
{ "MirrorImage": { "Axes": ["X", "Y"] } }
#BeforeBuild:
{}
#AfterBuild:
{
"MirrorImage": { "Axes": ["X", "Y"] },
"ProgramToMcTransform": [
{
"Source": "MirrorImage",
"Kind": "Static",
"Mat4d": [-1,0,0,0, 0,-1,0,0, 0,0,1,0, 0,0,0,1]
}
]
}
Bare reset — the empty set stays modal (blocking a stale carry) and no chain entry is written: #Previous:
{ "MirrorImage": { "Axes": ["X"] } }
#BeforeBuild:
{ "Parsing": { "MirrorImage": [ { "Axes": [] } ] } }
#AfterBuild:
{ "MirrorImage": { "Axes": [] } }
Rotary letter — dropped from the set with the
HeidenhainMirror–RotaryUnsupported warning (statement still
replaces, so a lone rotary word clears an active linear mirror):
#Previous:
{ "MirrorImage": { "Axes": ["Y"] } }
#BeforeBuild:
{ "Parsing": { "MirrorImage": [ { "Axes": ["C"] } ] } }
#AfterBuild:
{ "MirrorImage": { "Axes": [] } }
Valued (Fanuc-shaped) statement — consumed with zero mirror effect
(HeidenhainMirror–ValuedUnsupported); the active set carries
through unchanged:
#Previous:
{ "MirrorImage": { "Axes": ["X"] } }
#BeforeBuild:
{
"Parsing": {
"MirrorImage": [ { "Axes": ["X", "Y", "Z"], "Valued": true } ]
}
}
#AfterBuild:
{
"MirrorImage": { "Axes": ["X"] },
"ProgramToMcTransform": [
{
"Source": "MirrorImage",
"Kind": "Static",
"Mat4d": [-1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1]
}
]
}
Sequential statements on one block — applied in source order, each replacing (the last one wins): #BeforeBuild:
{
"Parsing": {
"MirrorImage": [ { "Axes": ["X"] }, { "Axes": ["Y"] } ]
}
}
#AfterBuild:
{
"MirrorImage": { "Axes": ["Y"] },
"ProgramToMcTransform": [
{
"Source": "MirrorImage",
"Kind": "Static",
"Mat4d": [1,0,0,0, 0,-1,0,0, 0,0,1,0, 0,0,0,1]
}
]
}
Never-active program — no statement, no previous section: the block stays untouched (files without G28 dump identically to before this syntax existed): #BeforeBuild:
{ "ProgramXyz": { "X": 10, "Y": 0, "Z": 0 } }
#AfterBuild:
{ "ProgramXyz": { "X": 10, "Y": 0, "Z": 0 } }
Constructors
HeidenhainMirrorTransformSyntax()
Initializes a new instance with default settings.
public HeidenhainMirrorTransformSyntax()
HeidenhainMirrorTransformSyntax(XElement)
Initializes a new instance by deserializing from the given XML element.
public HeidenhainMirrorTransformSyntax(XElement src)
Parameters
srcXElementSource XML element.
Fields
RotaryUnsupportedId
Diagnostic id: a rotary axis letter in a G28 statement (dropped from the mirror set — not representable in the XYZ chain).
public const string RotaryUnsupportedId = "HeidenhainMirror--RotaryUnsupported"
Field Value
SectionKey
Root-section key of the modal mirror set: {“Axes”: [...]},
the letters currently mirrored (empty = mirror off). Written on
every block once the program has touched G28, carried by this
syntax's own single-step lookback (the DatumShift pattern).
public const string SectionKey = "MirrorImage"
Field Value
TransformSource
ProgramToMcTransform source name of the mirror entry. Always the chain's first entry (this syntax runs ahead of every other transform writer).
public const string TransformSource = "MirrorImage"
Field Value
ValuedUnsupportedId
Diagnostic id: the Fanuc-shaped valued statement (consumed with zero mirror effect).
public const string ValuedUnsupportedId = "HeidenhainMirror--ValuedUnsupported"
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