Table of Contents

Class GeneralMechanism

Namespace
Hi.Mech
Assembly
HiMech.dll

General Mechanism.

public class GeneralMechanism : IMakeXmlSource, ITopo, IGetAsmb, IGetAnchoredDisplayeeList, IGetAnchorToSolidDictionary, IAnchoredDisplayee, IGetAnchor, IGetTopoIndex, IDisplayee, IExpandToBox3d
Inheritance
GeneralMechanism
Implements
Inherited Members
Extension Methods

Remarks

The XML IO is according to self-contained principle.

Constructors

GeneralMechanism()

Initializes a new instance of the GeneralMechanism class.

public GeneralMechanism()

GeneralMechanism(XElement, string)

Initializes a new instance of the GeneralMechanism class from XML.

public GeneralMechanism(XElement src, string baseDirectory)

Parameters

src XElement

The XML element containing the mechanism data.

baseDirectory string

The base directory for resolving relative file paths.

Properties

AnchorToSolid

Gets the dictionary mapping anchors to their corresponding solids.

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

Property Value

Dictionary<Anchor, Solid>

Asmb

Gets the assembly containing the mechanism components.

public Asmb Asmb { get; }

Property Value

Asmb

Root

Gets the root anchor of the mechanism.

public Anchor Root { get; }

Property Value

Anchor

XName

Name for XML IO.

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

Expands the destination box. This function is usually used to compute the bounding box of elements.

public void ExpandToBox3d(Box3d dst)

Parameters

dst Box3d

Destination box

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

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.

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.