Table of Contents

Class SetupEquipment

Namespace
Hi.Machining.MachiningEquipmentUtils
Assembly
HiMech.dll

The authored face of the machining equipment: the machine chain, workpiece, fixture, environment data and the tool selection of the setup, with the XML IO. It is the equipment a project file and an equipment file hold; the runtime face (MachiningEquipment) is built from it by MaterialiseMachiningEquipment(string, IProgress<IMessage>, bool) and is never saved.

Its XML element is named MachiningEquipment (see XName): read an equipment file with XFactory.GenByFile<SetupEquipment>. Asked for as a MachiningEquipment or an IGetMachiningEquipment, XFactory answers the runtime face built from the file, whose AuthoredFace is this face (ReadFromAuthoredXml(XElement, string, string, IProgress<IMessage>)).

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 (PartTaken). A runtime face built from this one shows its parts as copies; one of them written there stays here.

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

Constructors

SetupEquipment()

Ctor.

public SetupEquipment()

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

Initializes a new instance of the SetupEquipment class from XML data.

public SetupEquipment(XElement src, string baseDirectory, string relFile, IProgress<IMessage> progress)

Parameters

src XElement

The XML element containing the equipment configuration.

baseDirectory string

The base directory for resolving relative file paths.

relFile string

The relative file path for XML serialization.

progress IProgress<IMessage>

Progress reporter for diagnostic messages emitted during construction.

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: the shop-floor temperature the workpiece, cutter, chips and spindle start at and the spindle cools toward. The cutting zone itself convects to CoolantTemperature_K. Serialized as AmbientTemperature_C; the pre-rename element BackgroundTemperature_C is still read.

public double AmbientTemperature_K { get; set; }

Property Value

double

Asmb

Asmb of the entire authored equipment topology.

public Asmb Asmb { get; }

Property Value

Asmb

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 (coolant temperature and the convection coefficients). Constructed with the StandardWaterSolubleCoolant values, and XML reading only ever replaces the instance, so it is never null on a well-formed loaded project: a project that never touches it — a dry-cutting machine included — is modelled with water-soluble flood coolant whenever the NC program turns coolant on. Pick StandardForcedAir for such a machine.

public CoolantHeatCondition CoolantHeatCondition { get; set; }

Property Value

CoolantHeatCondition

CoolantHeatConditionFile

Gets or sets the file path of the coolant heat condition (WorkpieceMaterial pattern: when set, XML IO externalizes CoolantHeatCondition to this side-file; when null the condition serializes inline).

public string CoolantHeatConditionFile { get; set; }

Property Value

string

Fixture

Fixture. A fixture another equipment face holds leaves that face (the face forgets it and drops its attachments) before this face takes it.

public Fixture Fixture { get; set; }

Property Value

Fixture

MachiningChain

Body of the equipment — the authored machine topology instance. The runtime face gets its own instance from MaterialiseMachiningEquipment(string, IProgress<IMessage>, bool); the two never share graph objects (only leaf Solid geometry is shared). A machine chain another equipment face holds leaves that face (the face forgets it and drops its attachments) before this face takes it.

public IMachiningChain MachiningChain { get; set; }

Property Value

IMachiningChain

MachiningChainFile

Gets or sets the file path of the solid machining chain. This is used for XML serialization and file management.

public string MachiningChainFile { get; set; }

Property Value

string

MachiningTool

