Table of Contents

Class MachiningEquipment

Namespace
Hi.Machining.MachiningEquipmentUtils
Assembly
HiMech.dll

The runtime face of the machining equipment: the equipment a run moves — tool changes, collision detection, axis poses. It is built from a SetupEquipment by MaterialiseMachiningEquipment(string, IProgress<IMessage>, bool), which it keeps as its AuthoredFace, and has no XML form of its own: a value written to it is saved only where it reaches that face. Its MachiningChainFile and SpindleCapabilityFile are that face's, and a write of a member it takes from that face is raised as MemberReplaced, which LocalProjectService takes into the project's setup for the face it hands out.

An equipment file (root element MachiningEquipment) loads as a SetupEquipment: read it with XFactory.GenByFile<SetupEquipment>. Asked for as a MachiningEquipment or an IGetMachiningEquipment, XFactory answers the runtime face built from it, whose AuthoredFace is the saved one (ReadFromAuthoredXml(XElement, string, string, IProgress<IMessage>), registered by Reg(XFactory)).

A workpiece, fixture or machine chain belongs to one equipment face at a time: assigned to another face, it leaves this one, which forgets it and drops its attachments. The parts of AuthoredFace are shown here as the copies this face was built with: one of them written here stays with that face, and nothing changes.

public class MachiningEquipment : IMachiningEquipment, IMechanism, ITopo, IGetAsmb, IGetAnchor, IGetTopoIndex, IGetAnchoredDisplayeeList, IGetAnchorToSolidDictionary, IDisplayee, IExpandToBox3d, IGetProgramCl, IGetMachiningChain, IGetMachiningEquipment
Inheritance
MachiningEquipment
Implements
Inherited Members
Extension Methods

Constructors

MachiningEquipment()

Ctor.

public MachiningEquipment()

Properties

AmbientTemperature_C

Gets or sets the ambient temperature in Celsius. This is a convenience property that converts between Celsius and Kelvin.

public double AmbientTemperature_C { get; set; }

Property Value

double

AmbientTemperature_K

Gets or sets the ambient temperature in Kelvin. Runtime-stamped from the authored face at materialise; the authored value's home is AmbientTemperature_K. A write of another value raises MemberReplaced (AmbientTemperature).

public double AmbientTemperature_K { get; set; }

Property Value

double

Asmb

Asmb of the entire equipment.

public Asmb Asmb { get; }

Property Value

Asmb

AuthoredFace

The authored face this runtime face was built from (MaterialiseMachiningEquipment(string, IProgress<IMessage>, bool)): the project's SetupEquipment for the face LocalProjectService.MachiningEquipment hands out, the face read from the file for one XFactory read asked for as a MachiningEquipment (ReadFromAuthoredXml(XElement, string, string, IProgress<IMessage>)); null for a face built in code. It is the face that is saved and that a project holds, MachiningChainFile and SpindleCapabilityFile are read and written on it, and it keeps the machine-body and fixture solids this face shares with it alive.

public SetupEquipment AuthoredFace { get; }

Property Value

SetupEquipment

BackgroundTemperature_C

Source-compatible delegate of AmbientTemperature_C.

[Obsolete("Renamed to AmbientTemperature_C.")]
public double BackgroundTemperature_C { get; set; }

Property Value

double

BackgroundTemperature_K

Source-compatible delegate of AmbientTemperature_K.

[Obsolete("Renamed to AmbientTemperature_K.")]
public double BackgroundTemperature_K { get; set; }

Property Value

double

CoolantHeatCondition

Gets or sets the coolant heat condition settings. Runtime-stamped from the authored face at materialise (shared reference — the runtime only reads it); the authored home is CoolantHeatCondition. A write of another object raises MemberReplaced (CoolantHeatCondition).

public CoolantHeatCondition CoolantHeatCondition { get; set; }

Property Value

CoolantHeatCondition

Fixture

Fixture. A fixture another equipment face holds leaves that face (the face forgets it and drops its attachments) before this face takes it; the fixture of AuthoredFace stays with that face, and the write changes nothing. A write of another fixture raises MemberReplaced (Fixture).

public Fixture Fixture { get; set; }

Property Value

Fixture

MachiningChain

Body of the equipment. A machine chain another equipment face holds leaves that face (the face forgets it and drops its attachments) before this face takes it; the chain of AuthoredFace stays with that face, and the write changes nothing. A write of another chain raises MemberReplaced (MachiningChain).

public IMachiningChain MachiningChain { get; set; }

Property Value

IMachiningChain

MachiningChainFile

The file of the machine chain: MachiningChainFile of AuthoredFace, read and written there. A write of another name raises MemberReplaced (MachiningChainFile). Null while the face has no authored face, which a write then refuses (InvalidOperationException).

public string MachiningChainFile { get; set; }

Property Value

string

MachiningTool

Milling tool.

public IMachiningTool MachiningTool { get; set; }

Property Value

IMachiningTool

SpindleCapability

