Defines precise Boundary Representation of part. More...
#include <cadex/ModelData_BRepRepresentation.hxx>
Classes | |
class | LayerIterator |
Iterator over subshape layers. More... | |
class | PMIDataIterator |
Iterator over added graphical elements. More... | |
class | SubshapeIterator |
Iterator over added subshapes. More... | |
Public Types | |
typedef cadex::internal::ModelData_BRepRepresentationImpl | ImplType |
![]() | |
typedef cadex::internal::ModelData_RepresentationImpl | ImplType |
![]() | |
typedef int | IdType |
Defines a type identifier. | |
Public Member Functions | |
ModelData_BRepRepresentation () | |
Constructor. | |
ModelData_BRepRepresentation (initialized) | |
Constructor. | |
ModelData_BRepRepresentation (ImplType *theImpl) | |
ModelData_BRepRepresentation (const ModelData_Shape &theShape) | |
Constructor. | |
ModelData_BRepRepresentation (const TopoDS_Shape &theShape) | |
ModelData_Shape | Add (const ModelData_Shape &theShape) |
Adds a root body (or bodies). | |
ModelData_Shape | Add (const TopoDS_Shape &theShape) |
const ModelData_BodyList & | Get () const |
Returns an associated topological object. | |
void | AddProvider (const std::shared_ptr< Provider > &theProvider) |
Adds a B-Rep model provider. | |
void | Clear () |
Discards associated data. | |
bool | HasSubshapes () const |
Returns true if there is at least one explicitly registered sub-shape. | |
size_t | NumberOfSubshapes () const |
Returns the number of registered sub-shapes. | |
void | SetName (const ModelData_Shape &theSubshape, const Base_UTF16String &theName) |
void | SetName (const TopoDS_Shape &theSubshape, const Base_UTF16String &theName) |
void | SetAppearance (const ModelData_Shape &theSubshape, const ModelData_Appearance &theAppearance) |
void | SetAppearance (const TopoDS_Shape &theSubshape, const ModelData_Appearance &theAppearance) |
void | SetPropertyTable (const ModelData_Shape &theSubshape, const ModelData_PropertyTable &thePTable) |
void | SetPropertyTable (const TopoDS_Shape &theSubshape, const ModelData_PropertyTable &thePTable) |
void | AddPMIData (const ModelData_Shape &theSubshape, const ModelData_PMIData &thePMIData) |
Sets an association between theSubshape and thePMIData. | |
void | AddPMIData (const TopoDS_Shape &theSubshape, const ModelData_PMIData &thePMIData) |
Base_UTF16String | Name (const ModelData_Shape &theSubshape) const |
Base_UTF16String | Name (const TopoDS_Shape &theSubshape) const |
ModelData_Appearance | Appearance (const ModelData_Shape &theSubshape) const |
ModelData_Appearance | Appearance (const TopoDS_Shape &theSubshape) const |
ModelData_PropertyTable | PropertyTable (const ModelData_Shape &theSubshape) const |
ModelData_PropertyTable | PropertyTable (const TopoDS_Shape &theSubshape) const |
void | AddToLayer (const ModelData_Shape &theSubshape, const ModelData_Layer &theLayer) |
Adds subshape to layer. | |
void | AddToLayer (const TopoDS_Shape &theSubshape, const ModelData_Layer &theLayer) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
bool | RemoveFromLayer (const ModelData_Shape &theSubshape, const ModelData_Layer &theLayer) |
Removes subshape from layer. | |
bool | RemoveFromLayer (const TopoDS_Shape &theSubshape, const ModelData_Layer &theLayer) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
bool | FindInLayer (const ModelData_Shape &theSubshape, const ModelData_Layer &theLayer) const |
Finds subshape in layer. | |
bool | FindInLayer (const TopoDS_Shape &theSubshape, const ModelData_Layer &theLayer) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | Accept (SubshapeVisitor &theVisitor) const |
Applies the visitor to visit the subshapes. | |
ModelData_Shape | Shape (int theId) const |
Returns a B-Rep shape by its Id. | |
int | ShapeId (const ModelData_Shape &theShape) const |
Returns an Id of B-Rep shape. | |
void | Accept (ModelData_Part::RepresentationVisitor &theVisitor) const |
Accepts a representation visitor. | |
Base_UTF16String | Name () const |
void | SetName (const Base_UTF16String &theName) |
Sets an object name. | |
![]() | |
ModelData_Representation () | |
Constructor. | |
void | Accept (ModelData_Part::RepresentationVisitor &theVisitor) const |
Accepts a representation visitor. | |
![]() | |
ModelData_BaseObject () | |
Constructor. | |
IdType | TypeId () const |
Returns an object type id. | |
template<typename T > | |
bool | IsOfType () const |
Returns true if the object has a type T. | |
void | SetName (const Base_UTF16String &theName) |
Sets an object name. | |
Base_UTF16String | Name () const |
void | SetUuid (const Base_Uuid &theUuid) |
Base_Uuid | Uuid () const |
void | Nullify () |
Resets reference to implementation object. | |
bool | IsNull () const |
Returns true if the object is nullified. | |
operator bool () const | |
Casts the object to the bool type. | |
internal::ModelData_BaseObjectImpl * | Impl () const |
Return a handle to backend (reserved for internal use). | |
Static Public Member Functions | |
static IdType | GetTypeId () |
Additional Inherited Members | |
![]() | |
ModelData_Representation (internal::ModelData_BaseObjectImpl *theImpl) | |
Constructor (reserved for internal use). | |
![]() | |
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. | |
Defines precise Boundary Representation of part.
B-Rep representation contains a precise geometrical description of a part (ModelData_Part). A part may have none or one B-Rep representation.
The following image depicts a precise B-Rep representation of a conrod:
B-Rep uses geometrical and topological entities (curves, surfaces, edges, faces, etc) to define own contents.
B-Rep representation contains ModelData_BodyList, which is a list of bodies (ModelData_Body), returned by the Get() method. As a rule a B-Rep representation consists of a single body. Models with multiple bodies can be most often received when importing STEP files created by CATIA CAD system.
The following example demonstrates how to iterate over root bodies:
B-Rep representation is initially created with a single body (from the shape provided in the constructor) or with an empty body list. Bodies can be added using the Add() method.
CAD Exchanger provides various techniques to create B-Rep bodies - from bottom-up creation up to using higher-level solid modeling algorithms. Refer to B-Rep Modeling for further details.
In addition to root bodies which only contain geometrical definitions, the B-Rep representation may also contain additional meta-data such as names, appearance attributes (colors or materials), user-defined properties, layers attached to sub-shapes (bodies or their sub-elements), such as faces or edges.
This association may only take place at the B-Rep representation itself, as topological shapes (subclasses of ModelData_Shape) do not allow to define meta-data.
The following example demonstrates how to assign attributes to sub-shapes:
The screenshot below demonstrates how this B-Rep representation would be displayed:
The following example demonstrates how to iterate over registered sub-shapes and to retrieve their attributes:
Attributes can also be assigned to root bodies. For single shape body (e.g., solid body) this is same as assigning attributes to it's underlying shape. I.e.
For body with multiply shapes (e.g., sheet body with several ModelData_Face) assigning attributes is not same as assigning to it's children. They all have separate attributes.
cadex::ModelData_BRepRepresentation::ModelData_BRepRepresentation | ( | ) |
Constructor.
Creates a null object (see IsNull()).
cadex::ModelData_BRepRepresentation::ModelData_BRepRepresentation | ( | initialized | ) |
Constructor.
Creates an initialized object (IsNull() returns false) with an empty body list.
cadex::ModelData_BRepRepresentation::ModelData_BRepRepresentation | ( | const ModelData_Shape & | theShape | ) |
Constructor.
Creates an object with a single root body created from theShape invoking the Add() method.
ModelData_Shape cadex::ModelData_BRepRepresentation::Add | ( | const ModelData_Shape & | theShape | ) |
Adds a root body (or bodies).
If theShape is not a body or a body list then creates a body that holds theShape, adds it to the list of root bodies and returns it.
If theShape is a body then appends it to the list of root bodies, if it is a body list then appends all its bodies to the root list; returns theShape in either above case.
void cadex::ModelData_BRepRepresentation::AddPMIData | ( | const ModelData_Shape & | theSubshape, |
const ModelData_PMIData & | thePMIData | ||
) |
Sets an association between theSubshape and thePMIData.
The created association is a bilateral connection between theSubshape and thePMIData. The assigned ModelData_PMIGraphicalElement to the shape could be iterated via PMIGraphicalElementIterator.
void cadex::ModelData_BRepRepresentation::AddToLayer | ( | const ModelData_Shape & | theSubshape, |
const ModelData_Layer & | theLayer | ||
) |
Adds subshape to layer.
void cadex::ModelData_BRepRepresentation::Clear | ( | ) |
Discards associated data.
Clears the root bodies.
bool cadex::ModelData_BRepRepresentation::FindInLayer | ( | const ModelData_Shape & | theSubshape, |
const ModelData_Layer & | theLayer | ||
) | const |
Finds subshape in layer.
const ModelData_BodyList & cadex::ModelData_BRepRepresentation::Get | ( | ) | const |
Returns an associated topological object.
If the object IsNull() then behavior is undefined.
bool cadex::ModelData_BRepRepresentation::HasSubshapes | ( | ) | const |
Returns true if there is at least one explicitly registered sub-shape.
Subshapes are registered when calling SetName() or SetAppearance() methods.
Base_UTF16String cadex::ModelData_BaseObject::Name | ( | ) | const |
Returns an object name. Returns empty string if the object has no name (by default).
size_t cadex::ModelData_BRepRepresentation::NumberOfSubshapes | ( | ) | const |
Returns the number of registered sub-shapes.
Subshapes are registered when calling SetName() or SetAppearance() methods.
bool cadex::ModelData_BRepRepresentation::RemoveFromLayer | ( | const ModelData_Shape & | theSubshape, |
const ModelData_Layer & | theLayer | ||
) |
Removes subshape from layer.
void cadex::ModelData_BRepRepresentation::SetAppearance | ( | const ModelData_Shape & | theSubshape, |
const ModelData_Appearance & | theAppearance | ||
) |
theSubshape may only be a ModelData_Body or its subshape. ModelData_BodyList will be iterated into its bodies.
void cadex::ModelData_BaseObject::SetName | ( | const Base_UTF16String & | theName | ) |
Sets an object name.
Accepts a string as a unicode string. Must not be called on IsNull() object. Otherwise behavior is undefined.
void cadex::ModelData_BRepRepresentation::SetName | ( | const ModelData_Shape & | theSubshape, |
const Base_UTF16String & | theName | ||
) |
theSubshape may only be a ModelData_Body or its subshape. ModelData_BodyList is ignored.
ModelData_Shape cadex::ModelData_BRepRepresentation::Shape | ( | int | theId | ) | const |
Returns a B-Rep shape by its Id.
If theId is negative or there is no corresponding shape in this representation, then returns empty ModelData_Shape. If this representation IsNull(), then behavior is undefined.
int cadex::ModelData_BRepRepresentation::ShapeId | ( | const ModelData_Shape & | theShape | ) | const |
Returns an Id of B-Rep shape.
If the shape IsNull() or does not belong to B-Rep, then returns -1. May also return -1 if new shapes were added to existing shapes of B-Rep after first call of current method (except ModelData_Representation::Add()). If this representation IsNull(), then behavior is undefined.