Table of Contents

Interface INcSentenceComposer

Namespace
Hi.NcParsers.NcWriteback
Assembly
HiMech.dll

The dedicated data→text seam of the writeback layer: picks data from a piece's brand-neutral JSON sections and composes new NC sentence text — no original NC text participates. This is the step that varies per target dialect, factored out of the stream-level INcPieceConverter (see NcSynthesisConverter) so every no-source-text path shares one contract:

  • CL → NC conversion — there is no original NC to reference; every line is composed from data (FanucNcSentenceComposer).
  • Future manipulation paths whose lines have no source-text counterpart at all. (NC optimization splition was originally listed here, but P2 shipped it on the patch side instead: a re-interpolated fragment derives from its source line, so it starts from that line's verbatim text and rewrites anchored tokens — see NcOptMixedPatchConverter. Composing those lines from data would have dropped whatever else the source line carried alongside the motion, such as an M code or an inline comment.)
  • Future manipulation paths that fabricate blocks without a source-text counterpart.

The source-text counterpart is the patch path (NcPatchUtil / NcPatchWriter): when an original text exists it stays the draft and only anchored tokens are edited. A future mixed stream can dispatch per piece — patch when a reference text is available, compose otherwise; if that dispatch must run on JSON alone (without reaching the source piece), the reference text can be carried as a JSON section alongside SourceRefSectionName (design affordance, not yet needed — the in-memory map already reaches the source BlockText).

A composer instance owns the modal state of one stream walk (emitted tilt / H / F / plane latches, header bookkeeping): create a fresh instance per conversion run, feed pieces in execution order, and flush with ComposeTrailerLines(NcDiagnosticProgress) after the stream drains.

public interface INcSentenceComposer
Extension Methods

Properties

TargetBrand

Target dialect token; one of the CncBrandDependency brand constants.

string TargetBrand { get; }

Property Value

string

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.

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.

IEnumerable<string> ComposeTrailerLines(NcDiagnosticProgress conversionProgress)

Parameters

conversionProgress NcDiagnosticProgress

Diagnostic sink; may be null.

Returns

IEnumerable<string>