Class G53p1RotaryPositionSyntax
- Namespace
- Hi.NcParsers.LogicSyntaxs
- Assembly
- HiMech.dll
G53.1 — non-modal, one-shot rotary axis positioning. Positions the rotary axes (A/B/C) to align the physical tool axis with the active tilted work plane defined by G68.2. XYZ position is unchanged; only rotary axes move via rapid traverse.
Requires IsoG68p2TiltSyntax (or equivalent) to have written the tilt transform. Uses IMachineKinematics to solve for the target A/B/C via inverse kinematics.
Must be placed after IsoG68p2TiltSyntax (needs tilt data) and before ProgramXyzSyntax in the syntax chain. Writes A/B/C into MachineCoordinateState. Motion is handled by LinearMotionSyntax via modal G00/G01.
public class G53p1RotaryPositionSyntax : ISituNcSyntax, INcSyntax, IMakeXmlSource
- Inheritance
-
G53p1RotaryPositionSyntax
- Implements
- Inherited Members
- Extension Methods
Examples
No-kinematics dep-guard early-return: standalone G53.1 with
no IMachineKinematics dep in the list — the syntax
detects the flag, finds no kinematics, and silently consumes the
flag via ConsumeFlag. Empty Parsing is then removed
by CleanupParsing(JsonObject), so the post-Build block
is empty:
#BeforeBuild:
{ "Parsing": { "Flags": ["G53.1"] } }
#AfterBuild:
{}
IK happy path — G53.1 with active G68.2 tilt on
#Previous:, real XyzabcSolver
(table-A / head-B 5-axis), and a
TestDeps.AxisConfig(A=Rotary, B=Rotary) dep. The syntax
reads the previous block's tilt Mat4d, solves
OrientationToMcAbc(tiltMat.AxialNormal) for the rotary ABC,
converts radians → degrees, writes MachineCoordinateState
with both rotary axes (XYZ inherited from prevMc = Vec3d.Zero
when no previous MC exists), and stamps ProgramXyz:
#Previous:
{
"TiltTransform": { "Term": "G68.2", "X": 0, "Y": 0, "Z": 0, "I": 0, "J": 30, "K": 0 },
"ProgramToMcTransform": [
{
"Source": "TiltTransform",
"Kind": "Static",
"Mat4d": [
1, 0, 0, 0,
0, 0.8660254037844388, 0.5, 0,
0, -0.5, 0.8660254037844388, 0,
0, 0, 0, 1
]
}
]
}
#BeforeBuild:
{ "Parsing": { "Flags": ["G53.1"] } }
#AfterBuild:
{
"MachineCoordinateState": { "X": 0, "Y": 0, "Z": 0, "A": 29.942194198514308, "B": 0 },
"ProgramXyz": { "X": 0, "Y": 0, "Z": 0 }
}
Explicit ABC override — G53.1 A0 B45 on top of the same
G68.2 tilt + kinematics + axis-config set up. The IK still solves,
but the explicit A=0 and B=45 overrides what IK
returned for those axes; C stays at the IK-solved value (C-axis
is not present in the table-A/head-B layout, so the rotaryAxes
loop only writes A and B):
#Previous:
{
"TiltTransform": { "Term": "G68.2", "X": 0, "Y": 0, "Z": 0, "I": 0, "J": 30, "K": 0 },
"ProgramToMcTransform": [
{
"Source": "TiltTransform",
"Kind": "Static",
"Mat4d": [
1, 0, 0, 0,
0, 0.8660254037844388, 0.5, 0,
0, -0.5, 0.8660254037844388, 0,
0, 0, 0, 1
]
}
]
}
#BeforeBuild:
{
"Parsing": { "Flags": ["G53.1"], "A": 0, "B": 45 }
}
#AfterBuild:
{
"MachineCoordinateState": { "X": 0, "Y": 0, "Z": 0, "A": 0, "B": 45 },
"ProgramXyz": { "X": 0, "Y": 0, "Z": 0 }
}
Remarks
When IMachineKinematics is not available (3-axis config), G53.1 is silently consumed with no positional effect. When G68.2 is not active, a validation error is reported.
Optional explicit A/B/C on the G53.1 line (post-processor hints) override the IK result. These are read from Parsing via ConsumeAxis(JsonObject, string, ISentenceCarrier, NcDiagnosticProgress) and consumed to prevent McAbcSyntax from double-processing.
Constructors
G53p1RotaryPositionSyntax()
Initializes a new instance with default settings.
public G53p1RotaryPositionSyntax()
G53p1RotaryPositionSyntax(XElement)
Initializes a new instance by deserializing from the given XML element.
public G53p1RotaryPositionSyntax(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