Table of Contents

Class Solid

Namespace
Hi.NcMech.Solids
Assembly
HiMech.dll

Represents a solid geometry object with display, collision detection, and STL capabilities. Provides thread-safe access to geometry data and caching mechanisms.

public class Solid : IGetTriTree, ICollidable, IGetCollidable, IDisplayee, IExpandToBox3d, IDisposable, IGetSolid, IUpdateByContent, IClearCache, IStlSource, IGetStl, IMakeXmlSource
Inheritance
Solid
Implements
Inherited Members
Extension Methods

Constructors

Solid()

Initializes a new instance of the Solid class.

public Solid()

Solid(IGetStl)

Initializes a new instance of the Solid class with the specified STL geometry source.

public Solid(IGetStl geom)

Parameters

geom IGetStl

The STL geometry source.

Solid(XElement, string)

Initializes a new instance of the Solid class from XML.

public Solid(XElement src, string baseDirectory)

Parameters

src XElement

The XML source element.

baseDirectory string

The base directory for resolving relative paths.

Fields

XName

Gets the XML element name for serialization.

public static string XName

Field Value

string

Properties

CollisionFlag

Gets or sets the collision flag indicating the collision state of this solid.

public CollisionFlag CollisionFlag { get; set; }

Property Value

CollisionFlag

Geom

Gets or sets the STL geometry source. Setting this property will clear the cached data.

public IGetStl Geom { get; set; }

Property Value

IGetStl

NativeSmoothTopoStl

Gets the native smooth topology STL representation. The data is created from the STL representation when first accessed.

public NativeTopoStld NativeSmoothTopoStl { get; }

Property Value

NativeTopoStld

NativeStl

Gets the native STL representation. The data is created from the STL representation when first accessed.

public NativeStl NativeStl { get; }

Property Value

NativeStl

Prepared

Gets or sets whether the solid geometry is prepared for use. Setting this to true will ensure all necessary data structures are initialized. Setting this to false will clear the cached data.

public bool Prepared { get; set; }

Property Value

bool

Stl

Gets the STL representation of the solid geometry. The STL data is cached after first access.

public Stl Stl { get; }

Property Value

Stl

TriTree

Gets the triangle tree representation for collision detection. The tree is built from the native STL data when first accessed.

public TriTree TriTree { get; }

Property Value

TriTree

Methods

ClearCache()

Manually clears the cached data if the content of Geom has changed. The cache determines the behavior of the Solid.

public void ClearCache()

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)

Releases the unmanaged resources and optionally releases the managed resources.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

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

GetCollidable()

public ICollidable GetCollidable()

Returns

ICollidable

The collidable object.

GetCollidee()

Get ICollidee.

public ICollidee GetCollidee()

Returns

ICollidee

ICollidee

GetSolid()

Gets the solid geometry object.

public Solid GetSolid()

Returns

Solid

The solid geometry object.

GetSourceGeom()

Gets the source geometry object.

public IGetStl GetSourceGeom()

Returns

IGetStl

The source geometry object.

GetStl()

Gets the STL geometry data.

public Stl GetStl()

Returns

Stl

The STL geometry object

GetTriTree()

Get TriTree.

public TriTree GetTriTree()

Returns

TriTree

TriTree

MakeXmlSource(string, string)

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)

Parameters

baseDirectory string

The base directory for resolving relative paths

relFile string

The relative file path for the XML source

Returns

XElement

An XML element representing the object's state

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

UpdateByContent()

Updates the object based on its current content.

public void UpdateByContent()