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.
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.
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.
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; they come back together in one compound. The shape must be or contain solids, or an error is thrown.
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 is applied from the bottom of the shape up and repeats until the top is reached.
The shape, the pattern of gaps and the slicing direction
A compound of the section faces
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.
The shape and the direction vector, whose length is the distance
The extruded shape
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
The shape
The radius
Builds the bounding sphere of a shape as a sphere solid.
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 toward the surface normal, a negative one the other way. Use it to turn a lofted or swept skin into something printable.
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, by extruding it along direction, thickening
the result and reading the offset edge back off it.
It works best on smooth wires; fillet sharp corners first with fillets.fillet3DWire. When
the offset edges cannot be joined into one wire they come back as a list of edges.
The wire, the offset distance and the direction to extrude along
The offset wire, or the loose edges when they could not be joined
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
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; 360 or more gives a full turn. The axis runs along direction: a
profile beside the Y axis revolved about it gives a vase. The profile must not cross it.
The profile shape, the angle in degrees, the axis direction and whether to copy the geometry
The revolved shape
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 and splitting, plus bounding boxes, bounding spheres and closest-point queries. Distances are in model units and angles in degrees; every operation returns a new shape. Booleans live in
booleans, rounding infillets.