Class IsoCoordinateOffsetSyntax
- Namespace
- Hi.NcParsers.LogicSyntaxs
- Assembly
- HiMech.dll
ISO/Fanuc/Mazak/Okuma/Syntec: resolves the G54–G59.9 work coordinate
offset and the Fanuc-family additional work coordinate systems
(G54.1 Pn, also spelled G54 Pn).
Reads G54/G55/.../G59.9 from Flags and the
captured Parsing.G54.1 = {P: n} object (written by
G54p1Syntax for both spellings),
which resolves to the coordinate id "G54.1P{n}" that the brand
parameter tables map to #7001+
(IsoCoordinateAddressMap). Looks the offset Vec3d up via
the IIsoCoordinateConfig dependencies (brand parameter
table or IsoCoordinateTable) and composes it into
ProgramToMcTransform.
Modal — the active coordinate persists via backward lookback.
Default coordinate ID is set by StaticInitializer.
A block that selects a work coordinate system nobody has configured is
reported on that block (never on the modal re-query of the following
blocks): Coord-WorkOffset--AdditionalZero when an additional
system (G54.1 Pn) resolves to no entry or to (0, 0, 0) — the
brand tables seed every P row with zero, hardware-faithfully, so a zero
there is the "never entered" state, whereas a zero row of the standard
series (G54–G59 and the G59.1–G59.9 extension alike) is a legitimate
authoring convention and stays silent;
Coord-WorkOffset--NoTableEntry when no provider resolves the id
at all (e.g. a G59.x on a runner carrying no brand-neutral table
beside its brand table); and
Coord-WorkOffset--IndexUnresolved when the P word is not a
positive integer (vacant variable, non-integer), in which case the
active system is kept. A bare G54.1 without P is not this
syntax's business: the parameterized capture consumes nothing without
a parameter, the dotted number lands in Parsing.Flags where it
is not a G54-series member, so the active system is kept and the
unconsumed check reports the flag.
public class IsoCoordinateOffsetSyntax : ISituNcSyntax, INcSyntax, IMakeXmlSource
- Inheritance
-
IsoCoordinateOffsetSyntax
- Implements
- Inherited Members
- Extension Methods
Examples
The Mat4d arrays below are written as 16 plain doubles in
column-major order; the first 12 are the identity 3×3 rotation, the
last 4 are the translation column (tx, ty, tz, 1). So a pure
translation by (tx, ty, tz) is
[1,0,0,0, 0,1,0,0, 0,0,1,0, tx,ty,tz,1].
G54 flag on the block but no IIsoCoordinateConfig on
the dep list — the resolved offset falls back to Vec3d.Zero
and the composed translation is the identity matrix:
{ "Parsing": { "Flags": ["G54"] } }
#AfterBuild:
{
"CoordinateOffset": {
"CoordinateId": "G54",
"Offset_X": 0, "Offset_Y": 0, "Offset_Z": 0
},
"ProgramToMcTransform": [
{
"Source": "CoordinateOffset",
"Kind": "Static",
"Mat4d": [1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1]
}
]
}
G55 flag with an IsoCoordinateTable
providing G55 → (100, 50, -200) — the offset is written to
the CoordinateOffset section and the same translation is
composed into the transform chain:
#BeforeBuild:
{ "Parsing": { "Flags": ["G55"] } }
#AfterBuild:
{
"CoordinateOffset": {
"CoordinateId": "G55",
"Offset_X": 100, "Offset_Y": 50, "Offset_Z": -200
},
"ProgramToMcTransform": [
{
"Source": "CoordinateOffset",
"Kind": "Static",
"Mat4d": [1,0,0,0, 0,1,0,0, 0,0,1,0, 100,50,-200,1]
}
]
}
No coordinate flag on the current block (e.g. an unrelated M03) but
#Previous: carried G54 — modal lookback inherits
G54, the dep is re-queried (so Offset_X/Y/Z are taken
from the table, not from the previous block), and the transform
chain is rebuilt. The unrelated M03 flag survives in
Parsing.Flags because CleanupParsing only fires on the
new-coord-flag branch:
#Previous:
{
"CoordinateOffset": {
"CoordinateId": "G54",
"Offset_X": 10, "Offset_Y": 20, "Offset_Z": -100
}
}
#BeforeBuild:
{ "Parsing": { "Flags": ["M03"] } }
#AfterBuild:
{
"Parsing": { "Flags": ["M03"] },
"CoordinateOffset": {
"CoordinateId": "G54",
"Offset_X": 10, "Offset_Y": 20, "Offset_Z": -100
},
"ProgramToMcTransform": [
{
"Source": "CoordinateOffset",
"Kind": "Static",
"Mat4d": [1,0,0,0, 0,1,0,0, 0,0,1,0, 10,20,-100,1]
}
]
}
An additional work coordinate system — the parsing capture of
G54.1 P4 or G54 P4 — with an
IsoCoordinateTable providing
G54.1P4 → (100, 50, -200): the captured object is consumed,
the coordinate id is the un-padded "G54.1P4" key the providers
share, and the translation is composed like any G5x:
#BeforeBuild:
{ "Parsing": { "G54.1": { "P": 4 } } }
#AfterBuild:
{
"CoordinateOffset": {
"CoordinateId": "G54.1P4",
"Offset_X": 100, "Offset_Y": 50, "Offset_Z": -200
},
"ProgramToMcTransform": [
{
"Source": "CoordinateOffset",
"Kind": "Static",
"Mat4d": [1,0,0,0, 0,1,0,0, 0,0,1,0, 100,50,-200,1]
}
]
}
A block carrying both a G5x flag and an additional-system capture
(illegal on a Fanuc — both are modal group 14 — but a parser must pick):
the additional system wins, and the flag is consumed with it so that
no stale G55 is left for the next syntaxes; the same table as above
serves the lookup:
#BeforeBuild:
{ "Parsing": { "Flags": ["G55"], "G54.1": { "P": 4 } } }
#AfterBuild:
{
"CoordinateOffset": {
"CoordinateId": "G54.1P4",
"Offset_X": 100, "Offset_Y": 50, "Offset_Z": -200
},
"ProgramToMcTransform": [
{
"Source": "CoordinateOffset",
"Kind": "Static",
"Mat4d": [1,0,0,0, 0,1,0,0, 0,0,1,0, 100,50,-200,1]
}
]
}
Constructors
IsoCoordinateOffsetSyntax()
Initializes a new instance with default settings.
public IsoCoordinateOffsetSyntax()
IsoCoordinateOffsetSyntax(XElement)
Initializes a new instance by deserializing from the given XML element.
public IsoCoordinateOffsetSyntax(XElement src)
Parameters
srcXElementSource XML element.
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