Class G43p4RtcpSyntax
- Namespace
- Hi.NcParsers.LogicSyntaxs
- Assembly
- HiMech.dll
Handles G43.4 RTCP (Rotary Tool Center Point) activation. Writes the IToolHeightCompensationDef section and the ToolHeightCompensationSource entry in ProgramToMcTransform — a tool-normal · offset_mm translation at the block endpoint ABC. The chain entry is tagged KindDynamic when RTCP is active and ABC changes across the block, and KindStatic otherwise.
The RTCP kinematic rotary part (Pn→MC rigid transform) is orthogonal
to this syntax and is written by PivotTransformationSyntax
on every block, because rotary state remains in effect beyond
the RTCP modal (e.g. a non-RTCP G01 after G49 still
inherits the last ABC from the program).
The "rotary dynamic" distinction lives on the chain entry's KindKey alone and is read via HasDynamicEntry(JsonObject) by LinearMotionSyntax to pick ClLinear vs McLinear.
G43.4 is used by Fanuc, Mazak, Syntec, and Okuma. Siemens (TRAORI) and Heidenhain (M128) are handled by separate syntaxes. Must be placed after ToolHeightOffsetSyntax (to override the ToolHeightCompensation entry when RTCP is active) and before PivotTransformationSyntax (which runs last in the chain).
public class G43p4RtcpSyntax : ISituNcSyntax, INcSyntax, IMakeXmlSource
- Inheritance
-
G43p4RtcpSyntax
- Implements
- Inherited Members
- Extension Methods
Examples
Real-kinematics cases below wire TestDeps.CodeKinematics
with the default chain code [O][Z][A][w];[O][Y][X][B][S][t]
— a table-A / head-B 5-axis machine. A pivots around -X
through origin (table side); B pivots around +Y through origin
(head side). Both pivot axes pass through (0,0,0) because
CodeXyzabcChain uses zero-offset
component attachments — the head-B origin pivot is a pedagogical
simplification (a real table-head machine has the spindle pivot
offset from origin). Realistic MachineCoordinateState
therefore carries A and B only; there is no C axis in this chain
(5-axis machines have at most two rotary axes).
Verification cue: with B=30° on the head side and the cutter
extending +Z in tool frame at ABC=0, the tool normal after the
head rotation lies at (sin 30°, 0, cos 30°); multiplying
by the 10 mm tool length gives Trans ≈ (5, 0, 8.66).
Explicit G43.4 H1 activation with no IMachineKinematics
and no IToolOffsetConfig in the dependency list —
exercises the activate path on its identity-matrix corner. The
section is written with Offset_mm = 0 (no offset table
→ rawHeight = 0); the height-mat falls back to the
no-kinematics branch new Mat4d { Trans = UnitZ * 0 } which
collapses to identity; abcChanged is false (no current MC,
no previous block) so the entry is tagged KindStatic.
{ "Parsing": { "G43.4": { "H": "1" } } }
#AfterBuild:
{
"ToolHeightCompensation": { "Offset_mm": 0, "Term": "G43.4", "OffsetId": 1 },
"ProgramToMcTransform": [
{
"Source": "ToolHeightCompensation",
"Kind": "Static",
"Mat4d": [1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1]
}
]
}
G43.4 H1 with ToolOffset(1 → 10 mm), the real 5-axis solver
above, and current block carrying both rotary axes
MachineCoordinateState.A = 0, B = 30 (as a prior
McAbcSyntax would have written on this machine). The
height-mat goes through
MakeToolHeightMat(IMachineKinematics, Vec3d, double) which probes
kinematics.McToPn(Zero, abc).Normal at abc = (0, π/6, 0)
to get the tool orientation, then scales by 10 mm. With no
previous block, abcChanged is false → entry stays Static:
#BeforeBuild:
{
"Parsing": { "G43.4": { "H": "1" } },
"MachineCoordinateState": { "A": 0, "B": 30 }
}
#AfterBuild:
{
"MachineCoordinateState": { "A": 0, "B": 30 },
"ToolHeightCompensation": { "Offset_mm": 10, "Term": "G43.4", "OffsetId": 1 },
"ProgramToMcTransform": [
{
"Source": "ToolHeightCompensation",
"Kind": "Static",
"Mat4d": [
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
4.999999999999999, 0, 8.660254037844387, 1
]
}
]
}
Same setup plus a #Previous: block with
MachineCoordinateState.B = 0 + XYZ origin —
DidAbcChange(LazyLinkedListNode<SyntaxPiece>, IMachineAxisConfig) compares the rotary deltas and finds B
changed across the block, so the entry is tagged
KindDynamic (signalling that the
tool orientation varies along the contour):
#Previous:
{
"MachineCoordinateState": { "X": 0, "Y": 0, "Z": 0, "A": 0, "B": 0 }
}
#BeforeBuild:
{
"Parsing": { "G43.4": { "H": "1" } },
"MachineCoordinateState": { "A": 0, "B": 30 }
}
#AfterBuild:
{
"MachineCoordinateState": { "A": 0, "B": 30 },
"ToolHeightCompensation": { "Offset_mm": 10, "Term": "G43.4", "OffsetId": 1 },
"ProgramToMcTransform": [
{
"Source": "ToolHeightCompensation",
"Kind": "Dynamic",
"Mat4d": [
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
4.999999999999999, 0, 8.660254037844387, 1
]
}
]
}
Constructors
G43p4RtcpSyntax()
Initializes a new instance with default settings.
public G43p4RtcpSyntax()
G43p4RtcpSyntax(XElement)
Initializes a new instance by deserializing from the given XML element.
public G43p4RtcpSyntax(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