Table of Contents

Class Fixture

Namespace
Hi.NcMech.Fixtures
Assembly
HiMech.dll

A fixture: a mechanism that owns its key assembly, its root anchor and the solids hung on its anchors, and names which of its own anchors play the fixture's three roles — TableMount, where the machine's worktable end attaches; WorkpieceMount, where the workpiece attaches; and GeomAnchor, the anchor the fixture's own solid hangs on and the collision anchor. The topology between them is free: any anchors, branches and transformers the user builds. The equipment joins the roles to the other parts (EquipmentWiring); a role left unbound gets no attachment.

CreateDefault() makes the shape every fixture had before the topology became free: the root anchor is the geometry anchor and one NoTransform branch leads from it to each mount. A file without an embedded topology (no <Asmb>) seeds that shape and applies its legacy <Solid>, <GeomToTableTransformer> and <GeomToWorkpieceTransformer> elements (or the older spellings TableToWorkpieceTransformer and WorkpieceTransformer) onto it; writing always embeds the topology (MechanismXml) and names the three roles by anchor Guid.

The roles and the solids are kept apart: a role is a reference the fixture checks for one thing only — the anchor is inside its assembly — and the solids are the dictionary's, never touched by a role. A fixture can therefore be built in any order and live in any incomplete form — a role unbound, a geometry anchor carrying no solid — without an exception; whether it is complete is judged where it matters: the equipment attaches only the bound roles, the run start names a missing one, the web editor lists what is missing.

public class Fixture : IMechanism, ITopo, IGetAsmb, IGetAnchor, IGetTopoIndex, IGetAnchoredDisplayeeList, IGetAnchorToSolidDictionary, IDisplayee, IExpandToBox3d, IMakeXmlSource, IGetSolid, IDisposable, IAnchoredCollidableLeaf, IAnchoredCollidableNode, IAnchoredCollidableBased, ICollidable
Inheritance
Fixture
Implements
Inherited Members
Extension Methods

Constructors

Fixture()

Initializes an empty fixture: an assembly named DefaultAsmbName holding only the root anchor O, no solids, no role bound. Build the topology on it, or start from CreateDefault().

public Fixture()

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

Initializes a new instance of the Fixture class from XML: the embedded topology and roles when the element carries <Asmb>, otherwise the default shape with the legacy solid and transformer elements applied to it.

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

Parameters

src XElement

The XML element containing fixture data.

baseDirectory string

The base directory for resolving relative paths.

relFile string

The relative file path.

progress IProgress<IMessage>

Progress reporter for diagnostic messages emitted during construction.

Fields

DefaultAsmbName

The name of the key assembly of a fixture made by Fixture() or CreateDefault().

public const string DefaultAsmbName = "Fixture"

Field Value

string

XName

Name for XML IO.

public static string XName

Field Value

string

Properties

AnchorToSolid

The solids hung on the fixture's anchors; the live instance, edited in place.

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

Property Value

Dictionary<Anchor, Solid>

Asmb

The key assembly holding every anchor and branch of the fixture.

public Asmb Asmb { get; }

Property Value

Asmb

CollidableName

Gets the name of the collidable object.

public string CollidableName { get; }

Property Value

string

Geom

The geometry of Solid, edited in place. Assigning delegates to that solid; when the bound geometry anchor carries no solid yet, an own one is hung there to carry the geometry; with no geometry anchor bound there is nowhere to put it and the assignment does nothing (the fixture is incomplete).

public IGetStl Geom { get; set; }

Property Value

IGetStl

GeomAnchor

The anchor the fixture's solid hangs on — the collision anchor; null when unbound. As TableMount; it does not touch AnchorToSolid, so Solid is whatever the dictionary holds on the anchor it names, if anything.

public Anchor GeomAnchor { get; set; }

Property Value

Anchor

Exceptions

ArgumentException

The anchor is not inside Asmb.

Root

The root anchor the fixture is placed and drawn from.

public Anchor Root { get; }

Property Value

Anchor

Solid

The fixture's solid: the AnchorToSolid entry on GeomAnchor; null while no geometry anchor is bound or the anchor carries none. A read of the dictionary, nothing more.

public Solid Solid { get; }

Property Value

Solid

TableMount

The anchor the machine's worktable end attaches to; null when unbound. Assign any anchor of Asmb, or null, at any point of building the topology (see the completeness remarks on the class).

public Anchor TableMount { get; set; }

Property Value

Anchor

Exceptions

ArgumentException

The anchor is not inside Asmb.

ThemeColor

Default theme color used when rendering the fixture.

public static vec3d_t ThemeColor { get; }

Property Value

vec3d_t

WorkpieceMount

The anchor the workpiece attaches to; null when unbound. As TableMount.

public Anchor WorkpieceMount { get; set; }

Property Value

Anchor

Exceptions

ArgumentException

The anchor is not inside Asmb.

Methods

ClearGeomCache()

Update cache of Geom. The method is used after inner content of Geom is altered.

public void ClearGeomCache()

CreateDefault()

Creates a fixture in the default shape: the root anchor, named and bound as GeomAnchor and carrying an empty solid, with one NoTransform branch to TableMount and one to WorkpieceMount (each branch named after its mount).

public static Fixture CreateDefault()

Returns

Fixture

The new fixture.

Display(Bind)

Display function called in DispEngine rendering loop.

public void Display(Bind bind)

Parameters

bind Bind

Bind with DispEngine. See Bind.

Dispose()

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

public void Dispose()

Dispose(bool)

Disposes the solids this fixture created itself; a solid shared in by another holder is left to that holder.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

true when called from Dispose().

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

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.

GetAnchoredCollidableNode()

Gets the anchored collidable node associated with this object.

public IAnchoredCollidableNode GetAnchoredCollidableNode()

Returns

IAnchoredCollidableNode

The anchored collidable node.

GetAnchoredDisplayeeList()

The solids only, each on its anchor; a dictionary entry without a solid is skipped. The fixture's theme color is applied by Display(Bind).

public List<IAnchoredDisplayee> GetAnchoredDisplayeeList()

Returns

List<IAnchoredDisplayee>

The anchored solids.

GetAsmb()

Gets the key asmb.

public Asmb GetAsmb()

Returns

Asmb

The key asmb.

GetCollidableAnchor()

Gets the anchor associated with this collidable leaf.

public Anchor GetCollidableAnchor()

Returns

Anchor

The anchor for this collidable leaf.

GetCollidee()

Get ICollidee.

public ICollidee GetCollidee()

Returns

ICollidee

ICollidee

GetSolid()

Gets the solid geometry object.

public Solid GetSolid()

Returns

Solid

The solid geometry object.

HangSolid(Anchor, Solid)

Hangs solid on anchor as one of the fixture's own solids — the fixture disposes it with itself — replacing, and disposing, an own solid already there. The way a topology editor adds a solid to a fixture anchor, so ownership follows the dictionary entry.

public void HangSolid(Anchor anchor, Solid solid)

Parameters

anchor Anchor

The anchor to hang the solid on.

solid Solid

The solid to hang; not null.

Exceptions

ArgumentNullException

Either argument is null.

MakeXmlSource(string, string, bool)

Writes the topology in one MechanismXml section (every transformer inside its branch, every solid inside its entry) and the three roles as anchor references.

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 (or Default when factory is null). Idempotent.

public static void Reg(XFactory factory = null)

Parameters

factory XFactory