Representations are associated with a part and define its shape.
The following representations are supported:
Each part may have zero or one B-Rep representation and zero, one or several polygonal representations. Representations must be consistent with each other.
The following picture demonstrates the nut part from the assembly as1, with one BRep (as solid body) and one polygonal representation:
B-Rep representation (ModelData_BRepRepresentation) includes a topological model that describes hierarchy and connectivity information between elements in the 3D model (from vertices to solid), as well as reference to underlying geometries (points, curves and surfaces):
Topological entities subsclass the base class ModelData_Shape, curves subclass ModelData_Curve and surfaces inherit the base class ModelData_Surface.
CAD Exchanger supports all types of bodies: solid, sheet, wireframe, and acorn (single vertex) bodies. Body (ModelData_Body) belongs to B-Rep representation itself.
Supported geometries include:
Each topological entity can be explored for its children. Vertices, edges, faces can be interrogated for associated geometries.
Curves and surfaces can be interrogated for their defining parameters (e.g. axis placement for a circle, or control points for a NURBS curve):
B-Rep bodies can be created using solid and sheet modeling API, such as solid primitives and sweep operations, or direct step-by-step bottom-up process:
Polygonal representation (ModelData_PolyRepresentation) defines a tessellated (mesh) representation of a part. The part may have zero or more polygonal representations.
CAD Exchanger supports triangular meshes, polylines and point clouds. All of them subclass the base class ModelData_PolyVertexSet.
Polygonal representations are either imported from the source file or can be created bottom-up (by populating lists of mesh nodes, normals) or generated from B-Rep representations with the help of meshers.
A part may have multiple polygonal representations. In this case a part is considered having levels of details (LOD's), i.e. granularity or accuracy of approximation of a part.
By convention, LODs must be sorted from the most accurate (fine) to the least accurate (coarse) representations.
The following two examples demonstrate a part with one BRep representation (as a sheet body or solid body respectively) and three polygonal representations:
Polygonal representations can be either explicitly created bottom-up or generated from B-Rep with the help of meshers (see Mesh Generation).
CAD Exchanger SDK contains two classes of meshers serving two different purposes and making different trade-off's in implementation:
Each mesher supports various parameters (chordal and angular deflection, min/max size, etc) in order to control the resulting mesh.
The following code snippet demonstrates creation of a part with BRep and two polygonal representations:
Semantics of LOD is application-specific. The data model only provides a mechanism to define multiple polygonal representations.
B-Rep representation contains ModelData_BodyList, which is a list of bodies (ModelData_Body), which define exact part geometry. Each ModelData_Body can be solid, sheet, wireframe or acorn (see ModelData_BodyType enumeration).
Each polygonal representation contains ModelData_PolyShapeList, which is a list of vertex sets. Each vertex set (subclass of ModelData_PolyVertexSet) defines either a set of triangles (ModelData_IndexedTriangleSet), polylines (ModelData_PolyLineSet) or just a point cloud ( ModelData_PolyPointSet).
The part representations can be traversed as follows:
The following examples demonstrate using each approach:
In the above example a respective operator() of MyRepresentationVisitor will be invoked for each representation encountered in the part.