Hide menu
Loading...
Searching...
No Matches
cadex::ModelData_Model Class Reference

Provides CAD Exchanger data model. More...

#include <cadex/ModelData_Model.hxx>

Classes

class  CombinedElementVisitor
 Provides combined methods VisitEnter() and VisitLeave() to visit all elements. More...
 
class  ElementIterator
 Iterator over scene graph elements. More...
 
class  ElementVisitor
 Defines a visitor of the scene graph elements. More...
 
class  LayerVisitor
 Defines a visitor of the layers. More...
 
class  VoidElementVisitor
 Element visitor with empty implementation. More...
 

Public Types

enum  FileFormatType { Xml , Binary }
 Defines file format used to store model contents. More...
 

Public Member Functions

 ModelData_Model (const Base_UTF16String &theName=Base_UTF16String())
 Constructor.
 
 ~ModelData_Model ()
 Destructor.
 
void Merge (const ModelData_Model &theSrcModel, const Base_ProgressStatus &theProgressStatus=Base_ProgressStatus())
 Adds all roots of another model to the current model.
 
void SetName (const Base_UTF16String &theName)
 Sets a model name.
 
const Base_UTF16StringName () const
 Returns a model name.
 
bool Open (const Base_UTF16String &theFileName, bool theToAppend=false, const Base_ProgressStatus &theProgressStatus=Base_ProgressStatus())
 Loads the model object from the file.
 
bool Save (const Base_UTF16String &theFileName, const Base_ProgressStatus &theProgressStatus=Base_ProgressStatus()) const
 
bool Save (const Base_UTF16String &theFileName, FileFormatType theFormat, const Base_ProgressStatus &theProgressStatus=Base_ProgressStatus()) const
 
bool Save (const Base_UTF16String &theFileName, const ModelData_WriterParameters &theParameters, const Base_ProgressStatus &theProgressStatus=Base_ProgressStatus()) const
 Saves the model object to a file.
 
void Clear ()
 Clears the model contents.
 
bool IsEmpty () const
 Returns true if the model is empty.
 
void AssignUuids ()
 
const ModelData_SceneGraphElementAddRoot (const ModelData_SceneGraphElement &theElement)
 Adds new root element into the scene graph.
 
bool RemoveRoot (const ModelData_SceneGraphElement &theElement)
 Removes root scene graph element from the model.
 
size_t NumberOfRoots () const
 Returns number of root elements in the graph.
 
void SetDrawing (const ModelData_Drawing &theDrawing)
 Sets the drawing of the model.
 
ModelData_Drawing Drawing () const
 Returns the drawing of the model.
 
void AddLayer (const ModelData_Layer &theLayer)
 
void Accept (ElementVisitor &theVisitor) const
 Accepts a visitor.
 
void Accept (LayerVisitor &theVisitor) const
 
internal::ModelData_ModelImpl * Impl () const
 Returns an implementation object (reserved for internal use).
 
void AddProperties (const ModelData_PropertyTable &theProperties)
 Allows to add properties to property table of ModelData_Model class.
 
ModelData_PropertyTable Properties () const
 Allows to get property table from ModelData_Model class.
 

Detailed Description

Provides CAD Exchanger data model.

The model encapsulates a scene graph (hierarchy of assemblies and parts) and is thus an entry point to entire 3D model data.

A model contains a shared pointer to its internal implementation, so simple copying an object will just copy a shared pointer:

ModelData_Model aModel2 = aModel; //both objects will point to the same contents
Provides CAD Exchanger data model.
Definition: ModelData_Model.hxx:43

The model object can be saved to and restored from a file in native CAD Exchanger format. Currently binary format is used as a file type.