Gets or sets the spindle capability configuration. Runtime-stamped from the authored face at materialise (shared reference — the runtime only reads it); the authored home is SpindleCapability. A write of another object raises MemberReplaced (SpindleCapability).

public SpindleCapability SpindleCapability { get; set; }

Property Value

SpindleCapability

SpindleCapabilityFile

The file of the spindle capability: SpindleCapabilityFile of AuthoredFace, read and written there. A write of another name raises MemberReplaced (SpindleCapabilityFile). Null while the face has no authored face, which a write then refuses (InvalidOperationException).

public string SpindleCapabilityFile { get; set; }

Property Value

string

TableToComp

Transformer of the attachment branch from the machine's worktable end to the workpiece-side mount: the fixture's table mount when a fixture is mounted, otherwise the workpiece's fixture mount. Stamped from the authored face at materialise; applied by Rewire(), so it takes effect whenever that branch exists and is simply kept while it does not. Every write rewires and raises MemberReplaced (TableToComp), the same transformer written again included.

public ITransformer TableToComp { get; set; }

Property Value

ITransformer

Workpiece

Workpiece. A workpiece another equipment face holds leaves that face (the face forgets it and drops its attachments) before this face takes it; the workpiece of AuthoredFace stays with that face, and the write changes nothing. A write of another workpiece raises MemberReplaced (Workpiece).

public Workpiece Workpiece { get; set; }

Property Value

Workpiece

WorkpieceCollidable

Collidable face of the running workpiece: its meshed geometry, in the GeomAnchor frame the mesh is built and drawn in. Set by the runtime service layer, as WorkpieceDisplayee; null on the authored face and while no workpiece is mounted. The collision index reads the workpiece side of every collision pair through it (GetCollidable()), so a pair against the workpiece is evaluated only while this is set.

public ICollidable WorkpieceCollidable { get; set; }

Property Value

ICollidable

WorkpieceDisplayee

Displayee for workpiece rendering. Set by the runtime service layer.

public IDisplayee WorkpieceDisplayee { get; set; }

Property Value

IDisplayee

XName

Name for XML IO: the equipment element's, XName. The runtime face has no XML form of its own: the element is read as a SetupEquipment, or as this face by ReadFromAuthoredXml(XElement, string, string, IProgress<IMessage>), and written by that face.

public static string XName { get; }

Property Value

string

Methods

CommitToAuthoredFace()

Internal Use Only. Writes onto AuthoredFace what was written on this face since it was built (what raised MemberReplaced): a workpiece, fixture, machine chain or table transformer written moves there — a part leaves this face —, an ambient temperature, spindle capability or coolant heat condition written is written there. The two file names are that face's already; the tool, and a part another face took since, are not written. What was written is forgotten then.

public void CommitToAuthoredFace()

Exceptions

InvalidOperationException

The face has no authored face (one built in code).

Detect(bool)

Performs collision detection.

public MechCollisionResult Detect(bool addFluteAndWorkpieceDetection)

Parameters

addFluteAndWorkpieceDetection bool

Whether to include flute and workpiece in detection.

Returns

MechCollisionResult

Significant collision result.

Remarks

One native crossing per call (play-core migration P12): DetectNative(List<CollisionIndexPair>, Asmb, Anchor, Func<CollisionIndexPair, bool>, out Dictionary<ICollidable, CollisionFlag>, out CollisionFlag) resolves every pair into a record and collision__detect_pairs runs the licence pass, the anchor map, the poses, the memo, the tree checks and the fold, where the managed loop crossed once per pair and twice more for the map and the licence. The licence is the export's answer (status 1: no result, as the managed check answered null, and no pair touched – the workpiece reset went into the records, not the objects); the managed loop stays as the oracle and runs only when the batch cannot (status -1: two or more distinct cube trees among the collidees, whose gate is one frame per thread – no shipped scene) or when a test forces it (Hi.Collision.MechCollisionUtil.ForceManagedPath), with the licence check, the workpiece reset and the loop as before; Hi.Collision.MechCollisionUtil.PathTaken says which ran. A pair whose anchor is unbound is skipped on both paths, like one off the chain.

Display(Bind)

Display function called in DispEngine rendering loop.

public void Display(Bind bind)

Parameters

bind Bind

Bind with DispEngine. See Bind.

ExpandToBox3d(ref box3d_t)

Expands the destination box. This function is usually used to compute the bounding box of elements. box3d_t is a value type, so the destination is passed by reference (the C++ expand_to_box3d(box3&) shape); an implementation writes dst = dst.Expanded(...) or forwards ref dst to its parts.

public void ExpandToBox3d(ref box3d_t dst)

Parameters

dst box3d_t

Destination box, expanded in place

GetAnchor()

Get key anchor. (i.e. root anchor)

public Anchor GetAnchor()

Returns

Anchor

key anchor

GetAnchorToSolidDictionary()

The machine chain's solid dictionary; an own, empty one while no chain is mounted.

public Dictionary<Anchor, Solid> GetAnchorToSolidDictionary()

Returns

Dictionary<Anchor, Solid>

The live dictionary.

GetAnchoredDisplayeeList()