The Setup-page selected tool (persisted as the project's <MillingTool>). Never the tool-house instance itself — see Tooling(int, MachiningToolHouse).

public IMachiningTool MachiningTool { get; set; }

Property Value

IMachiningTool

SpindleCapability

Gets or sets the spindle capability configuration. This defines the operational capabilities and limits of the spindle.

public SpindleCapability SpindleCapability { get; set; }

Property Value

SpindleCapability

SpindleCapabilityFile

Gets or sets the file path of the spindle capability configuration. This is used for XML serialization and file management.

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. Persisted here; applied by Rewire(), so it takes effect whenever that branch exists and is simply kept while it does not.

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.

public Workpiece Workpiece { get; set; }

Property Value

Workpiece

WorkpieceCollidable

Collidable face of the workpiece. Unused on the authored face: only the runtime face detects collisions, and its service layer sets it there.

public ICollidable WorkpieceCollidable { get; set; }

Property Value

ICollidable

WorkpieceDisplayee

Displayee for workpiece rendering. Optional on the authored face — setup views typically draw the workpiece through their own display composition instead.

public IDisplayee WorkpieceDisplayee { get; set; }

Property Value

IDisplayee

XName

Name for XML IO. Pinned to the shipped wire name “MachiningEquipment” — the type was split off the runtime face, the file layout was not.

public static string XName { get; }

Property Value

string

Methods

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.

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).

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.

MaterialiseMachiningEquipment(string, IProgress<IMessage>, bool)

Builds the runtime face from this authored face: a fresh MachiningEquipment whose topology is an XML round-trip copy of this one (chain, fixture, workpiece, table transformer, tool), with the heavy machine-body and fixture Solid instances SHARED (this face keeps their lifecycle), the workpiece's geometry duplicated and its material and cutting parameter the same objects — never read again from their side files, which are this face's wherever they resolve —, axis poses copied, and the environment data stamped by reference. Its AuthoredFace is this face. Information flows one way but for the two file names and the shared objects: an assignment on the returned instance reaches this one only through its MachiningChainFile and SpindleCapabilityFile, which are this face's (and through CommitToAuthoredFace() when asked to); a field written in place on its workpiece's material or cutting parameter, its spindle capability or its coolant heat condition is written on this face's object, the same one.

The error terms of the machine follow enableErrorTerms, the project switch (EnableErrorTerms). On, the runtime face carries the copied transformers of the branches marked IsErrorTerm, so the machine moves with its errors. Off, every marked branch of the returned face — anywhere in its topology, a role branch included — carries a NoTransform of its own, so the machine is the nominal machine; the mark stays on the branch, and this authored face keeps the authored values. A role branch that is marked is not skipped: it is refused by name where a run starts and where the chain is solved on (RequireRoleBranchesNotErrorTerm(IMachiningChain)).

public MachiningEquipment MaterialiseMachiningEquipment(string baseDirectory, IProgress<IMessage> progress, bool enableErrorTerms = true)

Parameters

baseDirectory string

The project base directory this equipment's relative paths (e.g. MachiningChainFile) resolve against.

progress IProgress<IMessage>

Progress reporter for diagnostics during the copy.

enableErrorTerms bool

The project switch for the error terms: true (the default) keeps the transformers of the marked branches on the runtime face; false takes each marked branch as NoTransform there.

Returns

MachiningEquipment

The materialised runtime equipment.

Reg(XFactory)

Registers this type's deserializer with the given XFactory and chains Reg(factory) on dependents. Idempotent.

public static void Reg(XFactory factory = null)

Parameters

factory XFactory

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)

Selects the Setup-page tool by toolId from toolHouse. The authored face never hosts the tool-house instance itself: the runtime face equips house instances (and mutates their tessellation mid-run), and one tool's Asmb cannot live in two topologies — so this hosts a private duplicate. Clear the selection (“do not show”) by setting MachiningTool to null.

public bool Tooling(int toolId, MachiningToolHouse toolHouse)

Parameters

toolId int

tool ID

toolHouse MachiningToolHouse

tool house

Returns

bool

true if the selection 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

PartTaken

Internal Use Only. Raised after another equipment face took a workpiece, fixture or machine chain of this face (a part belongs to one face at a time): the member it was, the part, and the face that took it, which holds it. This face has forgotten it and dropped its attachments. Not raised for a part this face's own setter replaced.

public event Action<EquipmentMember, object, IMachiningEquipment> PartTaken

Event Type

Action<EquipmentMember, object, IMachiningEquipment>