CAD Exchanger SDK
Measurements

Overview

CAD Exchanger SDK allows to compute some key properties of a 3D model:

  • bounding box;
  • surface area;
  • volume;
  • centroid (center of mass).

Each property can be computed either for an entire model (ModelData_Model) or for any assembly, part, instance, or part representation.

Bounding Box

Bounding box is an axis-aligned bounding box which encompasses a 3D model (or its component).

The following example demonstrates computation of a part's bounding box:

ModelData_Part aPart = ...;
ModelData_Box aBox;

In addition to traditional bounding boxes, CAD Exchanger also allows to compute minimum bounding box which is not necessarily axis-aligned:

ModelData_Part aPart = ...;
ModelData_Box aMinBox;
ModelData_Transformation aTrsfToApply;
ModelAlgo_BoundingBox::Compute (aPart, aMinBox, aTrsfToApply);

aMinBox contains an axis-aligned box which would be returned if the part were transformed with the help of returned transformation.

Note
The computation of minimum boxes is currently in feature preview state. Its API may change, so binary compatibility can be broken.

Surface Area

Surface area only can be computed for parts having a solid or sheet body in their B-Rep representation.

The following example demonstrates computation of a part's surface area:

ModelData_Part aPart = ...;

Volume

Volume can only be computed for parts having a solid body in their B-Rep representation.

The following example demonstrates computation of a part's volume:

ModelData_Part aPart = ...;

Centroid

Centroid (center of mass) can only be computed for parts having B-Rep representations.

The following example demonstrates computation of a part's centroid:

ModelData_Part aPart = ...;
ModelData_Point aCentroid;