Gets a list of anchored displayable objects.

public List<IAnchoredDisplayee> GetAnchoredDisplayeeList()

Returns

List<IAnchoredDisplayee>

A list of IAnchoredDisplayee objects

GetAsmb()

Gets the key asmb.

public Asmb GetAsmb()

Returns

Asmb

The key asmb.

GetMachiningChain()

Gets the machining chain instance.

public IMachiningChain GetMachiningChain()

Returns

IMachiningChain

The machining chain instance.

GetMachiningEquipment()

Get the runtime MachiningEquipment.

public MachiningEquipment GetMachiningEquipment()

Returns

MachiningEquipment

MachiningEquipment

GetProgramCl()

Get CL (Cutter Location). Where Point is tool tip position; Normal is tool orientation.

public dvec3d_t? GetProgramCl()

Returns

dvec3d_t?

CL; null when no CL is available (e.g. no workpiece or no tool is mounted).

IsCollisionRed(object)

Whether the latest Detect(bool) pass flagged item as colliding. Display paths use this through CollisionRedScope to paint the part red.

public bool IsCollisionRed(object item)

Parameters

item object

A displayed item (typically a Solid).

Returns

bool

true if the item is currently collision-red.

PrepareCollidableItems()

Prepares all collidable items for collision detection. This method should be called before performing collision detection.

public void PrepareCollidableItems()

ReadFromAuthoredXml(XElement, string, string, IProgress<IMessage>)

The legacy reading of an equipment element, what XFactory answers when asked for a MachiningEquipment or an IGetMachiningEquipment (Reg(XFactory)): src is read as a SetupEquipment, the authored face, exactly as XFactory.Gen<SetupEquipment> reads it, and the runtime face is built from that face (MaterialiseMachiningEquipment(string, IProgress<IMessage>, bool) against the element's own directory — baseDirectory with the directory of relFile — with the error terms on); its AuthoredFace is the authored face.

public static MachiningEquipment ReadFromAuthoredXml(XElement src, string baseDirectory, string relFile, IProgress<IMessage> progress)

Parameters

src XElement

The equipment element.

baseDirectory string

The base directory the element's relative paths resolve against.

relFile string

The relative file path of the element's file; null for an inline element.

progress IProgress<IMessage>

Progress reporter for the diagnostics of the read. The build of the runtime face reports nothing here: it reads again what the read reported on.

Returns

MachiningEquipment

The runtime face, never null.

Reg(XFactory)

Registers the equipment's deserializers with the given XFactory, as Reg(XFactory) does: the equipment element and every part it holds, and the legacy reading of the element (TypedGenerators) — the XName element and its legacy alias MillingEquipment, asked for as a MachiningEquipment or an IGetMachiningEquipment, are read by ReadFromAuthoredXml(XElement, string, string, IProgress<IMessage>). Idempotent.

public static void Reg(XFactory factory = null)

Parameters

factory XFactory

ResetCollisionFlags()

Resets all collision flags to their default states. This should be called after collision detection is complete, and by a runtime reset so no part stays painted red.

public void ResetCollisionFlags()

Rewire()

Rebuilds the attachment branches between the parts from their current roles (EquipmentWiring). The part setters and the TableToComp setter call it; call it after rebinding a role anchor of a mounted part in place.

public void Rewire()

Tooling(int, MachiningToolHouse)

Set MachiningTool by toolId and toolHouse.

public bool Tooling(int toolId, MachiningToolHouse toolHouse)

Parameters

toolId int

tool ID

toolHouse MachiningToolHouse

tool house

Returns

bool

true if tool changed; otherwise, false.

Exceptions

ToolNotFoundException

Throw If toolId does not exist on toolHouse.

TryGetTransformFromRootToProgramZero(out mat4d_t)

Gets the transform matrix from the root coordinate system to the program zero coordinate system.

public bool TryGetTransformFromRootToProgramZero(out mat4d_t mat)

Parameters

mat mat4d_t

A 4x4 transformation matrix representing the coordinate system transformation, when the method returns true.

Returns

bool

False when no chain is mounted, no Workpiece is equipped or its program-zero anchor is unbound, or no branch chain connects the root to it.

Events

MemberReplaced

Raised after a write replaced a member of this face that comes from its AuthoredFace — the workpiece, fixture, machine chain or table transformer, the ambient temperature, spindle capability or coolant heat condition, the machine-chain or spindle-capability file (EquipmentMember) — once the face has rewired and stamped its collision indices. A write that leaves the member as it was (the same object, an equal value or file name) raises nothing, except on TableToComp, whose every write rewires and raises it. The tool raises nothing (MachiningTool, Tooling(int, MachiningToolHouse)), nor does a part another face takes from this one, nor a part of AuthoredFace written here. Handlers run in the order they subscribed: LocalProjectService, which subscribes as it builds the face it hands out, has its setup take a part written there with no session alive, so a handler after it reads that member null.

public event Action<MachiningEquipment, EquipmentMember> MemberReplaced

Event Type

Action<MachiningEquipment, EquipmentMember>