Class SiemensCircularMotionSyntax
- Namespace
- Hi.NcParsers.LogicSyntaxs.Siemens
- Assembly
- HiMech.dll
Siemens variant of CircularMotionSyntax (replaces it in
the Siemens preset — do not run both): writes
McArc motion for G02/G03 blocks from
I/J/K center offsets or the Siemens signed radius CR=
(captured as Parsing.CR by an equals-form
FloatTagValueSyntax), with the helix
turn count from TURN= (Parsing.TURN).
Differences from the Fanuc/ISO parent, per the corpus-driven plan:
CRreplacesR— same math (ResolveCenterFromSignedRadius(Vec3d, Vec3d, int, bool, double); negative CR selects the >180° arc), but a CR full circle (start ≈ end on the plane) is invalid on Sinumerik and the chord collapse would produce a NaN center — rejected withArc-CR--ClosedChord, params left visible.TURN=Nmeans N additional full circles:AdditionalCircleNum = TURN + (closed ? 1 : 0)— no −1 (the legacy HardNc path treated TURN like Fanuc L and silently undercounted Siemens helices by one turn; deliberately not ported). The closed-loop +1 stacks on the same closure heuristic used when TURN is absent, because the downstream angle wrap yields 0 rad for closed arcs and the whole loop count must come fromAdditionalCircleNum.- No
Land no K-as-pitch reading — SiemensL{n}is a subprogram call and helix travel is endpoint + TURN driven.
Must be placed before LinearMotionSyntax (shared Group 01 motion slot).
public class SiemensCircularMotionSyntax : ISituNcSyntax, INcSyntax, IMakeXmlSource
- Inheritance
-
SiemensCircularMotionSyntax
- Implements
- Inherited Members
- Extension Methods
Examples
All cases run with the current block's ProgramXyz already set
and no #Previous: unless noted, so GetLastProgramXyz
returns Vec3d.Zero; G17 XY plane is implicit.
CR= 90° arc: G02 from (0,0,0) to (10,10,0) with
CR=10 — same center math as ISO R:
{
"Parsing": { "Flags": ["G02"], "CR": 10 },
"ProgramXyz": { "X": 10, "Y": 10, "Z": 0 }
}
#AfterBuild:
{
"ProgramXyz": { "X": 10, "Y": 10, "Z": 0 },
"MotionState": { "Term": "G02" },
"MotionEvent": {
"Form": "McArc",
"ArcCenter": { "X": 10, "Y": 0, "Z": 0 },
"IsCcw": false,
"AdditionalCircleNum": 0
}
}
Negative CR selects the >180° side — center flips across the
chord relative to the case above:
#BeforeBuild:
{
"Parsing": { "Flags": ["G02"], "CR": -10 },
"ProgramXyz": { "X": 10, "Y": 10, "Z": 0 }
}
#AfterBuild:
{
"ProgramXyz": { "X": 10, "Y": 10, "Z": 0 },
"MotionState": { "Term": "G02" },
"MotionEvent": {
"Form": "McArc",
"ArcCenter": { "X": 0, "Y": 10, "Z": 0 },
"IsCcw": false,
"AdditionalCircleNum": 0
}
}
Corpus helix shape (G3 X.. Y.. Z.. I.. J.. TURN=16, reduced):
I/J center on the begin plane, XY endpoint differs from start (open
arc) so AdditionalCircleNum = TURN exactly — no −1:
#BeforeBuild:
{
"Parsing": { "Flags": ["G03"], "I": 5, "J": 0, "TURN": 16 },
"ProgramXyz": { "X": 0, "Y": 5, "Z": -48 }
}
#AfterBuild:
{
"ProgramXyz": { "X": 0, "Y": 5, "Z": -48 },
"MotionState": { "Term": "G03" },
"MotionEvent": {
"Form": "McArc",
"ArcCenter": { "X": 5, "Y": 0, "Z": 0 },
"IsCcw": true,
"AdditionalCircleNum": 16
}
}
Closed full circle with TURN=2 — base circle + 2 extra turns = 3
loops total; the closure +1 stacks on TURN because the downstream
angle wrap contributes 0 rad for start == end:
#BeforeBuild:
{
"Parsing": { "Flags": ["G02"], "I": 5, "J": 0, "TURN": 2 },
"ProgramXyz": { "X": 0, "Y": 0, "Z": 0 }
}
#AfterBuild:
{
"ProgramXyz": { "X": 0, "Y": 0, "Z": 0 },
"MotionState": { "Term": "G02" },
"MotionEvent": {
"Form": "McArc",
"ArcCenter": { "X": 5, "Y": 0, "Z": 0 },
"IsCcw": false,
"AdditionalCircleNum": 3
}
}
CR= with start ≈ end (invalid on Sinumerik — the chord defines no
center): rejected with Arc-CR--ClosedChord; params stay
visible as residue, and the modal MotionState is still
recorded so following continuation arc blocks keep their circular
mode (the G02 flag was already consumed):
#BeforeBuild:
{
"Parsing": { "Flags": ["G02"], "CR": 5 },
"ProgramXyz": { "X": 0, "Y": 0, "Z": 0 }
}
#AfterBuild:
{
"Parsing": { "CR": 5 },
"ProgramXyz": { "X": 0, "Y": 0, "Z": 0 },
"MotionState": { "Term": "G02" }
}
Constructors
SiemensCircularMotionSyntax()
Initializes a new instance with default settings.
public SiemensCircularMotionSyntax()
SiemensCircularMotionSyntax(XElement)
Initializes a new instance by deserializing from the given XML element.
public SiemensCircularMotionSyntax(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