Table of Contents

Class NcOptSplitionPlan

Namespace
Hi.NcOpt
Assembly
HiMech.dll

Complete splition rewrite plan of one source piece: the ordered fragment specs (one per segment step) plus the pack-level modal-token strip list. Keyed by the source piece's SentenceIndex in SplitionPlansBySentenceIndex.

public class NcOptSplitionPlan
Inheritance
NcOptSplitionPlan
Inherited Members
Extension Methods

Remarks

SoftNc dual of the HardNc oracle's splition branch (NcOptProc), with the plan/apply split: SoftNcOptProc computes every decision (feed chains, essential filter, endpoint tolerances, arc geometry, log notes) during its orchestrator walk; the converter only replays the recorded text operations onto copies of the source block text.

Fields

ModalFlagTokenCandidates

Modal NC flag token names, dotted/longer names first, that the plan builder probes on the source text to fill StripModalTokens.

public static readonly string[] ModalFlagTokenCandidates

Field Value

string[]

Remarks

SoftNc collapse of the oracle's RebuildFlagSyntaxToNcLine (frozen baseline, NcOptProc): the oracle iterates every NcLifeCycleMode.Modal flag (NcFlag) and removes the token when the flag is ON and identical on the previous OUTPUT line (IsFlagKeeping, HardNcUtil). Fragments of one splition pack all share the source line's modal state, so for the non-first emitted fragments “kept-same ON modal flag” collapses to “modal flag token literally present on the source text” — one-shot tokens (G04/G28/G53/L/LN/M03/M06/M08…), N numbers and other co-loaded words survive on every fragment, exactly like the oracle. The list is the Modal-lifecycle NC names of NcFlag; names that can never appear as text (attribute-less enum identifiers such as SpindleCw/Cooling) are omitted, and G95 is deliberately absent because the oracle has no G95 flag (its token survives fragmenting there too). The oracle's G54-series composed names are covered by the literal G54/…/G59/G54.1/G59.x tokens.

Properties

Fragments

Ordered fragment specs, one per step of the pack's StepIndexSegment (dropped fragments included, see IsEmitted).

public List<NcOptSplitionFragmentPlan> Fragments { get; set; }

Property Value

List<NcOptSplitionFragmentPlan>

StripModalTokens

The modal flag tokens literally present on the source block text (outside comments), probed once per pack in ModalFlagTokenCandidates order; removed from every emitted fragment after the first emitted one (StripModalFlagTokens).

public List<string> StripModalTokens { get; set; }

Property Value

List<string>

StripWorkOffsetIndexWord

Whether the pack's source block selects an additional work coordinate system through its G54-family token (G54.1 Pn, or the G54 Pn alias): the P words in that token's scope are the selection's index, not words of their own, so the modal strip takes them out together with the token (ApplyModalStrip(ref string, Func<string, IReadOnlyList<(int Start, int Length)>>, string)) — a fragment left with a bare P48 re-parses it as an unconsumed word. Set by the plan builder from the piece's RESOLVED coordinate id (which may be modal-carried), so a plain G54, or a dialect whose G54 takes no parameter, keeps any P word untouched.

public bool StripWorkOffsetIndexWord { get; set; }

Property Value

bool

Remarks

Deliberate divergence from the HardNc oracle (NcOptProc), which composes and cuts the G54/G54.1 token only and leaves the P on every fragment: the byte shape of such fragments differs, and the file-first-feedrate probe (NcOptPieceClassifier.IsSimpleFeedrateAssignable on the stripped text) sees a P-less line — a coordinate-only fragment that the orphan P used to disqualify is now a plain coordinate line and can carry the file's first F, which is the classification the source line would have had without the artifact.

Methods

ApplyModalStrip(ref string, Func<string, IReadOnlyList<(int Start, int Length)>>, string)

Applies the pack's modal strip to text: every StripModalTokens token is removed at its first occurrence with the oracle splice (RemoveFlagTrimmingTail(ref string, string, IReadOnlyList<(int Start, int Length)>)), and when StripWorkOffsetIndexWord is set the P word in the scope of the removed G54-family token goes with it (RemoveScopedParamWordTrimmingTail(ref string, int, string, string, IReadOnlyList<(int Start, int Length)>)). Comment spans are re-probed after every edit because the text shifts.

public void ApplyModalStrip(ref string text, Func<string, IReadOnlyList<(int Start, int Length)>> commentSpanProvider, string varPrefix)

Parameters

text string

Fragment draft to edit.

commentSpanProvider Func<string, IReadOnlyList<(int Start, int Length)>>

The brand comment-span provider (may be null).

varPrefix string

Variable index prefix of the dialect, for the P word's value grammar.

IsWorkOffsetSelectionToken(string)

True for the G54-family tokens (G54.1 and its G54 alias spelling) whose in-scope P word StripWorkOffsetIndexWord refers to.

public static bool IsWorkOffsetSelectionToken(string token)

Parameters

token string

A ModalFlagTokenCandidates entry.

Returns

bool