Table of Contents

Class MachiningVolumeRemovalProc

Namespace
Hi.Machining
Assembly
HiMech.dll

Handles the machining volume removal process and related operations.

public class MachiningVolumeRemovalProc
Inheritance
MachiningVolumeRemovalProc
Inherited Members
Extension Methods

Remarks

A shell over the native mechmachiningmachining_step_proc_t (core.dll, machining_step_proc__* in Hi.Machining.NativeMachiningStep), which holds the step cache — the previous tip pose, the flute list and its (resolution, cutter) key, the program-zero legs of the workpiece instance — over the borrowed native ClMachiningValve, and reads the topology once per step: the legs, the step of every axis branch and the matrix map from the workpiece geometry anchor, under one shared lock. StepMotion(bool, double, mat4d_t?) hands the topology ids of the equipment's roles over and copies the answer into its MachiningVolumeRemovalProc.StepMotionSnapshot; what stays managed is what the record and the events need — the cutter object behind the key (for CutterChanged), the managed view of the flute list and the ProgramZeroLegs holder the steps share. The constructor creates the native procedure and the finalizer releases it; one instance is single-threaded: the shell thread calls StepMotion(bool, double, mat4d_t?), and ClearCache() is called by the shell thread or by the session thread while no play runs.

Constructors

MachiningVolumeRemovalProc(Func<MachiningEquipment>, Func<WorkpieceService>)

Initializes a new instance of the MachiningVolumeRemovalProc class.

public MachiningVolumeRemovalProc(Func<MachiningEquipment> machiningEquipmentGetter, Func<WorkpieceService> workpieceServiceGetter)

Parameters

machiningEquipmentGetter Func<MachiningEquipment>
workpieceServiceGetter Func<WorkpieceService>

Exceptions

OutOfMemoryException

The native procedure could not be allocated.

Properties

ClMachiningValve

Gets the CL machining valve used to control the machining process.

public ClMachiningValve ClMachiningValve { get; }

Property Value

ClMachiningValve

Methods

ClearCache()

Clears the internal cache, including the CL machining valve state and step-related caches: one native call clears the valve and the procedure's caches (the previous tip pose, the flute list and its key, the program-zero legs), and the managed views follow. The holder table (Hi.Machining.MachiningVolumeRemovalProc.ProgramZeroLegsTable) is not cleared: the procedure's holder index runs on, the next step's refresh appends the next holder, and an index a built step carries stays valid. The valve's remembered turn is kept, as the valve's own ClearState() keeps it: a new play resets it through ResetForNewPlay().

public void ClearCache()

~MachiningVolumeRemovalProc()

Releases the native procedure; the valve it borrowed is released by its own shell.

protected ~MachiningVolumeRemovalProc()

ResetForNewPlay()

Internal Use Only. The reset of a new play: ClearCache(), then the valve's remembered turn back to its constructed default (ResetRememberedTurn()). What MachiningActRunner.ResetStateAndClStrip calls — a load or reload, the player's reset and a mission script's runtime reset reach it — so that a play's first moving steps along the tool axis do not carry the turn the previous play of this procedure left, whichever program it played; a clear between two steps of one play (a missing chain, a cutter-location act skipped, the chain re-wired) calls ClearCache() alone and keeps the turn.

public void ResetForNewPlay()

StepAssignDummyAttach(WorkpieceService, ClStrip, dvec3d_t?)

Creates a dummy attachment point in the CL strip: a new position, then UpdateAttach(CbtrPickable) over it on the workpiece's cube tree. Public API that the play pipeline does not call: a played step's position is added by the step pipeline on the thread that plays the acts, and the pipeline's subtraction sets the position's attachment on the nodes the cut left without one.

public static ClStripPos StepAssignDummyAttach(WorkpieceService workpieceService, ClStrip clStrip, dvec3d_t? programCl)

Parameters

workpieceService WorkpieceService

Service that owns the workpiece to attach to.

clStrip ClStrip

The CL strip to add the attachment to.

programCl dvec3d_t?

The program CL point for the attachment; null when the step has none (the no-tool-tip snapshot), in which case Add(object, dvec3d_t?) takes the previous position's CL.

Returns

ClStripPos

The created CL strip position.

StepGetGeomBoolCache(ICutter, double, SeqPair<mat4d_t>, bool, bool?)

Gets a geometric boolean cache for the current step based on cutter and motion parameters.

public static GeomBoolCache StepGetGeomBoolCache(ICutter cutter, double stepPreferredCubeWidth, SeqPair<mat4d_t> seq, bool enableSweeping, bool? isFluteTouchingWorkpiece)

Parameters

cutter ICutter

The cutter to use for the operation.

stepPreferredCubeWidth double

The preferred cube width for discretization.

seq SeqPair<mat4d_t>

The sequence pair of transformation matrices.

enableSweeping bool

Whether to enable sweeping operation.

isFluteTouchingWorkpiece bool?

Optional flag indicating if the flute is touching the workpiece.

Returns

GeomBoolCache

A geometric boolean cache containing the operation data.

Remarks

Note that it is hard to know if flute is touching the workpiece by sweeping without making sweeping volume. Checking by non-sweeping geometry may miss the touching part of the sweeping volume. Hence isFluteTouchingWorkpiece should be kept null and be considered obsolete. There is no performance gain from that parameter.

Events

CutterChanged

Event that is triggered when the cutter is changed, providing the previous and current cutter.

public event Action<SeqPair<ICutter>> CutterChanged

Event Type

Action<SeqPair<ICutter>>