Hide menu
Loading...
Searching...
No Matches

Provides MTK data model. More...

#include <cadex/ModelData/Model.hxx>

Inheritance diagram for cadex::ModelData::Model:
cadex::BaseObject

Public Types

enum class  FileFormatType { MTK , MTKWEB }
 
- Public Types inherited from cadex::BaseObject
typedef std::shared_ptr< internal::BaseObjectImpl > ImplType
 

Public Member Functions

 Model ()
 Constructor.
 
 Model (const UTF16String &theName)
 Constructor.
 
void SetName (const UTF16String &theName)
 Sets a model name.
 
UTF16String Name () const
 Returns a model name.
 
bool IsEmpty () const
 Returns true if the model is empty.
 
void Clear ()
 Clears the model contents.
 
void AddRoot (const ModelElement &theElement)
 Adds a root element to the model.
 
const std::vector< ModelElement > & Roots () const
 Returns root elements of the model.
 
size_t NumberOfRoots () const
 Returns the number of root elements in the model.
 
void SetDrawing (const Drawing::Drawing &theDrawing)
 
Drawing::Drawing Drawing () const
 
void Merge (const Model &theModel)
 Adds roots from another model to current.
 
void AssignUuids ()
 Assigns uuid's (persistent id's) to scene graph elements and part representations (if not assigned yet).
 
void Accept (ModelElementVisitor &theVisitor) const
 Accepts a visitor.
 
bool Open (const UTF16String &theFileName, bool theToAppend=false, const ProgressStatus &theProgressStatus=ProgressStatus())
 
bool Save (const UTF16String &theFileName, const ProgressStatus &theProgressStatus=ProgressStatus()) const
 
bool Save (const UTF16String &theFileName, const FileFormatType &theFormat, const ProgressStatus &theProgressStatus=ProgressStatus()) const
 
- 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.
 

Protected Member Functions

 Model (const ImplType &theImpl)
 
- Protected Member Functions inherited from cadex::BaseObject
 BaseObject (const ImplType &theImpl)
 

Detailed Description

Constructor & Destructor Documentation

◆ Model() [1/2]

cadex::ModelData::Model::Model ( )

Constructor.

Creates an empty model. IsEmpty() returns true.

◆ Model() [2/2]

cadex::ModelData::Model::Model ( const UTF16String & theName)

Constructor.

Creates an empty model with name. IsEmpty() returns true.

Member Function Documentation

◆ AddRoot()

void cadex::ModelData::Model::AddRoot ( const ModelElement & theElement)

Adds a root element to the model.

This function adds theElement as a root element in the model. If the passed element is an instance of ModelData::Instance, it will be automatically nested in ModelData::Assembly.

See also
Roots(), NumberOfRoots().
Examples
MTKConverter/Program.cs.

◆ Clear()

void cadex::ModelData::Model::Clear ( )

Clears the model contents.

Detaches the model contents. Only cleans up contents of this object. Other copies of this object will remain unaffected. For instance, in the following code

Model aM1;
//... populate aM1;
Model aM2 = aM1;
aM1.Clear();
void Clear()
Clears the model contents.
Definition Model.cxx:191

the aM2 object will continue to have entire previous contents. Respectively, all previous pointers (e.g. to objects of BaseObject subclasses) remain valid.

See also
IsEmpty().

◆ IsEmpty()

bool cadex::ModelData::Model::IsEmpty ( ) const

Returns true if the model is empty.

Returns true if the model has no roots, i.e. NumberOfRoots() returns 0.

See also
Clear().
Examples
MTKConverter/Program.cs, and MTKConverter/main.cxx.

◆ Name()

◆ NumberOfRoots()

size_t cadex::ModelData::Model::NumberOfRoots ( ) const

Returns the number of root elements in the model.

See also
AddRoot(), Roots(), IsEmpty().

◆ Roots()

const std::vector< ModelElement > & cadex::ModelData::Model::Roots ( ) const

Returns root elements of the model.

This function returns the root elements of the model as a std::vector.

See also
AddRoot(), NumberOfRoots().

◆ SetName()

void cadex::ModelData::Model::SetName ( const UTF16String & theName)

Sets a model name.

Accepts a string as a unicode string.

See also
Name().
Examples
MTKConverter/Program.cs, and MTKConverter/main.cxx.