Table of Contents

Class SoftNcRunner

Namespace
Hi.NcParsers
Assembly
HiMech.dll

Configurable NC Runner.

public class SoftNcRunner : IControlRunner, IMakeXmlSource
Inheritance
SoftNcRunner
Implements
Inherited Members
Extension Methods

Constructors

SoftNcRunner()

Creates an empty runner; populate the pipeline lists before use.

public SoftNcRunner()

SoftNcRunner(XElement, string, string, IProgress<object>, object[])

Reconstructs a SoftNcRunner from a project XML element. Each pipeline list (NcDependencyList, Segmenter, NcInitializationList, NcSyntaxList, NcSemanticList) is rehydrated via XFactory.

public SoftNcRunner(XElement src, string baseDirectory, string relFile, IProgress<object> progress, object[] res = null)

Parameters

src XElement

XML element previously produced by MakeXmlSource(string, string, bool).

baseDirectory string

Project base directory for resolving relative paths.

relFile string

Project file path relative to baseDirectory.

progress IProgress<object>

Diagnostic sink propagated to nested factories.

res object[]

Optional ambient resources (e.g. ProjectApiVersion for legacy patches).

Properties

FanucNcRunner

Brand preset for Fanuc — composes a SoftNcRunner whose NcSyntaxList comes from DefaultSyntaxList.

public static SoftNcRunner FanucNcRunner { get; }

Property Value

SoftNcRunner

HeidenhainNcRunner

Brand preset for Heidenhain — composes a SoftNcRunner whose NcSyntaxList comes from DefaultSyntaxList.

public static SoftNcRunner HeidenhainNcRunner { get; }

Property Value

SoftNcRunner

MazakNcRunner

Brand preset for Mazak — composes a SoftNcRunner whose NcSyntaxList comes from DefaultSyntaxList.

public static SoftNcRunner MazakNcRunner { get; }

Property Value

SoftNcRunner

NcDependencyList

External configuration providers consumed by syntaxes/semantics (machine axes, tool offsets, coordinate tables, block-skip flags, etc.).

public List<INcDependency> NcDependencyList { get; set; }

Property Value

List<INcDependency>

NcInitializationList

Seeds the initial SyntaxPiece JSON state (e.g. home position, defaults).

public List<INcInitializer> NcInitializationList { get; set; }

Property Value

List<INcInitializer>

NcSemanticList

Final-stage semantics that turn the last syntax layer into SourcedActEntry records consumed by the runtime.

public List<INcSemantic> NcSemanticList { get; set; }

Property Value

List<INcSemantic>

NcSyntaxList

Ordered syntax pipeline. Each entry consumes the previous layer's SyntaxPiece stream and emits the next layer.

public List<INcSyntax> NcSyntaxList { get; set; }

Property Value

List<INcSyntax>

Segmenter

Splits raw NC text into Sentence blocks.

public ISegmenter Segmenter { get; set; }

Property Value

ISegmenter

SiemensNcRunner

Brand preset for Siemens — composes a SoftNcRunner whose NcSyntaxList comes from DefaultSyntaxList.

public static SoftNcRunner SiemensNcRunner { get; }

Property Value

SoftNcRunner

SyntecNcRunner

Brand preset for Syntec — composes a SoftNcRunner whose NcSyntaxList comes from DefaultSyntaxList.

public static SoftNcRunner SyntecNcRunner { get; }

Property Value

SoftNcRunner

XName

XML element name for Generators registration.

public static string XName { get; }

Property Value

string

Methods

ConfigureByMachiningChain(IMachiningChain)

