CAD Exchanger SDK
Polygonal representation (ModelData_PolyRepresentation) contains an approximated (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.
Polygonal representation contains ModelData_PolyShapeList, which is a list of vertex sets (ModelData_PolyVertexSet).
The following example demonstrates how to iterate over root vertex sets:
Adding vertex set to Polygonal representation is done with ModelData_PolyRepresentation::Add() or provided in the constructor, for instance:
CAD Exchanger supports the following vertex sets:
The following picture demonstrates each of these types:
Each of the above classes subclass ModelData_PolyVertexSet which defines a set of vertex coordinates. The vertex set can also have optional appearance (ModelData_Appearance) or particular colors attached to vertices. The latter is very rarely used as it incurs the greatest memory footprint (although allows the highest flexibility).
Attachment of appearance can also be relatively rare given that the most frequent case is attachment of appearance to a part holding the representations. 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 multiple triangle sets each holding its own color (green or orange):
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:
Each subclass of ModelData_PolyVertexSet provides API to construct the respective object bottom-up.
A polygonal representation can be created from a B-Rep representation with the help of visulization or computational meshers (see Overview).
The following example demonstrates how to create a part from one B-Rep representation and one polygonal representation using visualization mesher with fine granularity settings:
ModelAlgo_BRepMesher is used underneath to generate the 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: