CAD Exchanger SDK
cadex::ModelData_PolyRepresentation Class Reference

Defines polygonal (faceted or tessellated) representation of part. More...

Inheritance diagram for cadex::ModelData_PolyRepresentation:
cadex::ModelData_Representation cadex::ModelData_BaseObject

Classes

class  Provider
 Provides polygonal representation. More...
 

Public Types

typedef cadex::internal::ModelData_PolyRepresentationImpl ImplType
 
- Public Types inherited from cadex::ModelData_Representation
typedef cadex::internal::ModelData_RepresentationImpl ImplType
 
- Public Types inherited from cadex::ModelData_BaseObject
typedef int IdType
 Defines a type identifier.
 

Public Member Functions

 ModelData_PolyRepresentation ()
 Constructor. More...
 
 ModelData_PolyRepresentation (initialized)
 
 ModelData_PolyRepresentation (ImplType *theImpl)
 
 ModelData_PolyRepresentation (const ModelData_BRepRepresentation &theRef, const ModelAlgo_BRepMesherParameters &theParameters=ModelAlgo_BRepMesherParameters(), bool theComputeImmediately=false)
 
 ModelData_PolyRepresentation (const ModelData_PolyShape &theNode)
 
void Add (const ModelData_PolyShape &theShape)
 Adds a polygonal shape.
 
const ModelData_PolyShapeList & Get () const
 Returns a resulting polygonal shape. More...
 
void AddProvider (const std::shared_ptr< Provider > &theProvider)
 Adds a model provider.
 
void Clear ()
 Discards associated data.
 
- Public Member Functions inherited from cadex::ModelData_Representation
 ModelData_Representation ()
 Constructor. More...
 
void Accept (ModelData_Part::RepresentationVisitor &theVisitor) const
 Accepts a representation visitor.
 
- Public Member Functions inherited from cadex::ModelData_BaseObject
 ModelData_BaseObject ()
 Constructor. More...
 
IdType TypeId () const
 Returns an object type id. More...
 
template<typename T >
bool IsOfType () const
 Returns true if the object has a type T. More...
 
void SetName (const Base_UTF16String &theName)
 Sets an object name. More...
 
Base_UTF16String Name () const
 Returns an object name. More...
 
void Nullify ()
 Resets reference to implementation object. More...
 
bool IsNull () const
 Returns true if the object is nullified. More...
 
 operator bool () const
 Casts the object to the bool type. More...
 
internal::ModelData_BaseObjectImpl * Impl () const
 Return a handle to backend (reserved for internal use).
 

Static Public Member Functions

static IdType GetTypeId ()
 

Additional Inherited Members

- Protected Member Functions inherited from cadex::ModelData_Representation
 ModelData_Representation (internal::ModelData_BaseObjectImpl *theImpl)
 Constructor (reserved for internal use).
 
- Protected Member Functions inherited from cadex::ModelData_BaseObject
 ModelData_BaseObject (const internal::ModelData_BaseObjectImpl *theImpl)
 Constructor (reserved for internal use).
 
 ModelData_BaseObject (const internal::ModelData_BaseObjectImpl *theImpl, const Base_UTF16String &theName)
 Constructor (reserved for internal use).
 
template<typename T >
T * GetOrCreateImpl ()
 Reserved for internal use.
 

Detailed Description

Defines polygonal (faceted or tessellated) representation of part.

Polygonal representation contains an approximated (facetted or tessellated) description of a part (ModelData_Part). A part may have none, one or multiple polygonal representations. In the latter case, they are to considered to define multiple level of details (or LOD's) of the part.

Root Vertex Set List

Polygonal representation contains ModelData_PolyShapeList, which is a list of vertex sets (ModelData_PolyVertexSet), returned by the Get() method. The polygonal representation may contain one or multiple vertex sets, for instance having distinct appearance settings (although for a part having a single representation it is much more common to attach an appearance to the part itself). An example of explicit appearance attached to each vertex set is given below. In this case a part contains one polygonal representation which in its turn contains several triangle sets each holding its own color (green or orange):

dm_multi_triangleset.png
Multiple triangle sets in one polygonal representation

.

The following example demonstrates how to iterate over root vertex sets:

ModelData_Part aPart = ...;
ModelData_PolyRepresentation aPoly = aPart.PolyRepresentation (ModelData_RM_Poly); //retrieve first (fine) poly
if (aPoly) {
const ModelData_PolyShapeList& aList = aPoly.Get(); //retrieve roots
for (ModelData_PolyShapeList::SizeType i = 0; i < aList.Size(); ++i) {
const ModelData_PolyVertexSet& aSet = aList[i];
//...
}
}

Polygonal Object Types

The following picture demonstrates each supported types:

faceset_256.png
Triangle set
ModelData_IndexedTriangleSet - a set of triangles
lineset_256.png
Polyline set
ModelData_PolyLineSet - a set of polylines
pointset_256.png
Point set
ModelData_PolyPointSet - a set of points

Creation

Bottom-up Creation

A polygonal representation is initially created with an empty list of vertex sets. Adding vertex sets is done with the help of ModelData_PolyRepresentation::Add() or provided in the constructor, for instance:

ModelData_IndexedTriangleSet aTS;
//invoke ModelData_IndexedTriangleSet API to populate the object...
ModelData_Part aPart (aPoly, "my_part");

Each subclass of ModelData_PolyVertexSet provides API to construct the respective object bottom-up.

Generation from B-Rep representation

A polygonal representation can be created from a B-Rep representation with the help of visulization or computational meshers. Refer to Meshing for further details.

ModelAlgo_BRepMesher is used underneath to create a polygonal representation. It may also be used explicitly, for instance, to create polygonal representations for all parts which have B-Rep representations and do not have polygonal representations:

ModelData_Model aModel = ...;
ModelAlgo_BRepMesher aMesher (ModelAlgo_BRepMesherParameters::Fine);
aMesher.Compute (aModel);
See also
ModelData_BRepRepresentation, Model Explorer, Meshing Example.
Examples:
assemblycreator/main.cxx, and modelexplorer/main.cxx.

Constructor & Destructor Documentation

◆ ModelData_PolyRepresentation()

cadex::ModelData_PolyRepresentation::ModelData_PolyRepresentation ( )

Constructor.

If theToInitialize is false then creates a null object (see IsNull()).

Member Function Documentation

◆ Get()

const ModelData_PolyShapeList & cadex::ModelData_PolyRepresentation::Get ( ) const

Returns a resulting polygonal shape.

If the object IsNull() then behavior is undefined.

Examples:
modelexplorer/main.cxx.