Table of Contents

Class MachiningSession

Namespace
Hi.MachiningProcs
Assembly
HiMech.dll

Represents a machining session that manages the execution and optimization of machining operations. Provides functionality for controlling the machining process, handling optimization options, and managing session state. Implements IDisposable to clean up SessionWriters on session end.

public class MachiningSession : IDisposable
Inheritance
MachiningSession
Implements
Inherited Members
Extension Methods

Properties

CurrentSourceCommand

Gets or sets the current source command being processed.

public IIndexedFileLine CurrentSourceCommand { get; set; }

Property Value

IIndexedFileLine

FileIndexOnRunCommand

File index counter, auto-incremented per RunControlLines(string, IEnumerable<string>, MachiningSession, SessionProgress, CancellationToken) call within this session.

Legacy use only. Read and incremented by HardNcRunner and CsvRunner. SoftNcRunner no longer touches this field — it allocates file indices through FileIndexCounterDependency, which both the runner and inlined-subprogram syntaxes (SubProgramCallSyntax) share so every loaded file (top-level program plus every M98 / M198 inline, including each L repetition) gets a distinct index. Do not introduce new readers; the field will be removed once the legacy runners retire.

public int FileIndexOnRunCommand { get; set; }

Property Value

int

IsNcOptOptionListUpdatedByStep

Internal Use Only.

public bool IsNcOptOptionListUpdatedByStep { get; set; }

Property Value

bool

NcOptOption

Gets or sets the NC optimization options for UI operations.

public NcOptOption NcOptOption { get; set; }

Property Value

NcOptOption

NcRunnerSessionState

Per-session NC pipeline state shared across RunControlLines(string, IEnumerable<string>, MachiningSession, SessionProgress, CancellationToken) calls. Holds lazy-initialized NcDiagnosticProgress and the per-layer LazyLinkedList<T> chain used for cross-file modal continuity.

public NcRunnerSessionState NcRunnerSessionState { get; }

Property Value

NcRunnerSessionState

PacePlayee

Internal set only.

public PacePlayee PacePlayee { get; set; }

Property Value

PacePlayee

PostBlockScripts

Per-line scripts injected externally (without modifying NC files). Key: FileLineIndex of the NC block. Value: C# script text to execute after the NC block. Consumed by CsScriptEndSemantic.

public Dictionary<FileLineIndex, string> PostBlockScripts { get; }

Property Value

Dictionary<FileLineIndex, string>

PreBlockScripts

Per-line scripts injected externally (without modifying NC files). Key: FileLineIndex of the NC block. Value: C# script text to execute before the NC block. Consumed by CsScriptBeginSemantic.

public Dictionary<FileLineIndex, string> PreBlockScripts { get; }

Property Value

Dictionary<FileLineIndex, string>

SessionWriters

StreamWriters registered during the session (e.g. by diagnostic output methods). Key: relative output file path. Disposed automatically when the session ends.

public Dictionary<string, StreamWriter> SessionWriters { get; }

Property Value

Dictionary<string, StreamWriter>

StepIndexToNcOptOptionSortedList

Gets or sets the mapping of step indices to NC optimization options. For internal use only. Takes effect during internal optimization process.

public SortedList<int, NcOptOption> StepIndexToNcOptOptionSortedList { get; set; }

Property Value

SortedList<int, NcOptOption>

StepTaskBundle

Gets or sets the current step task bundle.

public MachiningParallelProc.StepTaskBundle StepTaskBundle { get; set; }

Property Value

MachiningParallelProc.StepTaskBundle

WarnedFluteMaterialMissingTools

Tools already surfaced via “FluteMaterial not set” warning. Keyed by IMachiningTool reference so the dedup is stable across the two emission points: ProcAct(IAct, MachiningSession, IMachiningService, IGetSentence, CancellationToken) at each IActTooling, and BeginSession for the tool that may already be equipped before the session begins (which has no tool ID to dedup with). Reference equality is more precise than tool ID — the same tool object equipped twice should warn once, regardless of how it was reached.

public HashSet<IMachiningTool> WarnedFluteMaterialMissingTools { get; }

Property Value

HashSet<IMachiningTool>

Methods

BeginPreserve()

Begins a preserve section in the optimization process.

public void BeginPreserve()

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

EndPreserve()

Ends a preserve section in the optimization process.

public void EndPreserve()

Preserve()

Preserves one line of NC code in the optimization process.

public void Preserve()

RunMachiningStepBuilt(MachiningStep, MachiningStep)

Internal use only. Invokes MachiningStepBuilt.

public void RunMachiningStepBuilt(MachiningStep preStep, MachiningStep curStep)

Parameters

preStep MachiningStep
curStep MachiningStep

RunMachiningStepSelected(MachiningStep)

Internal use only. Invokes MachiningStepSelected.

public void RunMachiningStepSelected(MachiningStep machiningStep)

Parameters

machiningStep MachiningStep

RunSourcedActEntry(SourcedActEntry)

Internal use only. Invokes SourcedActEntry.

public void RunSourcedActEntry(SourcedActEntry entry)

Parameters

entry SourcedActEntry

RunSyntaxPieceRan(SyntaxPiece)

Internal use only. Invokes SyntaxPieceRan.

public void RunSyntaxPieceRan(SyntaxPiece syntaxPiece)

Parameters

syntaxPiece SyntaxPiece

UpdateNcOptOptionMapIfNeeded(int)

Updates the NC optimization option map if needed. Internal use only.

public bool UpdateNcOptOptionMapIfNeeded(int stepIndex)

Parameters

stepIndex int

The index of the step to update.

Returns

bool

True if the map was updated; otherwise, false.

Events

MachiningStepBuilt

Event triggered when a machining step is built.

public event MachiningActRunner.MachiningStepBuiltDelegate MachiningStepBuilt

Event Type

MachiningActRunner.MachiningStepBuiltDelegate

MachiningStepSelected

Event triggered when a machining step is selected.

public event Action<MachiningStep> MachiningStepSelected

Event Type

Action<MachiningStep>

OnCurrentLineEnd

Event raised when the current line ends. The event buffer is cleared on every line change.

public event Action<CancellationToken> OnCurrentLineEnd

Event Type

Action<CancellationToken>

SourcedActEntry

Event triggered for each SourcedActEntry produced during NC/CSV execution.

public event Action<SourcedActEntry> SourcedActEntry

Event Type

Action<SourcedActEntry>

SyntaxPieceRan

Event triggered when a syntax piece has been executed.

public event Action<SyntaxPiece> SyntaxPieceRan

Event Type

Action<SyntaxPiece>