Finds the pair of points, one on each shape, that are closest to each other.
The distance between them is the gap between the shapes; it is 0 when they touch or overlap.
Throws an error when no pair can be found. analysis.measure.extrema gives every closest pair,
with the sub-shapes the points lie on.
It moves to analysis.measure in the next major version, with the same inputs and result.
The two shapes
The point on the first shape and the point on the second
Finds, for each point in a list, the closest point on a shape.
A point already on the shape maps to itself. Useful for snapping points onto a surface.
It moves to analysis.measure in the next major version, with the same inputs and result.
The shape and the points
One point on the shape per input point, in the same order
Finds the closest point on each of several shapes for each point in a list.
The result is one flat list: all the points for the first shape, in point order, then all the points for the second shape, and so on.
It moves to analysis.measure in the next major version, with the same inputs and result.
The shapes and the points
The closest points, grouped shape by shape
Cuts a shape into pieces with other shapes, the way a knife splits a loaf, without removing any material.
With nonDestructive true, the default, the inputs are left untouched and the result holds
the pieces of every shape involved, the cutters included; with false only the pieces of
shape come back. localFuzzyTolerance lets geometry that nearly touches count as touching.
The shape to split, the shapes to split it with and the options
The pieces
Cuts a solid into parallel slices along a direction, like a loaf of bread, every step model
units from the bottom of the shape up.
Each slice is the flat section where a cutting plane meets the solid, all in one compound. The shape must contain solids, and a step giving more than 100000 slices is refused.
The shape, the distance between slices and the slicing direction
A compound of the section faces
Cuts a solid into parallel slices like slice, but with a repeating pattern of gaps between
them, such as 0.1, 0.5, 0.1, 0.5.
The pattern repeats from the bottom of the shape up to its top. Steps must add up to more than 0 and give at most 100000 slices.
The shape, the pattern of gaps and the slicing direction
A compound of the section faces
Finds the curves where two shapes meet and joins them end to end into wires, such as the outline a plane cuts from a solid.
A loop comes back as a closed wire, branches or loose ends as open wires, and shapes that do not meet give an empty list.
The two shapes and the joining tolerance
The wires where the shapes meet
const box = await bitbybit.occt.shapes.solid.createBox({ width: 10, length: 10, height: 10, center: [0, 5, 0] });
const plane = await bitbybit.occt.shapes.face.createSquareFace({ size: 20, center: [0, 3, 0], direction: [0, 1, 0] });
const outline = await bitbybit.occt.operations.sectionWires({ shapeA: box, shapeB: plane, tolerance: 1e-7 });
Slices a shape with the plane of each frame, which passes through the frame's origin square to its normal.
With makeFaces true a slice holds the faces where the plane passes through the solids, holes
included; with false, the section wires. A plane that misses the shape gives an empty compound.
The shape, the frames, whether to make faces and the joining tolerance
One compound per frame, in the order of the frames
Splits a shape in two with the plane of a frame: what lies on the side the frame's normal
points to comes back as front, the rest as back.
The pieces are solids when the shape has any, else faces, else edges. A shape the plane misses comes back whole on its side.
The shape and the frame whose plane splits it
The pieces in front of the plane and behind it, each in a compound
Cuts a face into pieces along edges or wires lying on it, like scoring a sheet.
A cutter cuts only where it lies on the face, and a closed loop inside it cuts out the region it encloses. With no cutters the face comes back whole.
The face and the edges or wires to cut it along
The pieces of the face
const square = await bitbybit.occt.shapes.face.createSquareFace({ size: 10, center: [0, 0, 0], direction: [0, 1, 0] });
const line = await bitbybit.occt.shapes.edge.line({ start: [0, 0, -6], end: [0, 0, 6] });
const halves = await bitbybit.occt.operations.splitFaceByWires({ shape: square, wires: [line] });
Sweeps a shape in a straight line along a vector, whose length is the distance: a face becomes a solid, a wire a shell, an edge a face.
The shape itself stays at the start of the extrusion; the vector is in model units, so [0, 10, 0] extrudes 10 units up. A solid, or a vector of length 0, is refused.
The shape and the direction vector, whose length is the distance
The extruded shape
Extrudes a shape as extrude does, and reports what each part of the profile became:
history.firstFaces and lastFaces are the caps of a face profile (a wire has none),
history.facesFromEdges the side swept from each profile edge and
history.edgesFromVertices the edge swept from each vertex.
The profile and the direction and length of the extrusion
The extruded shape and its history
Sweeps several shapes along the same vector, as extrude does for one.
The shapes and the direction vector, whose length is the distance
The extruded shapes, in the same order
Extrudes a flat shape up along Y by height while twisting it by angle degrees about the Y
axis, like a twisted column.
The shape should lie flat, as the profiles this package creates do. With makeSolid true,
the default, a face profile gives a closed solid; a wire gives a twisted shell.
The profile shape, the height, the twist angle in degrees and whether to make a solid
The twisted extrusion
Builds a surface through a series of wires, like skin stretched over ribs: each wire is one section and the surface passes through them in list order.
Edges are accepted as single-edge wires. With makeSolid true and closed sections the result
is capped into a solid; otherwise it is a shell. Sections match up best with equal edge
counts.
The section wires or edges, in order, and whether to make a solid
The lofted shell or solid
const bottom = await bitbybit.occt.shapes.wire.createCircleWire({ radius: 5, center: [0, 0, 0], direction: [0, 1, 0] });
const upper = await bitbybit.occt.shapes.wire.createSquareWire({ size: 6, center: [0, 10, 0], direction: [0, 1, 0] });
const vase = await bitbybit.occt.operations.loft({ shapes: [bottom, upper], makeSolid: true });
Builds a surface through a series of wires like loft, with control over how the skin is
fitted.
straight makes ruled patches between sections instead of a smooth blend; closed loops the
surface from the last section back to the first, and periodic makes that loop smooth by
resampling the sections. startVertex and endVertex close the ends to points.
The section wires or edges, whether to make a solid, the closing and smoothing options and optional end points
The lofted shell or solid
const cone = await bitbybit.occt.operations.loftAdvanced({
shapes: [circleBottom, circleMiddle],
makeSolid: true,
closed: false,
periodic: false,
straight: false,
nrPeriodicSections: 10,
useSmoothing: false,
maxUDegree: 3,
tolerance: 1e-7,
parType: Bit.Inputs.OCCT.approxParametrizationTypeEnum.approxCentripetal,
endVertex: [0, 20, 0],
});
Measures how far each point in a list is from a shape, as the straight distance to the closest point on it, in model units.
The distance is to the shape's surface, so a point inside a solid still reports its distance to the skin.
It moves to analysis.measure in the next major version, with the same inputs and result.
The shape and the points
One distance per point, in the same order
Computes the axis-aligned box that encloses a shape: its minimum and maximum corners, its center and its size along X, Y and Z.
On curved shapes the box can be a little larger than the shape itself, because the kernel
bounds the control geometry rather than the exact surface. analysis.measure.tightBoundingBox
follows the exact geometry.
It moves to analysis.measure in the next major version, with the same inputs and result.
The shape
The box as min, max, center and size
Reads the minimum corner of a shape's axis-aligned bounding box, the point with the smallest X, Y and Z.
It moves to analysis.measure in the next major version, with the same inputs and result.
The shape
The minimum corner
Reads the maximum corner of a shape's axis-aligned bounding box, the point with the largest X, Y and Z.
It moves to analysis.measure in the next major version, with the same inputs and result.
The shape
The maximum corner
Reads the center of a shape's axis-aligned bounding box, halfway between its two corners.
This is not the center of mass; shapes.solid.getSolidCenterOfMass and its siblings give
that.
It moves to analysis.measure in the next major version, with the same inputs and result.
The shape
The center of the box
Reads the size of a shape's axis-aligned bounding box along X, Y and Z, in model units.
It moves to analysis.measure in the next major version, with the same inputs and result.
The shape
The width, height and length of the box
Builds the axis-aligned bounding box of a shape as a box solid, handy for drawing it or using it in a boolean.
It moves to analysis.measure in the next major version, with the same inputs and result.
The shape
The box solid
Computes a sphere that encloses a shape: it is centered on the bounding box and reaches its corners, so it always contains the shape but is not the smallest possible sphere.
It moves to analysis.measure in the next major version, with the same inputs and result.
The shape
The sphere as center and radius
Reads the center of a shape's bounding sphere, which is the center of its bounding box.
It moves to analysis.measure in the next major version, with the same inputs and result.
The shape
The center of the sphere
Reads the radius of a shape's bounding sphere, the distance from the bounding box center to its corner, in model units.
It moves to analysis.measure in the next major version, with the same inputs and result.
The shape
The radius
Builds the bounding sphere of a shape as a sphere solid.
It moves to analysis.measure in the next major version, with the same inputs and result.
The shape
The sphere solid
Moves the boundary of a shape outward, or inward for a negative distance, by a fixed distance: a wire grows into a parallel outline, a face or solid into a bigger one.
A wire or edge is offset in its own plane, or on face when given; corners are rounded. A
distance of 0 returns the shape as it is.
The shape, an optional face to offset a wire on, the distance and the tolerance
The offset shape
Offsets a shape like offset, with a choice of how corners are joined: arc rounds them,
intersection extends the sides to a sharp corner, tangent keeps them tangent.
removeIntEdges drops the internal edges the offset can leave behind on a solid.
The shape, an optional face to offset a wire on, the distance, the tolerance, the corner join type and whether to remove internal edges
The offset shape
Gives a face or shell a thickness, turning it into a solid slab or wall of the given
offset.
A positive offset thickens along the surface normal, a negative one against it. Faces are
offset one by one, so walls meeting at a sharp edge leave a gap of up to 1.4 times offset,
bridged by tolerance.
The face or shell and the thickness
The thick solid
Hollows a solid into a shell of the given wall thickness by removing the listed faces and offsetting the rest.
Removing the top face of a box, for instance, gives an open cup. offset is the wall
thickness, negative to grow inward; joinType says how the offset walls meet at corners, the
other flags go to the kernel's thick-solid builder.
The solid, the faces to remove, the wall thickness, the tolerance and the join options
The hollowed solid
const box = await bitbybit.occt.shapes.solid.createBox({ width: 10, length: 10, height: 10, center: [0, 0, 0] });
const faces = await bitbybit.occt.shapes.face.getFaces({ shape: box });
const cup = await bitbybit.occt.operations.makeThickSolidByJoin({
shape: box,
shapes: [faces[0]],
offset: -1,
tolerance: 1e-3,
intersection: false,
selfIntersection: false,
joinType: Bit.Inputs.OCCT.joinTypeEnum.arc,
removeIntEdges: false,
});
Offsets a wire that does not lie in one plane: every point moves by offset at right angles to
both the wire and direction, keeping its height along direction.
Best on smooth wires; round sharp corners first with fillets.fillet3DWire, since at one the
offset edges do not meet and come back as a list of edges.
The wire, the offset distance and the direction to offset across
The offset wire, or its edges in order when they do not meet
Sweeps one or more profile shapes along a path wire and closes the result into a solid.
The profiles should be placed on the path; with several profiles the sweep blends from one to the next along the way.
The path wire and the profile shapes placed on it
The swept solid
Sweeps a regular polygon along a wire, giving a tube with nrCorners flat sides, for
instance a hexagonal bar along a path.
The polygon of radius is placed at the start of the wire, perpendicular to it. makeSolid
gives a solid instead of a shell, trihedronEnum chooses how the profile turns along the
path, and forceApproxC1 smooths the result.
The path wire, the polygon radius and corner count, and the sweep options
The swept solid or shell
Sweeps a circle along each of several wires, as pipeWireCylindrical does for one, all with
the same radius and options.
The path wires, the radius and the sweep options
One tube per wire, in the same order
Sweeps a circle along a wire, giving a round tube of the given radius that follows the path.
The circle is placed at the start of the wire, perpendicular to it. makeSolid gives a solid
instead of a shell, trihedronEnum chooses how the profile turns as it follows the path, and
forceApproxC1 smooths the result.
The path wire, the radius and the sweep options
The tube as a solid or shell
Sweeps a profile along a flat spine, keeping its place beside it, as a moulding follows a wall.
Draw the profile about the origin: x along the spine, y to the left of travel, inside a counter-clockwise loop, and z up from the spine's plane. A spine out of plane is refused.
The flat spine, the profile and whether to make a solid
The swept shell or solid
const spine = await bitbybit.occt.shapes.wire.createSquareWire({ size: 10, center: [0, 0, 0], direction: [0, 1, 0] });
const profile = await bitbybit.occt.shapes.wire.createPolygonWire({ points: [[0, 0, 0], [0, 1, 0], [0, 1, 3], [0, 0, 3]] });
const wall = await bitbybit.occt.operations.sweepEvolved({ spine, profile, makeSolid: true });
Sweeps a profile along a spine while scaling it, such as a tube that widens toward one end.
params are places along the spine from 0 to 1, each scaled by the entry of scales at the
same position; between them the scale changes smoothly. Place the profile across the start of
the spine; makeSolid needs it closed.
The spine, the profile, the places and their scales, and whether to make a solid
The swept solid or shell
const spine = await bitbybit.occt.shapes.edge.line({ start: [0, 0, 0], end: [0, 10, 0] });
const profile = await bitbybit.occt.shapes.wire.createCircleWire({ radius: 1, center: [0, 0, 0], direction: [0, 1, 0] });
const horn = await bitbybit.occt.operations.pipeWithScaling({ spine, profile, params: [0, 1], scales: [1, 2], makeSolid: true });
Spins a shape around an axis through the origin to sweep out a surface or solid: a face gives a solid, a wire a shell.
angle is in degrees and may be negative to spin the other way; 360 or more either way makes
a full turn, and 0 throws. The profile must not cross the axis along direction.
The profile shape, the angle in degrees, the axis direction and whether to copy the geometry
The revolved shape
Revolves a shape as revolve does, and reports what each part of the profile became:
history.firstFaces and lastFaces are the ends of a partial turn, history.facesFromEdges
the surface swept from each profile edge, a whole turn included.
The profile, the angle in degrees, the axis direction and the copy flag
The revolved shape and its history
Draws a shape seen from a view frame as a technical drawing does, flat on the XZ plane: the edges the eye sees and those that faces hide.
The eye looks back along the frame's normal. Its origin lands on the world origin, its direction on x and the normal crossed with the direction on z. Both compounds hold edges.
The shape, the view frame and the drawing options
The visible and the hidden edges, each a compound on the XZ plane
The modeling operations that turn OpenCascade wires and faces into surfaces and solids and measure shapes: lofting through sections, extruding and revolving, sweeping profiles along paths, offsetting, thickening shells into solids, slicing, sectioning and splitting, and hidden-line drawings, plus bounding boxes, bounding spheres and closest-point queries, which move to
analysis.measurein the next major version. Distances are in model units and angles in degrees; every operation returns a new shape. Booleans live inbooleans, rounding infilletsand local features such as holes infeatures.