Hide menu
Loading...
Searching...
No Matches
cadex::ModelData::Assembly Class Reference

Defines a group of model element. More...

#include <cadex/ModelData/Assembly.hxx>

Inheritance diagram for cadex::ModelData::Assembly:
cadex::ModelData::ModelElement cadex::BaseObject

Public Member Functions

 Assembly (Initialized)
 
 Assembly (const UTF16String &theName)
 
const InstanceAddInstance (const ModelElement &theElement)
 Adds a new child element into the assembly.
 
const InstanceAddInstance (const Part &thePart, const UTF16String &theInstanceName=UTF16String())
 Adds a new part into the assembly.
 
const InstanceAddInstance (const Part &thePart, const Geom::Transformation &theTransformation, const UTF16String &theInstanceName=UTF16String())
 Adds a new part into the assembly.
 
const InstanceAddInstance (const Assembly &theAssembly, const UTF16String &theInstanceName=UTF16String())
 Adds a new assembly into the assembly.
 
const InstanceAddInstance (const Assembly &theAssembly, const Geom::Transformation &theTransformation, const UTF16String &theInstanceName=UTF16String())
 Adds a new assembly into the assembly.
 
bool RemoveInstance (const Instance &theInstance)
 Removes an instance from an assembly.
 
const std::vector< Instance > & Instances () const
 Returns a vector of instances.
 
size_t NumberOfInstances () const
 Returns number of instances in this assembly.
 
- Public Member Functions inherited from cadex::ModelData::ModelElement
void SetName (const UTF16String &theName)
 Sets a name.
 
UTF16String Name () const
 Returns a name.
 
void SetUuid (const Uuid &theUuid)
 Sets an object uuid.
 
cadex::Uuid Uuid () const
 Returns an object uuid.
 
void Accept (ModelElementVisitor &theVisitor) const
 Accepts an element visitor.
 
- Public Member Functions inherited from cadex::BaseObject
size_t Id () const
 Return unique identifier of public object.
 
internal::BaseObjectImpl * Impl () const
 
bool IsNull () const
 
 operator bool () const
 
template<typename T >
bool IsOfType () const
 
template<typename T >
T * Impl () const
 Reserved for internal use.
 

Static Public Member Functions

static bool CompareType (const BaseObject &theObject)
 Returns true if theObject is an assembly.
 
- Static Public Member Functions inherited from cadex::ModelData::ModelElement
static bool CompareType (const BaseObject &theObject)
 Returns true if theObject is a model element.
 

Additional Inherited Members

- Public Types inherited from cadex::BaseObject
typedef std::shared_ptr< internal::BaseObjectImpl > ImplType
 
- Protected Member Functions inherited from cadex::ModelData::ModelElement
 ModelElement (const ImplType &theImpl)
 
- Protected Member Functions inherited from cadex::BaseObject
 BaseObject (const ImplType &theImpl)
 

Detailed Description

Defines a group of model element.

Direct children of assembly are always instances which can refer to nested sub-assemblies or parts.

Member Function Documentation

◆ AddInstance()

const Instance & cadex::ModelData::Assembly::AddInstance ( const ModelElement & theElement)

Adds a new child element into the assembly.

Assemblies may only have instances as direct children. If theElement is not an instance (i.e. is a part or an assembly) then an interim instance is created which will refer to theElement.

If theElement is an instance then return it, otherwise returns a newly created instance.

Parts and assemblies may be added to multiple assemblies to be shared. However they must be referred by unique instances when adding to parent assemblies, i.e. each instance may not be added as a child into more than one assembly. Otherwise this will create an invalid model object which undefined subsequent behavior.

◆ NumberOfInstances()

size_t cadex::ModelData::Assembly::NumberOfInstances ( ) const

Returns number of instances in this assembly.

Returns 0 if IsNull().

◆ RemoveInstance()

bool cadex::ModelData::Assembly::RemoveInstance ( const Instance & theInstance)

Removes an instance from an assembly.

Returns a boolean value specifying whether the removal took place.

Warning
A call to this function resulting in true value invalidates the instances of ModelElementVisitor and ModelElementIterator over assembly's children, making further behavior of these objects undefined.