Bitbybit Docs
    Preparing search index...

    Class OCCTAnalysisMeasure

    Measurements of shapes: a bounding box that follows the geometry exactly, a box in a frame, the box turned to fit and the principal axes of inertia, every closest pair of points between two shapes with the sub-shapes they lie on, angles between faces and edges, the dihedral angle along an edge, and the tightest radius of curvature. Lengths are in model units and angles in degrees.

    Index

    Constructors

    angles

    • Measures the angle in degrees between two faces or edges where they come nearest each other.

      Faces compare their normals, 0 when they look the same way and 180 when opposite; edges compare their tangents; a face and an edge compare the normal with the tangent, so the edge meets the face's plane at 90 minus the angle.

      Parameters

      Returns Promise<AngleBetween>

      The angle in degrees, with the points and directions it was read at

      const top = await bitbybit.occt.shapes.face.getFace({ shape: box, index: 5 });
      const side = await bitbybit.occt.shapes.face.getFace({ shape: box, index: 0 });
      const { angle } = await bitbybit.occt.analysis.measure.angleBetween({ shapeA: top, shapeB: side });
    • Measures the angle through the material between the two faces that meet at an edge.

      A box's edges read 90 degrees, a smooth join 180 and an L's inner edge 270; up to 180 the edge is convex. param is a share of the edge's parameter range, and of its length only on lines and circles.

      Parameters

      Returns Promise<DihedralAngle>

      The angle in degrees, with the point, the two faces and their normals

      const { angle, isConvex } = await bitbybit.occt.analysis.measure.dihedralAngle({ shape: part, index: 3, param: 0.5 });
      

    boxes

    • Finds the box lined up with the axes that just holds a shape's exact geometry.

      Unlike operations.boundingBoxOfShape, which may add tolerances and the mesh, it leaves no gap: a ball of radius 3 gets a box of 6. A face carrying only a mesh is boxed by its nodes; a shape with nothing to bound is refused.

      Parameters

      Returns Promise<BoundingBoxPropsDto>

      The box as min, max, center and size

      const box = await bitbybit.occt.analysis.measure.tightBoundingBox({ shape: part });
      console.log(box.size, box.center);
    • Finds the box that just holds a shape with its sides along a frame's axes instead of the world's.

      The box's x runs along the frame's direction and its z along the normal. It comes back as a frame at its center and half its size along each axis; orientedBoundingBox turns the box to fit instead.

      Parameters

      Returns Promise<OrientedBoundingBox>

      The frame at the box's center and the half sizes along its direction, y axis and normal

      const { frame, halfSizes } = await bitbybit.occt.analysis.measure.boundingBoxInFrame({
      shape: part,
      frame: { origin: [0, 0, 0], normal: [0, 0, 1], direction: [1, 1, 0] },
      });
    • Finds 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.

      boundingBoxInFrame keeps the axes of a frame you give instead.

      Parameters

      Returns Promise<OrientedBoundingBox>

      The frame and the half sizes along its direction, y axis and normal

      const { frame, halfSizes } = await bitbybit.occt.analysis.measure.orientedBoundingBox({ shape: part });
      

    curvature

    • Finds the tightest bend of a shape, sampled over its faces and edges, and where it is.

      Each face is read on a grid of samples by samples places inside its trims and each edge at samples places, so a tighter bend between them can be missed. A sharp edge between faces is no bend; dihedralAngle measures it.

      Parameters

      Returns Promise<MinCurvatureRadius>

      The smallest radius found, where, and on which face or edge

      const { radius, support, index } = await bitbybit.occt.analysis.measure.minCurvatureRadius({ shape: part, samples: 16, concaveOnly: true });
      

    distances

    • Finds every nearest pair of points between two shapes, with the vertex, edge or face each point lies on and where on it.

      Touching, overlapping and nested shapes are 0 apart; a shape inside another gives one pair on one of its vertices, with -1 as the containing side's index. operations.closestPointsBetweenTwoShapes gives one pair alone.

      Parameters

      Returns Promise<ShapeExtremum[]>

      The nearest pairs

      const [nearest] = await bitbybit.occt.analysis.measure.extrema({ shapeA: box, shapeB: ball });
      console.log(nearest.distance, nearest.supportA, nearest.indexA);

    frames

    • Finds 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.

      Solids are measured by volume, even inside out, else faces by area, else edges by length, at a density of 1. Each axis's largest coordinate is positive.

      Parameters

      Returns Promise<PrincipalFrame>

      The frame and the moments about its direction, y axis and normal

      const { frame, moments } = await bitbybit.occt.analysis.measure.principalFrame({ shape: part });