bool anIsOk = aModel.Save ("mydocument.cdx");
ModelData_Model aNewModel;
anIsOk = aNewModel.Open ("mydocument.cdx");
bool Open(const Base_UTF16String &theFileName, bool theToAppend=false, const Base_ProgressStatus &theProgressStatus=Base_ProgressStatus())
Loads the model object from the file.
Definition: ModelData_Model.cxx:477
See also
Product Structure
Examples
Eyeshot/conversion/MainForm.cs, MTKConverter/Program.cs, MTKConverter/main.cxx, Unigine/source/ModelImporter.cpp, Unity/Assets/Scripts/Editor/ModelExporterWizard.cs, Unity/Assets/Scripts/Editor/ModelLoaderWizard.cs, Unity/Assets/Scripts/ModelImporter.cs, Unity/Assets/Scripts/ModelLoader.cs, advgeom/brepsimplify/Program.cs, advgeom/brepsimplify/main.cxx, advgeom/meshsimplify/Program.cs, advgeom/meshsimplify/main.cxx, conversion/cdxwebconverter/Program.cs, conversion/cdxwebconverter/main.cxx, conversion/export/Program.cs, conversion/export/main.cxx, conversion/import/Program.cs, conversion/import/main.cxx, conversion/screenshot/Program.cs, conversion/screenshot/main.cxx, conversion/transfer/Program.cs, conversion/transfer/main.cxx, conversion/transferparams/Program.cs, conversion/transferparams/main.cxx, exploring/appearance/Program.cs, exploring/appearance/main.cxx, exploring/bom/Program.cs, exploring/bom/main.cxx, exploring/brepgeometry/Program.cs, exploring/breprepresentation/Program.cs, exploring/breprepresentation/main.cxx, exploring/configurations/Program.cs, exploring/configurations/main.cxx, exploring/drawings/Program.cs, exploring/drawings/main.cxx, exploring/layers/Program.cs, exploring/layers/main.cxx, exploring/pmi/Program.cs, exploring/pmi/main.cxx, exploring/polyrepresentation/Program.cs, exploring/polyrepresentation/main.cxx, exploring/propertytable/Program.cs, exploring/propertytable/main.cxx, exploring/transformations/Program.cs, exploring/transformations/main.cxx, helpers/shape_processor.cs, machining/dfm_analyzer/Program.cs, machining/dfm_analyzer/main.cxx, machining/feature_recognizer/Program.cs, machining/feature_recognizer/main.cxx, meshing/lods/Program.cs, meshing/lods/main.cxx, meshing/mefisto/Program.cs, meshing/mefisto/main.cxx, meshing/netgen/Program.cs, meshing/netgen/main.cxx, meshing/remeshing/Program.cs, meshing/remeshing/main.cxx, meshing/visualizationmesher/Program.cs, meshing/visualizationmesher/main.cxx, misc/logging/Program.cs, misc/logging/main.cxx, misc/progressindicator/Program.cs, misc/progressindicator/main.cxx, misc/progressindicatorgui/main.cxx, modeling/assembly/Program.cs, modeling/assembly/main.cxx, modeling/brep/Program.cs, modeling/brep/main.cxx, modeling/brepfeatures/Program.cs, modeling/brepfeatures/main.cxx, modeling/brepprimitives/Program.cs, modeling/brepprimitives/main.cxx, modeling/elementremoval/Program.cs, modeling/elementremoval/main.cxx, modeling/metadata/Program.cs, modeling/metadata/main.cxx, modeling/poly/Program.cs, modeling/poly/main.cxx, modification/coloring/Program.cs, modification/coloring/main.cxx, modification/renaming/Program.cs, modification/renaming/main.cxx, modification/rotation/Program.cs, modification/rotation/main.cxx, sheet_metal/dfm_analyzer/Program.cs, sheet_metal/dfm_analyzer/main.cxx, sheet_metal/feature_recognizer/Program.cs, sheet_metal/feature_recognizer/main.cxx, sheet_metal/unfolder/Program.cs, sheet_metal/unfolder/main.cxx, visualization/offscreen/Program.cs, visualization/offscreen/main.cxx, visualization/qtquick_qml/baseviewer/main.cxx, visualization/qtquick_qml/measurements/main.cxx, visualization/winforms/baseviewer/Program.cs, visualization/wpf/baseviewer/App.xaml.cs, visualization/wpf/pmiviewer/App.xaml.cs, visualization/wpf/selectionhandling/App.xaml.cs, wall_thickness/analyzer/Program.cs, wall_thickness/analyzer/main.cxx, wall_thickness/visualization/Program.cs, and wall_thickness/visualization/main.cxx.

