MTK 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 ModelData.Model or for any ModelData.Assembly , ModelData.Part , and ModelData.Instance .
Bounding Box
Bounding box is the smallest axis-aligned box that fully contains a 3D model (or its component).
The following example demonstrates computation of a shape bounding box:
ModelData.Shape aShape = ...;
ModelData.Box aBox = new ModelData.Box();
Geom.Transformation aTrsf = new Geom.Transformation();
Measurements.BoundingBox.Compute(aShape, aTrsf, aBox);
In addition to traditional bounding boxes, Manufacturing Toolkit also allows to compute minimum bounding box which is not necessarily axis-aligned:
ModelData.Shape aShape = ...;
ModelData.Box aBox = new ModelData.Box();
Geom.Transformation aTrsf = new Geom.Transformation();
Measurements.BoundingBox.ComputeMin(aShape, aBox, aTrsf);
Surface Area
The following example demonstrates computation of a shape surface area:
ModelData_Shape aShape = ...;
double r = Measurements.SurfaceArea.Compute(aShape);
Volume
The following example demonstrates computation of a shape volume:
ModelData.Shape aShape = ...;
double r = Measurements.Volume.Compute(aShape);
Centroid
The following example demonstrates computation of a shape centroid (center of mass) :
ModelData.Shape aShape = ...;
Geom.Point aCentroid = Measurements.ValidationProperties.ComputeCentroid(aShape);
Distance
The following example demonstrates the computation of the distance between two shapes:
ModelData.Shape aFirstShape = ...;
ModelData.Shape aSecondShape = ...;
double aDistance = Measurements.Distance.Compute(aFirstShape, aSecondShape);
Angle
The following example demonstrates the computation of the angle between two planar faces:
ModelData.Face aFirstFace = ...;
ModelData.Face aSecondFace = ...;
double anAngle = Measurements.Angle.Compute(aFirstFace, aSecondFace);