Table of Contents

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):

  • ToolChangeT… M06; the tool id also spells the G43.4 H… offset id.
  • SpindleSpeedS… M03/M04 or M05.
  • CoolantM08/M07/M09.
  • ProgramToMcTransform tilt 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.
  • ToolHeightCompensationG43.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/G03 with X Y Z from ProgramXyz, rotary words from MachineCoordinateState (degrees, already shortest-cyclic), F from modal Feedrate; arcs from ClArcEvent with in-plane I/J/K center offsets and G17/G18/G19 plane 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

double

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.000010.).

public string CoordinateFormat { get; set; }

Property Value

string

FeedrateFormat

Format for the F word (mm/min).

public string FeedrateFormat { get; set; }

Property Value

string

ProgramNumber

Program number for the O word in the header.

public int ProgramNumber { get; set; }

Property Value

int

TargetBrand

Target dialect token; one of the CncBrandDependency brand constants.

public string TargetBrand { get; }

Property Value

string

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

EulerSequence

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

srcPiece SyntaxPiece

Finished source piece, fed in execution order.

conversionProgress NcDiagnosticProgress

Diagnostic sink; may be null.

Returns

IEnumerable<string>

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

conversionProgress NcDiagnosticProgress

Diagnostic sink; may be null.

Returns

IEnumerable<string>