Member Enumeration Documentation

◆ FileFormatType

Defines file format used to store model contents.

Deprecated:
Kept for preserving binary compatibility.
See also
ModelData_WriterParameters::FileFormatType.

Constructor & Destructor Documentation

◆ ModelData_Model()

cadex::ModelData_Model::ModelData_Model ( const Base_UTF16String theName = Base_UTF16String())

Constructor.

Creates an empty model. IsEmpty() returns true.

Member Function Documentation

◆ AddRoot()

◆ AssignUuids()

void cadex::ModelData_Model::AssignUuids ( )

Assigns uuid's (persistent id's) to scene graph elements and part representations (if not assigned yet).

Examples
MTKConverter/Program.cs, and MTKConverter/main.cxx.

◆ 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

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

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

See also
IsEmpty().
Examples
meshing/remeshing/Program.cs, and meshing/remeshing/main.cxx.

◆ 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.

◆ Merge()

void cadex::ModelData_Model::Merge ( const ModelData_Model theSrcModel,
const Base_ProgressStatus theProgressStatus = Base_ProgressStatus() 
)

Adds all roots of another model to the current model.

Adds roots from another model to current.

◆ Name()

◆ NumberOfRoots()

size_t cadex::ModelData_Model::NumberOfRoots ( ) const

◆ Open()

bool cadex::ModelData_Model::Open ( const Base_UTF16String theFileName,
bool  theToAppend = false,
const Base_ProgressStatus theProgressStatus = Base_ProgressStatus() 
)

Loads the model object from the file.

If theToAppend is true then appends to this model, otherwise resets it first.

The method can be called on a nullified model.

See also
Save().

◆ Properties()

ModelData_PropertyTable cadex::ModelData_Model::Properties ( ) const

Allows to get property table from ModelData_Model class.

The main purpose of this table is to store information about measurement units of the original read file.

You can get information about them from ModelData_PropertyTable using predefined keys:

ModelData_PropertyTable::OriginalLengthUnitPropertyName() ModelData_PropertyTable::OriginalAngleUnitPropertyName()

See more information on Measurement Units.

◆ RemoveRoot()

bool cadex::ModelData_Model::RemoveRoot ( const ModelData_SceneGraphElement theElement)

Removes root scene graph element from the model.

Returns true if removal took place and false otherwise.

Warning
A call to this function resulting in true value invalidates the instances of ModelData_Model::ElementVisitor and ModelData_Model::ElementIterator over model's roots, making further behavior of these objects undefined.
Examples
modeling/elementremoval/main.cxx.

◆ Save() [1/3]

bool cadex::ModelData_Model::Save ( const Base_UTF16String theFileName,
const Base_ProgressStatus theProgressStatus = Base_ProgressStatus() 
) const

Saves the model object to a CDX file.

Kept for preserving binary compatibility. Invokes ModelData_Model::Save(const Base_UTF16String&, const ModelData_WriterParameters&, const Base_ProgressStatus&);

Examples
MTKConverter/Program.cs, and MTKConverter/main.cxx.

◆ Save() [2/3]

bool cadex::ModelData_Model::Save ( const Base_UTF16String theFileName,
const ModelData_WriterParameters theParameters,
const Base_ProgressStatus theProgressStatus = Base_ProgressStatus() 
) const

Saves the model object to a file.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Any folders you specify in the output path that are not yet present in the filesystem will be created automatically.

Note
Saving the model in CDXWEB format is not supported for the WIN32 platform.
See also
Open().

◆ Save() [3/3]

bool cadex::ModelData_Model::Save ( const Base_UTF16String theFileName,
FileFormatType  theFormat,
const Base_ProgressStatus theProgressStatus = Base_ProgressStatus() 
) const

Saves the model object to a file. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Deprecated:
Kept for preserving binary compatibility. Invokes ModelData_Model::Save(const Base_UTF16String&, const ModelData_WriterParameters&, const Base_ProgressStatus&);

◆ SetName()

void cadex::ModelData_Model::SetName ( const Base_UTF16String theName)

Sets a model name.

Accepts a string as a unicode string.

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