Configures this SoftNcRunner to match the kinematic chain of a machine tool. Registers every axis present on the chain into the IMachineAxisConfig in NcDependencyList (linear or rotary, derived from whether the chain's transformer implements IDynamicRotation). When the chain carries any rotary axis, a NcKinematicsDependency is appended so that downstream syntaxes / semantics (e.g. G53.1, G68.2, McLinearMotionSemantic) can resolve orientation; its KinematicsProvider is intentionally left null — the owning project service wires it up after the solver instance is available (see LocalProjectService.BuildCoordinateConverter).

public void ConfigureByMachiningChain(IMachiningChain chain)

Parameters

chain IMachiningChain

The machining chain whose axes and kinematics the runner should match. No-op when null.

EnumerateSnapshotSyntaxs()

Enumerates every SnapshotSyntax reachable from NcSyntaxList, including those nested inside any top-level BundleSyntax's inner list. Yields in pipeline-execution order: each top-level slot in turn, and within a bundle slot the bundle's SyntaxList order.

public IEnumerable<SnapshotSyntax> EnumerateSnapshotSyntaxs()

Returns

IEnumerable<SnapshotSyntax>

FromLegacyNcEnvXml(XElement, IMachiningChain)

Creates a SoftNcRunner from legacy HardNcEnv XML. Picks the brand-specific runner by the CncBrand element and populates dependencies from the legacy XML values. When a chain is provided, also calls ConfigureByMachiningChain(IMachiningChain) so the runner's axis configuration and kinematics dependency reflect the machine tool loaded alongside the legacy project. Remove this region when HardNcEnv is fully replaced.

public static SoftNcRunner FromLegacyNcEnvXml(XElement ncEnvXml, IMachiningChain chain = null)

Parameters

ncEnvXml XElement

The inner XML element of the legacy HardNcEnv.

chain IMachiningChain

Optional machining chain for axis/kinematics configuration.

Returns

SoftNcRunner

A configured SoftNcRunner.

GetSourcedActEntrysFromNode(LazyLinkedListNode<SyntaxPiece>, NcDiagnosticProgress, CancellationToken)

Drives the NcSemanticList over the post-syntax SyntaxPiece stream starting at startNode, yielding a SourcedActEntry for each emitted IAct (or a single null-act entry when a semantic produces no acts but still updates the source SyntaxPiece).

public IEnumerable<SourcedActEntry> GetSourcedActEntrysFromNode(LazyLinkedListNode<SyntaxPiece> startNode, NcDiagnosticProgress ncDiagnosticProgress, CancellationToken cancellationToken)

Parameters

startNode LazyLinkedListNode<SyntaxPiece>

First node to evaluate; iteration walks Next.

ncDiagnosticProgress NcDiagnosticProgress

Sink for semantic exceptions.

cancellationToken CancellationToken

Cancellation token (checked between blocks).

Returns

IEnumerable<SourcedActEntry>

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

baseDirectory string

The base directory for resolving relative paths

relFile string

The relative file path for the XML source

exhibitionOnly bool

if 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 SoftNcRunner and chains Reg() on every pipeline component the runner may deserialize from XML — dependencies, initializers, segmenters, parsing/logic/evaluation/post-logic/inspection syntaxes, and semantics. Idempotent; safe to call from any number of boot paths.

public static void Reg(XFactory factory = null)

Parameters

factory XFactory

RunControlLines(string, IEnumerable<string>, MachiningSession, SessionProgress, CancellationToken)

Runs raw Control lines and yields source sentence and Act pairs.

public IEnumerable<SourcedActEntry> RunControlLines(string relFilePath, IEnumerable<string> lines, MachiningSession machiningSession, SessionProgress sessionProgress, CancellationToken cancellationToken)

Parameters

relFilePath string

The relative path of the control file

lines IEnumerable<string>

The enumerable collection of command (control code) lines

machiningSession MachiningSession

Session-scoped state shared across multiple RunControlLines(string, IEnumerable<string>, MachiningSession, SessionProgress, CancellationToken) calls (e.g. lazy-initialized pipeline state, file-index counter).

sessionProgress SessionProgress
cancellationToken CancellationToken

Cancellation token to cancel the operation

Returns

IEnumerable<SourcedActEntry>

Enumerable of source sentence and Act pairs

SetAllSnapshotSyntaxEnabled(bool)

Sets IsEnabled on every SnapshotSyntax reachable from NcSyntaxList (including those nested inside top-level BundleSyntax) to isEnabled. Callers that need finer control (per-section toggling, instance inspection) should iterate EnumerateSnapshotSyntaxs() directly.

public void SetAllSnapshotSyntaxEnabled(bool isEnabled)

Parameters

isEnabled bool