Class FanucNcSentenceComposer
- Namespace
- Hi.NcParsers.NcWriteback
- Assembly
- HiMech.dll
INcSentenceComposer targeting the Fanuc dialect: composes whole NC lines from the brand-neutral JSON sections of finished SyntaxPieces — the source text (e.g. NX CLSF records) does not participate. One instance owns the modal state of one stream walk; wrap it in a NcSynthesisConverter for the stream-level conversion (dst pieces + src↔dst map).
Vocabulary map (sections → Fanuc words):
ToolChange→T… M06; the tool id also spells theG43.4 H…offset id.SpindleSpeed→S… M03/M04orM05.Coolant→M08/M07/M09.ProgramToMcTransformtilt entry (TransformSource, MSYS rotation) plus the TransformSource translation →G68.2 X_ Y_ Z_ I_ J_ K_(euler angles via EulerUtil in the configurable TiltEulerSequence, default ZXZ), identity →G69.ToolHeightCompensation→G43.4 H…(RTCP), so the replaying runner rebuilds the same tool-height + pivot transform chain. Emitted before the first motion even for zero offsets — the pivot entry only folds while RTCP or a tilted plane is active.- Motion pieces →
G00/G01/G02/G03withX Y ZfromProgramXyz, rotary words fromMachineCoordinateState(degrees, already shortest-cyclic),Ffrom modalFeedrate; arcs fromClArcEventwith in-planeI/J/Kcenter offsets andG17/G18/G19plane words.
Modal words (motion G-code, F, plane, tilt, H) are suppressed while unchanged; coordinate words are suppressed per-axis when the change is below the emitted precision. Unsupported content is reported through NcDiagnosticProgress with the piece as anchor and the motion degrades conservatively (arc with an off-axis plane falls back to a linear move to the endpoint, loudly).
public class FanucNcSentenceComposer : INcSentenceComposer
- Inheritance
-
FanucNcSentenceComposer
- Implements
- Inherited Members
- Extension Methods
Properties
CoordinateEpsilon
Per-axis suppression threshold for coordinate words, half the CoordinateFormat output resolution.
public double CoordinateEpsilon { get; set; }
Property Value
CoordinateFormat
Format for coordinate words (X/Y/Z/I/J/K and rotary degrees).
Trailing zeros after the decimal point are trimmed, keeping the dot
(HardNc convention: -50.2500 → -50.25, 10.0000 →
10.).
public string CoordinateFormat { get; set; }
Property Value
FeedrateFormat
Format for the F word (mm/min).
public string FeedrateFormat { get; set; }
Property Value
ProgramNumber
Program number for the O word in the header.
public int ProgramNumber { get; set; }
Property Value
TargetBrand
Target dialect token; one of the CncBrandDependency brand constants.
public string TargetBrand { get; }
Property Value
TiltEulerSequence
Euler sequence for the G68.2 I/J/K angles. Default
Zxz — the G68.2 standard format, and the
only sequence the replaying parse side
(IsoG68p2TiltSyntax) reads; configure it when the
target controller interprets the tilted plane command with a
different convention (in-project replay parity then no longer
applies).
public EulerSequence TiltEulerSequence { get; set; }
Property Value
Methods
ComposeLines(SyntaxPiece, NcDiagnosticProgress)
Composes the NC text lines this piece's JSON sections spell in the
target dialect — possibly none (a state-only piece), possibly
several (e.g. a header plus a motion line). Problems are reported
through conversionProgress with
srcPiece as the sentence anchor.
public IEnumerable<string> ComposeLines(SyntaxPiece srcPiece, NcDiagnosticProgress conversionProgress)
Parameters
srcPieceSyntaxPieceFinished source piece, fed in execution order.
conversionProgressNcDiagnosticProgressDiagnostic sink; may be null.
Returns
ComposeTrailerLines(NcDiagnosticProgress)
Flushes the trailer lines after the stream drains (e.g. cancel modal compensations, program end). Empty when the walk produced no content.
public IEnumerable<string> ComposeTrailerLines(NcDiagnosticProgress conversionProgress)
Parameters
conversionProgressNcDiagnosticProgressDiagnostic sink; may be null.