Table of Contents

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

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. #BeforeBuild:

{ "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), a real XyzabcSolver (table-A / head-B 5-axis), and current block already carrying all three rotary axes in MachineCoordinateState (A=0, B=30, C=0 — as a prior McAbcSyntax in the chain would have written). 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. Note: all three ABC must be present (or fall back to the per-axis modal lookback path); a partial section with only B set leaves A/C as NaN and the resulting Mat4d.Trans would serialise as non-finite numbers. #BeforeBuild:

{
  "Parsing": { "G43.4": { "H": "1" } },
  "MachineCoordinateState": { "A": 0, "B": 30, "C": 0 }
}

#AfterBuild:

{
  "MachineCoordinateState": { "A": 0, "B": 30, "C": 0 },
  "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, "C": 0 }
}

#BeforeBuild:

{
  "Parsing": { "G43.4": { "H": "1" } },
  "MachineCoordinateState": { "A": 0, "B": 30, "C": 0 }
}

#AfterBuild:

{
  "MachineCoordinateState": { "A": 0, "B": 30, "C": 0 },
  "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

src XElement

Source XML element.

Properties

Name

Syntax kind name (typically the concrete type name).

public string Name { get; }

Property Value

string

XName

XML element name used to register this syntax with XFactory.

public static string XName { get; }

Property Value

string

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

syntaxPieceNode LazyLinkedListNode<SyntaxPiece>
ncDependencyList List<INcDependency>
ncDiagnosticProgress NcDiagnosticProgress

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

baseDirectory string

The base directory for resolving relative paths

relFile string

The relative file path for the XML source

exhibitionOnly bool

if 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

factory XFactory