Table of Contents

Class ClMillingDevice

Namespace
HiMachining.Milling
Assembly
HiMech.dll

A milling device driven by CL(Cutter Location).

public class ClMillingDevice : IMachiningChain, IMechanism, ITopo, IGetAsmb, IGetAnchor, IGetTopoIndex, IGetAnchoredDisplayeeList, IGetAnchorToSolidDictionary, IMakeXmlSource, IGetCollisionIndexPairs
Inheritance
ClMillingDevice
Implements
Inherited Members
Extension Methods

Constructors

ClMillingDevice()

Ctor.

public ClMillingDevice()

ClMillingDevice(XElement, string, IProgress<IMessage>)

Initializes a new instance from XML.

public ClMillingDevice(XElement src, string baseDirectory, IProgress<IMessage> progress = null)

Parameters

src XElement

The XML source element.

baseDirectory string

The base directory for resolving relative paths.

progress IProgress<IMessage>

Progress reporter for diagnostic messages emitted while the topology is read; may be null.

Properties

AnchorToSolid

The solids hung on this device's anchors — the one live instance the IMechanism contract promises, edited in place. Empty by construction: the CL device carries no machine body, and MakeXmlSource(string, string, bool) does not persist it.

public Dictionary<Anchor, Solid> AnchorToSolid { get; }

Property Value

Dictionary<Anchor, Solid>

Cl

Gets or sets the current program cutter location in workpiece coordinates. The getter forwards GetProgramCl() of the equipment from MachiningEquipmentGetter: null when no workpiece or no tool is mounted. Setting null clears KeyTransformer; setting a location while no workpiece, no tool or no equipment is present leaves the device as it is. The tool frame of a new location is turned from the frame the previous location commanded, not from the pose read back through the equipment, so an error in the chain cannot feed itself; only the first location (a new device, or after ResetPose()) is seeded once by the pose read back, which keeps its frame orthonormal. The setter is TrySetCl(dvec3d_t, out ClDeviceLeg) with the missing leg thrown instead of named: a play never reaches the exception, as MachiningActRunner.ProcAct commands every cutter-location act through TrySetCl(dvec3d_t, out ClDeviceLeg) and skips the act on a missing leg with a message (Step-ProgramZero–Unreachable or Step-ToolTip–Unreachable); the exception is for a direct caller, which has no message channel and is better refused than left at the previous pose.

public dvec3d_t? Cl { get; set; }

Property Value

dvec3d_t?

Exceptions

InvalidOperationException

A location is set while the workpiece and the tool are present but no branch chain connects TableMount to the workpiece's program-zero anchor, or the tool tip to ToolMount.

KeyBranch

Gets the branch connecting table mount and tool mount.

public Branch KeyBranch { get; }

Property Value

Branch

KeyTransformer

An ITransformer driven by Cl. Null when KeyBranch is absent (a serialized device whose assembly carries no direct table-to-tool branch).

public DynamicFreeform KeyTransformer { get; set; }

Property Value

DynamicFreeform

MachiningEquipmentGetter

Runtime property. For managing CL.

public Func<MachiningEquipment> MachiningEquipmentGetter { get; set; }

Property Value

Func<MachiningEquipment>

MainAsmb

Main MainAsmb of this device.

public Asmb MainAsmb { get; }

Property Value

Asmb

McCodes

Gets the machine coordinate code sequence for decoding the MC array.

public string[] McCodes { get; }

Property Value

string[]

McTransformers

Gets the machine coordinate transformers.

public IDynamicRegular[] McTransformers { get; }

Property Value

IDynamicRegular[]

TableMount

Table mount.

public Anchor TableMount { get; }

Property Value

Anchor

ToolMount

Tool mount.

public Anchor ToolMount { get; }

Property Value

Anchor

XName

Name of XML element.

public static string XName { get; }

Property Value

string

Methods

GetAnchor()

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

public Anchor GetAnchor()

Returns

Anchor

key anchor

GetAnchorToSolidDictionary()

Gets a dictionary that maps Anchor objects to their corresponding Solid objects.

public Dictionary<Anchor, Solid> GetAnchorToSolidDictionary()

Returns

Dictionary<Anchor, Solid>

A dictionary where keys are anchors and values are their associated solids.

GetAnchoredDisplayeeList()

The solids of AnchorToSolid on their anchors — like the XYZABC machine, the device draws its solids only, no anchor glyphs.

public List<IAnchoredDisplayee> GetAnchoredDisplayeeList()

Returns

List<IAnchoredDisplayee>

The anchored solids; empty for a device without solids.

GetAsmb()

Gets the key asmb.

public Asmb GetAsmb()

Returns

Asmb

The key asmb.

GetCollisionIndexPairs()

Gets a collection of collision index pairs for collision detection.

public IEnumerable<CollisionIndexPair> GetCollisionIndexPairs()

Returns

IEnumerable<CollisionIndexPair>

A collection of CollisionIndexPair objects.

GetTableMount()

Gets the table mount anchor point.

public IGetAnchor GetTableMount()

Returns

IGetAnchor

The table mount anchor point.

GetToolMount()

Gets the tool mount anchor point.

public IGetAnchor GetToolMount()

Returns

IGetAnchor

The tool mount anchor point.

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

ResetPose()

Restores KeyTransformer to identity and forgets the last commanded location. The runtime-reset counterpart of re-homing an XYZABC machine tool: without it, a paused/aborted run leaves the device at its last executed cutter location, and the next session's tool-change step would stamp a cut at that stale position.

public void ResetPose()

TrySetCl(dvec3d_t, out ClDeviceLeg)

Commands the location cl as the Cl setter does when every leg of the chain it drives is there — TableMount to the workpiece's program-zero anchor, the tool tip to ToolMount, and the key branch between the two mounts — and otherwise names the missing leg in missingLeg and leaves the device as it is, the frame the previous location commanded included, so the next location that can be commanded turns from that frame. The form for a caller with a message channel of its own (MachiningActRunner.ProcAct skips the act and names the missing chain once); the setter throws on the same answers. The two leg queries are the ones the setter always made per location, so a caller that checks the chain through this method pays no query of its own on an intact chain; the first location (a new device, or after ResetPose()) is seeded by one more, the pose read back.

public bool TrySetCl(dvec3d_t cl, out ClDeviceLeg missingLeg)

Parameters

cl dvec3d_t

The cutter location in program-zero coordinates.

missingLeg ClDeviceLeg

The leg that is missing, or None when the location was commanded, and when there was nothing to command it on — no equipment, no workpiece program-zero role or no tool tip — which leaves the device as it is as well.

Returns

bool

True when the location was commanded.