Skip to main content

Measuring and analysing shapes

bitbybit.occt.analysis asks questions of shapes and answers with numbers, points and lists, not new shapes. Use it to size a part, check a fit, find where to put the next feature, or make sure parts do not collide.

Measure​

analysis.measure holds the measurements a designer reaches for:

  • tightBoundingBox, orientedBoundingBox and boundingBoxInFrame: the box around a shape, aligned with the world, turned to fit it as closely as possible, or in a frame of your own;
  • extrema: the nearest points between two shapes, and their distance;
  • angleBetween and dihedralAngle: angles between directions and between faces;
  • principalFrame: a shape's centre of mass and principal axes;
  • minCurvatureRadius: the tightest bend of a shape, and where it is.

Volume and area are with the shapes themselves: bitbybit.occt.shapes.solid.getSolidVolume and getSolidSurfaceArea.

Clashes​

analysis.clashes.betweenShapes checks a list of parts against each other and names every pair that overlaps, touches or comes within a clearance, with their distance and the volume two solids share. selfIntersections finds a shape that cuts through itself, and facesWithin the faces of one shape that come within a clearance of the faces of another.

Here two blocks overlap. The clash names the pair by their places in the list, 0 and 1, with a distance of 0 and the volume they share:

Bitbybit Platform

Do two parts collide? in Rete

rete logoRete
Script Source (rete)
{
"id": "rete-v2-json",
"nodes": {
"first": {
"id": "first",
"name": "bitbybit.occt.shapes.solid.createBox",
"customName": "box",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"width": 3,
"length": 3,
"height": 3,
"center": [
0,
0,
0
],
"originOnCenter": true
},
"inputs": {},
"position": [
40,
40
]
},
"second": {
"id": "second",
"name": "bitbybit.occt.shapes.solid.createBox",
"customName": "box",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"width": 3,
"length": 3,
"height": 3,
"center": [
2,
1,
0
],
"originOnCenter": true
},
"inputs": {},
"position": [
40,
460
]
},
"parts": {
"id": "parts",
"name": "bitbybit.lists.createList",
"customName": "create list",
"async": false,
"drawable": false,
"data": {},
"inputs": {
"listElements": {
"connections": [
{
"node": "first",
"output": "result",
"data": {}
},
{
"node": "second",
"output": "result",
"data": {}
}
]
}
},
"position": [
460,
260
]
},
"clashes": {
"id": "clashes",
"name": "bitbybit.occt.analysis.clashes.betweenShapes",
"customName": "clashes between shapes",
"async": true,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"clearance": 0
},
"inputs": {
"shapes": {
"connections": [
{
"node": "parts",
"output": "list",
"data": {}
}
]
}
},
"position": [
880,
260
]
}
},
"modules": {}
}

In TypeScript the clashes are written to the console. In Rete, point at the output of clashes between shapes to read them.

Curves and surfaces​

analysis.curves and analysis.surfaces read the geometry under edges and faces: the kind of curve or surface, curvature along a curve or at points on a surface, the closest points, where a curve crosses a face or another curve, and the kinks where a wire turns sharply. They are the tools for checking smoothness and for placing things exactly on a surface.

Every analysis​

FunctionWhat it does
clashes.betweenShapesFinds every pair among a list of shapes that overlap, touch or come within a clearance of each other, such as colliding parts.
clashes.facesWithinFinds the faces of one shape that come within a clearance of faces of another, each pair measured exactly.
clashes.selfIntersectionsFinds the pairs of faces of one shape that cross each other anywhere but along an edge they share.
curves.closestPointsFinds the point of an edge or a wire nearest each given point, with where it lies along the curve.
curves.curvatureCombDraws a curvature comb along an edge or a wire: teeth standing on the curve, as long as the curvature there, pointing away from its center.
curves.curvaturesAtLengthsReads how an edge or a wire bends at places given as lengths along it from its start, in model units.
curves.curvaturesAtParamsReads how an edge or a wire bends at places given as fractions from 0 at its start to 1 at its end.
curves.curveTypeTells what kind of curve an edge runs along: a line, a circle, an ellipse, a hyperbola, a parabola, a Bezier curve, a B-spline, an offset curve or another kind.
curves.extremesAlongFinds the highest and lowest points of an edge or a wire along a direction, such as the crests of a wave.
curves.intersectCurvesFinds where two edges or wires cross or touch, with the parameter and the edge of each point on both curves.
curves.intersectCurveWithFaceFinds where an edge or a wire passes through a face or lies on it, within the face's edges.
curves.kinksFinds the corners of an edge or a wire where the tangent turns by more than an angle, such as the corners of a polyline.
measure.angleBetweenMeasures the angle in degrees between two faces or edges where they come nearest each other.
measure.boundingBoxInFrameFinds the box that just holds a shape with its sides along a frame's axes instead of the world's.
measure.dihedralAngleMeasures the angle through the material between the two faces that meet at an edge.
measure.extremaFinds every nearest pair of points between two shapes, with the vertex, edge or face each point lies on and where on it.
measure.minCurvatureRadiusFinds the tightest bend of a shape, sampled over its faces and edges, and where it is.
measure.orientedBoundingBoxFinds the smallest box that fits around a shape, turned to follow it rather than the axes: a frame at the box's centre, its direction along the longest side and its normal along the shortest, with half the box's size along each.
measure.principalFrameFinds a shape's principal axes of inertia as a frame at its centre of mass: the direction is the axis it turns about most easily, the normal the one it resists most.
measure.tightBoundingBoxFinds the box lined up with the axes that just holds a shape's exact geometry.
signaturesDescribes every face and edge of a shape in one pass: each face's surface kind, area, centre, outward normal and box, and each edge's curve kind, length, midpoint and direction there.
surfaces.closestPointsFinds the point of a face nearest each given point, with its (u, v) and the face's normal there.
surfaces.curvaturesOnUVsReads how a face bends at (u, v) pairs: its largest and smallest curvature with their directions, their mean and product, and the normal.
surfaces.surfaceTypeTells what kind of surface a face lies on, such as a plane, a cylinder or a B-spline.