Class Asmb
public class Asmb : IGetAsmb, IGetTopoIndex, IDisposable
- Inheritance
-
Asmb
- Implements
- Inherited Members
- Extension Methods
Constructors
Asmb()
Ctor.
public Asmb()
Asmb(Asmb)
Ctor.
public Asmb(Asmb parent)
Parameters
parent
Asmbparent
Asmb(Asmb, string)
Ctor.
public Asmb(Asmb parent, string name)
Parameters
Asmb(string)
Ctor.
public Asmb(string name)
Parameters
Properties
ChildAncs
Gets the collection of child anchors in this assembly.
public ThreadSafeSet<Anchor> ChildAncs { get; }
Property Value
ChildAsmbs
Gets the collection of child assemblies in this assembly.
public ThreadSafeSet<Asmb> ChildAsmbs { get; }
Property Value
Guid
GUID.
public Guid Guid { get; }
Property Value
Name
Name.
public string Name { get; set; }
Property Value
XName
Gets the XML name for the assembly.
public static string XName { get; }
Property Value
Methods
AllEnterReadLock()
Enters read locks for all thread-safe collections in the assembly.
public void AllEnterReadLock()
AllExitReadLock()
Exits read locks for all thread-safe collections in the assembly.
public void AllExitReadLock()
CallAsmb(XElement, string, Dictionary<Guid, Asmb>, Dictionary<Guid, Anchor>, Dictionary<Guid, Branch>)
Get asmb by the asmbXml
.
If the members of the target asmb do not exist on asmbs
or ancs
,
the members will be generated; otherwise, the existed members are applied.
public static Asmb CallAsmb(XElement asmbXml, string baseDirectory, Dictionary<Guid, Asmb> asmbs = null, Dictionary<Guid, Anchor> ancs = null, Dictionary<Guid, Branch> brns = null)
Parameters
asmbXml
XElementxml of asmb
baseDirectory
stringBase directory path for resolving relative paths
asmbs
Dictionary<Guid, Asmb>existed asmb map
ancs
Dictionary<Guid, Anchor>existed anc map
brns
Dictionary<Guid, Branch>existed branch map
Returns
- Asmb
asmb
Display(Bind, Anchor, params IGetRootAnchor[])
Display displayees
according to the GetAnchor().
The fixed anchor is root
.
If the element of displayees
is not IDisplayee or null Anchor, the element will be ignored.
public void Display(Bind bind, Anchor root, params IGetRootAnchor[] displayees)
Parameters
bind
Bindbind
root
Anchorfixed anchor
displayees
IGetRootAnchor[]element to be rendered
Display(Bind, Dictionary<Anchor, Mat4d>, params IGetRootAnchor[])
Display the displayees
according to map
.
If displayees
is null, do nothing.
public static void Display(Bind bind, Dictionary<Anchor, Mat4d> map, params IGetRootAnchor[] displayees)
Parameters
bind
Bindbind
map
Dictionary<Anchor, Mat4d>anchor to transformation map
displayees
IGetRootAnchor[]displayees
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Dispose(bool)
protected virtual void Dispose(bool disposing)
Parameters
disposing
bool
ExpandToBox3d(Box3d, Anchor, params IGetRootAnchor[])
Expands a bounding box to include the assembly.
public void ExpandToBox3d(Box3d dst, Anchor root, params IGetRootAnchor[] displayees)
Parameters
dst
Box3dThe bounding box to expand.
root
AnchorThe root anchor for the calculation.
displayees
IGetRootAnchor[]The displayable objects to include in the calculation.
GetAnchorByGuid(string, bool)
Finds an anchor in the assembly hierarchy by its GUID.
public Anchor GetAnchorByGuid(string guid, bool enableThreadSafe = true)
Parameters
guid
stringThe GUID of the anchor to find.
enableThreadSafe
boolIf true, uses thread-safe operations for accessing collections.
Returns
- Anchor
The anchor with the specified GUID, or null if not found.
GetAnchorChain(Anchor, Anchor)
Gets a chain of anchors from the head to the tail.
public List<Anchor> GetAnchorChain(Anchor head, Anchor tail)
Parameters
Returns
GetAnchoredDisplayeeList(Dictionary<Anchor, Solid>)
Gets a list of anchored displayable objects based on the provided anchor-to-solid mapping.
public List<IAnchoredDisplayee> GetAnchoredDisplayeeList(Dictionary<Anchor, Solid> anchorToSolidDictionary)
Parameters
anchorToSolidDictionary
Dictionary<Anchor, Solid>Dictionary mapping anchors to their corresponding solids.
Returns
- List<IAnchoredDisplayee>
A list of anchored displayable objects.
GetAsmb()
Gets the key asmb.
public Asmb GetAsmb()
Returns
- Asmb
The key asmb.
GetAsmbDraw(Anchor)
Gets an assembly drawing for visualization.
public AsmbDraw GetAsmbDraw(Anchor root)
Parameters
root
AnchorThe root anchor for the drawing.
Returns
- AsmbDraw
An assembly drawing object.
GetBox3d(Anchor, params IGetRootAnchor[])
Gets a bounding box for the assembly.
public Box3d GetBox3d(Anchor root, params IGetRootAnchor[] displayees)
Parameters
root
AnchorThe root anchor for the calculation.
displayees
IGetRootAnchor[]The displayable objects to include in the calculation.
Returns
- Box3d
A 3D bounding box containing the assembly.
GetBranchByGuid(string, bool)
Finds a branch in the assembly hierarchy by its GUID.
public Branch GetBranchByGuid(string guid, bool enableThreadSafe = true)
Parameters
guid
stringThe GUID of the branch to find.
enableThreadSafe
boolIf true, uses thread-safe operations for accessing collections.
Returns
- Branch
The branch with the specified GUID, or null if not found.
GetBranchChain(IGetAnchor, IGetAnchor)
Gets a chain of branches with their directions from the head anchor to the tail anchor.
public List<DirectionBranchPack> GetBranchChain(IGetAnchor head, IGetAnchor tail)
Parameters
head
IGetAnchorThe starting anchor of the chain.
tail
IGetAnchorThe ending anchor of the chain.
Returns
- List<DirectionBranchPack>
A list of direction-branch pairs representing the chain, or an empty list if no chain exists.
GetBranchsXml(IGetAnchor, string)
Gets the XML representation of all branches in the assembly starting from the specified root.
public XElement GetBranchsXml(IGetAnchor root, string baseDirectory)
Parameters
root
IGetAnchorThe root anchor to start from. If null, uses the first descendant anchor.
baseDirectory
stringThe base directory for file references.
Returns
- XElement
An XML element containing all branches in the assembly.
GetDescendantAnchorSet(bool)
Generate an anchor set from all descendant anchors.
public HashSet<Anchor> GetDescendantAnchorSet(bool enableThreadSafe = true)
Parameters
enableThreadSafe
bool
Returns
GetDescendantAnchors(bool)
Gets a list of all descendant anchors in the assembly hierarchy.
public List<Anchor> GetDescendantAnchors(bool enableThreadSafe = true)
Parameters
enableThreadSafe
boolIf true, uses thread-safe operations for accessing collections.
Returns
GetDescendantAsmbSet(bool)
Gets a set of all descendant assemblies in the assembly hierarchy.
public HashSet<Asmb> GetDescendantAsmbSet(bool enableThreadSafe = true)
Parameters
enableThreadSafe
boolIf true, uses thread-safe operations for accessing collections.
Returns
GetDescendantAsmbs(bool)
Gets a list of all descendant assemblies in the assembly hierarchy.
public List<Asmb> GetDescendantAsmbs(bool enableThreadSafe = true)
Parameters
enableThreadSafe
boolIf true, uses thread-safe operations for accessing collections.
Returns
GetDescendingName(Anchor)
Gets the descending name path for an anchor, combining assembly names with dashes.
public string GetDescendingName(Anchor anc)
Parameters
anc
AnchorThe anchor to get the descending name for.
Returns
- string
The full descending name path, or null if the anchor is not found in the assembly hierarchy.
GetDescendingName(Asmb)
Gets the descending name path for a child assembly, combining assembly names with dashes.
public string GetDescendingName(Asmb asmb)
Parameters
asmb
AsmbThe assembly to get the descending name for.
Returns
- string
The full descending name path, or null if the assembly is not found in the hierarchy.
GetHierarchyString()
Gets a string representation of the assembly hierarchy.
public string GetHierarchyString()
Returns
- string
A string describing the assembly hierarchy.
GetInnerBranchSet(bool)
Gets a set of branches that are internal to this assembly. A branch is considered internal if both its endpoints are anchors within this assembly.
public HashSet<Branch> GetInnerBranchSet(bool enableThreadSafe = true)
Parameters
enableThreadSafe
boolIf true, uses thread-safe operations for accessing collections.
Returns
GetMat4d(IGetAnchor, IGetAnchor)
Gets the transformation matrix between two anchors in the assembly.
public Mat4d GetMat4d(IGetAnchor root, IGetAnchor tail)
Parameters
root
IGetAnchorThe source anchor for the transformation.
tail
IGetAnchorThe target anchor for the transformation.
Returns
- Mat4d
The 4x4 transformation matrix from root to tail.
GetMat4dMap(IGetAnchor)
Gets a mapping of anchors to their transformation matrices relative to the root anchor.
public Dictionary<Anchor, Mat4d> GetMat4dMap(IGetAnchor root)
Parameters
root
IGetAnchorThe root anchor to calculate transformations from.
Returns
- Dictionary<Anchor, Mat4d>
A dictionary mapping anchors to their transformation matrices.
GetMat4dMapWithBlocks(IGetAnchor, params Anchor[])
Gets a mapping of anchors to their transformation matrices relative to the root anchor, excluding specified blocked anchors.
public Dictionary<Anchor, Mat4d> GetMat4dMapWithBlocks(IGetAnchor root, params Anchor[] blockeds)
Parameters
root
IGetAnchorThe root anchor to calculate transformations from.
blockeds
Anchor[]Array of anchors to exclude from the calculation.
Returns
- Dictionary<Anchor, Mat4d>
A dictionary mapping anchors to their transformation matrices.
ShowMat4dMap(Dictionary<Anchor, Mat4d>)
Show mat map in text on console.
public static void ShowMat4dMap(Dictionary<Anchor, Mat4d> map)
Parameters
map
Dictionary<Anchor, Mat4d>
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
ToXElement(IGetAnchor, string)
Converts the assembly to an XML element.
public XElement ToXElement(IGetAnchor root, string baseDirectory)
Parameters
root
IGetAnchorThe root anchor for the conversion.
baseDirectory
stringThe base directory for file references.
Returns
- XElement
An XML element representing the assembly.
ToXElement(string)
Converts the assembly to an XML element.
public XElement ToXElement(string baseDirectory)
Parameters
baseDirectory
stringThe base directory for file references.
Returns
- XElement
An XML element representing the assembly.