Properties are meta data, which can be attached to any graph element or a sub-shape in ModelData_BRepRepresentation.
Properties are represented in the form tables encapsulated by ModelData_PropertyTable. The property table contains a list of pairs {property_name, property_value}. A property name is defined with a Unicode string (Base_UTF16String) and value can have any of the following types:
Type | C++ Type | Example |
---|---|---|
32 bit integer | I32 | 25 |
64 bit integer | I64 | 8589934590 |
float | float | -0.2 |
double | double | 1.34e-16 |
timestamp | time_t | 1437980561 (July 27, 2015 11:02am) |
String (Ascii or Unicode) | Base_UTF16String | "ABC123", "© 2015" |
3D point | BaseGeom_Point | {1.2 3.4 -5.6} |
3D box | BaseGeom_Box | {-1.2 3.4 -5.6} {2.34 5.8 3.1} |
The following example demonstrates creation and attachment of properties:
The properties can be traversed with the help of visitors as demonstrated in the example below:
ModelData_PropertyTable::VoidVisitor is a convenience class which provides empty implementation for each supported value type. Thus, it allows to only define methods for required types:
A specific property item can be retrieved using the FindProperty() item for a required value type, for example:
ModelData_PropertyTable::HasProperty() allows to quickly check if the property item has been registered.
The data model allows to attach specific properties called "validation properties". These properties allow to exchange data between CAD systems in order to verify correctness of the conversion and compare properties in the sending and receiving systems. These properties include:
When importing from or exporting to formats which support validation properties (e.g. STEP or JT) validation properties are converted from / to specific entities as prescribed by the format.
Validation properties are stored in the property table using reserved names. These names are used to recognize and distinguish them from user-defined properties and therefore may not be used for any other properties.
The following table describes names and expected value types for the validation properties:
Validation property | Reserved name | String | C++ Type |
---|---|---|---|
Surface area | ModelData_PropertyTable::SurfaceAreaPropertyName() | "CADEX_SURFACE_AREA" | double |
Volume | ModelData_PropertyTable::VolumePropertyName() | "CADEX_VOLUME" | double |
Center of gravity | ModelData_PropertyTable::CentroidPropertyName() | "CADEX_CENTROID" | BaseGeom_Point |
Bounding box | ModelData_PropertyTable::BoundingBoxPropertyName() | "CADEX_BOUNDING_BOX" | BaseGeom_Box |
The following example demonstrates how to recognize a validation property:
Validation properties must be specified in the model units (linear, square or cubic).