Creates the flat cross-section of an I-beam: two horizontal flanges joined by a vertical web.
width is the flange width, height the total height, webThickness and flangeThickness
the wall thicknesses; alignment says which point of the profile's box sits on center,
rotation turns it in its plane, in degrees. It lies on the ground, ready to extrude along
Y.
The profile size, the two thicknesses, the alignment, the rotation, the center and the plane normal
The I-beam profile face
const profile = await bitbybit.occt.shapes.face.createIBeamProfileFace({
width: 10,
height: 20,
webThickness: 2,
flangeThickness: 3,
alignment: Bit.Inputs.Base.basicAlignmentEnum.midMid,
rotation: 0,
center: [0, 0, 0],
direction: [0, 1, 0],
});
const beam = await bitbybit.occt.operations.extrude({ shape: profile, direction: [0, 100, 0] });
Creates the flat cross-section of an H-beam: two vertical flanges joined by a horizontal web, an I-beam on its side.
width is the total width, height the flange height, webThickness and flangeThickness
the wall thicknesses; alignment says which point of the profile's box sits on center,
rotation turns it in its plane, in degrees. It lies on the ground.
The profile size, the two thicknesses, the alignment, the rotation, the center and the plane normal
The H-beam profile face
Creates the flat cross-section of a T-beam: a horizontal flange with a vertical web hanging from its middle.
width is the flange width, height the total height, webThickness and flangeThickness
the wall thicknesses; alignment says which point of the profile's box sits on center, and
rotation turns it in its plane, in degrees. It lies flat on the ground.
The profile size, the two thicknesses, the alignment, the rotation, the center and the plane normal
The T-beam profile face
Creates the flat cross-section of a U-beam, a channel: a web with two flanges of
flangeWidth standing up from its ends.
width and height are the total size, webThickness and flangeThickness the wall
thicknesses; alignment says which point of the profile's box sits on center, rotation
turns it in its plane, in degrees. It lies flat on the ground.
The profile size, the thicknesses, the flange width, the alignment, the rotation, the center and the plane normal
The U-beam profile face
Collects diagnostic facts about a face: its surface type, U and V degrees, control point and knot counts, whether U or V are closed, periodic or rational, the UV bounds, area, planarity, orientation and the number of wires and edges.
An empty or null face gives a report marked invalid.
The face to inspect
The report
Lays a plane, cylinder or cone face out flat without stretching it, as the pattern a sheet is cut from.
Lengths and areas are kept, holes and notches included, and a closed face opens along its seam. The flat face lies on the ground plane facing +Y, as the other flat shapes do, ready for a DXF export.
The face and the tolerance of the flat edges
The flat face on the XZ plane
const cylinder = await bitbybit.occt.shapes.solid.createCylinder({ radius: 2, height: 5, center: [0, 0, 0], direction: [0, 1, 0] });
const wall = await bitbybit.occt.shapes.face.getFace({ shape: cylinder, index: 0 });
const pattern = await bitbybit.occt.shapes.face.unroll({ shape: wall, tolerance: 1e-4 });
Lays a grid of points over a face by stepping evenly through its U and V ranges.
nrDivisionsU by nrDivisionsV points cover the face edge to edge, listed row by row: all V
values for the first U, then the next U. The removal flags drop the first or last row; the
shift flags push every point half a step.
The face, the number of points in U and V, and the shift and removal options
The points, row by row
Draws evenly spaced wires across a face along one parameter direction, like the lines of a ruled sheet.
nrDivisions steps give one more wire than that, the boundary lines included; removeStart
and removeEnd drop those, shiftHalfStep moves every wire half a step. With isU true
each wire sits at a fixed U and runs across V; false swaps the roles.
The face, the number of divisions, the direction and the options
The wires, in order along the chosen direction
Lays a grid of points over a face like subdivideToPoints, but shifts and removes points on
every nth row or column, for brick-like and staggered patterns.
Each rule is a pair: shiftHalfStepNthU says every how-manyth V row moves half a step in U,
shiftHalfStepUOffsetN where counting starts; the removal rules drop every nth point of an
edge row.
The face, the number of points in U and V, and the nth-row shift and removal rules
The points, row by row
const staggered = await bitbybit.occt.shapes.face.subdivideToPointsControlled({
shape: face,
nrDivisionsU: 10,
nrDivisionsV: 10,
shiftHalfStepNthU: 2,
shiftHalfStepUOffsetN: 0,
removeStartEdgeNthU: 0,
removeStartEdgeUOffsetN: 0,
removeEndEdgeNthU: 0,
removeEndEdgeUOffsetN: 0,
shiftHalfStepNthV: 0,
shiftHalfStepVOffsetN: 0,
removeStartEdgeNthV: 0,
removeStartEdgeVOffsetN: 0,
removeEndEdgeNthV: 0,
removeEndEdgeVOffsetN: 0,
});
Computes the surface normal at every point of the grid subdivideToPoints would lay over a
face, with the same options and the same order.
The normals are unit vectors and follow the face's orientation, so a reversed face gives them
flipped. Pair the list with subdivideToPoints to place things standing on the surface.
The face, the number of points in U and V, and the shift and removal options
The unit normals, row by row
Lists the UV parameter pairs of the grid subdivideToPoints would lay over a face, with the
same options and the same order.
The pairs are in the face's real UV values, not fractions.
The face, the number of points in U and V, and the shift and removal options
The UV pairs, row by row
Finds the point on a face at the given UV fractions.
paramU and paramV run from 0 to 1 over the face's U and V range, so 0.5, 0.5 is the
middle of the range, which on a trimmed face is not always inside the face.
The face and the U and V fractions
The point on the surface
Finds the surface normal of a face at the given UV fractions.
paramU and paramV run from 0 to 1 over the face's U and V range. The normal is a unit
vector and follows the face's orientation, so a reversed face gives it flipped.
The face and the U and V fractions
The unit normal
Finds the points on a face at several UV fraction pairs at once.
Each pair holds U then V, both from 0 to 1 over the face's range.
The face and the list of U and V fraction pairs
One point per pair, in the same order
Finds the surface normals of a face at several UV fraction pairs at once.
Each pair holds U then V, both from 0 to 1 over the face's range. The normals are unit
vectors and follow the face's orientation, as normalOnUV does, so a reversed face gives them
flipped.
The face and the list of U and V fraction pairs
One unit normal per pair, in the same order
Places evenly spaced points along one straight line across a face's UV range.
With isU true the line sits at param (a fraction from 0 to 1 of the U range) and
nrPoints points spread over the whole V range; with false the roles swap.
removeStartPoint and removeEndPoint drop the ends, and shiftHalfStep moves every point
half a step.
The face, the direction, the fraction along it, the number of points and the options
The points along the line, in order
Draws one wire across a face along a parameter line, following the surface.
With isU true the wire sits at param (a fraction from 0 to 1 of the U range) and runs
over the whole V range; with false the roles swap.
The face, the direction and the fraction along it
The wire on the surface
Draws several wires across a face, one per parameter value, following the surface.
With isU true each wire sits at its fraction of the U range and runs over the whole V
range; with false the roles swap. The wires ignore the face's trims; isoCurves gives the
exact curves trimmed to the face.
The face, the direction and the fractions along it
One wire per fraction, in the same order
Finds a face's exact iso curves at fractions of its UV range, trimmed to the face.
With isU true each curve holds u at its fraction and runs along v; false swaps them. A curve
stops at a hole and goes on past it; 0 and 1 give the boundary, and values outside give none.
The face, the direction and the fractions
The edges, value after value, each value's pieces in order along the curve
Sorts points as inside a face, on its boundary or outside it, and keeps the chosen groups.
keepIn, keepOn, keepOut and keepUnknown choose the groups; tolerance decides how
close to the boundary counts as on it. With useBndBox, a point outside the bounding box
grown by gapTolerance is outside.
The face, the points, the tolerance, the bounding-box shortcut and which groups to keep
The points that passed, in their original order
Runs filterFacePoints against several faces with the same points and options.
By default the result holds one list per face; with flatPointsArray true the lists are
joined into one, so a point on two faces appears twice.
The faces, the points, the tolerance, which groups to keep and whether to flatten the result
One list of points per face, or a single joined list
Finds the frame of a face at a UV fraction pair, where a profile or a copy would sit: at the
surface point, normal as normalOnUV gives it, direction along U.
U and V run from 0 to 1 over the face's range. Where the surface has no normal, as at a cone's point, it is read inside the face.
The face and the U and V fractions
The frame at that place
Finds the frames of a face at several UV fraction pairs at once, each as frameOnUV finds it.
The face and the list of U and V fraction pairs
One frame per pair, in the same order
Places frames on a face in a grid, one at each point subdivideToPoints gives for the same
inputs, each turned as frameOnUV turns it.
The frames come in the order of the points, their normals match subdivideToNormals and
their X axes run along the face's U direction.
The face, the number of points in U and V, and the shift and removal options
One frame per point of the grid, in order
const frames = await bitbybit.occt.shapes.face.subdivideToFrames({
shape: face,
nrDivisionsU: 5,
nrDivisionsV: 5,
shiftHalfStepU: false,
removeStartEdgeU: false,
removeEndEdgeU: false,
shiftHalfStepV: false,
removeStartEdgeV: false,
removeEndEdgeV: false,
});
const studs = await bitbybit.occt.transforms.placeOnFrames({ shape: stud, frames });
Finds the frame of a face at the place nearest a point, as frameOnUV finds it there; a point
beyond the face's edge comes to the edge.
The face and the point
The frame at the nearest place
Finds the frames of a face at the places nearest several points at once, each as
frameNearestPoint finds it.
The face and the points
One frame per point, in the same order
Creates one face per wire, each cut from the surface of a guiding face so it takes that surface's curvature.
The wires must lie on the surface. With inside true each wire is turned so its face is the
region it encloses; with false the wire's own direction decides, and a wire running the other
way gives the outside region.
The wires, the guiding face and which side to keep
One face per wire, in the same order
Creates a face from a wire that lies on the surface of a guiding face, so the new face takes the curvature of that surface.
With inside true the wire is turned so the face is the region it encloses; with false the
wire's own direction decides, and a wire running the other way gives the region outside it.
The wire, the guiding face and which side to keep
The new face
Creates a face bounded by a closed wire.
With planar true the wire must lie in one plane and the face is flat; with false a smooth
surface is fitted through the wire's edges, which fills a wire that is not flat. A shape that
is not a wire throws an error.
The wire and whether the face must be flat
The new face
Creates one face from several wires: the first wire is the outer boundary and every further wire cuts a hole in it.
With planar true the wires must lie in one plane. The hole wires must sit inside the outer
one without crossing it or each other.
The wires, outer boundary first, and whether the face must be flat
The face with holes
const outer = await bitbybit.occt.shapes.wire.createRectangleWire({ width: 20, length: 10, center: [0, 0, 0], direction: [0, 1, 0] });
const hole = await bitbybit.occt.shapes.wire.createCircleWire({ radius: 2, center: [0, 0, 0], direction: [0, 1, 0] });
const plate = await bitbybit.occt.shapes.face.createFaceFromWires({ shapes: [outer, hole], planar: true });
Creates one face from several wires on the surface of a guiding face: the first wire is the outer boundary and every further wire cuts a hole.
The face takes the curvature of the guiding surface. inside applies to the first wire: true
turns it so the face is the region it encloses; false lets its own direction decide.
The wires, outer boundary first, the guiding face and which side to keep
The face with holes
Creates one face per closed wire, each as createFaceFromWire would.
With planar true every wire must lie in a plane; with false a smooth surface is fitted
through each.
The wires and whether the faces must be flat
One face per wire, in the same order
Joins circles with tangent belts: for each pair it draws the two outer tangent lines and the outer arcs between them and fills that outline with a flat face.
combination picks the pairs: allWithAll every circle with every other, inOrder
neighbors in the list, inOrderClosed also the last with the first. unify fuses the faces;
otherwise they form a compound.
The circle wires, how to pair them, whether to fuse the result and the tolerance
The fused shape, or the compound of belt faces
const a = await bitbybit.occt.shapes.wire.createCircleWire({ radius: 3, center: [0, 0, 0], direction: [0, 1, 0] });
const b = await bitbybit.occt.shapes.wire.createCircleWire({ radius: 1, center: [10, 0, 0], direction: [0, 1, 0] });
const c = await bitbybit.occt.shapes.wire.createCircleWire({ radius: 2, center: [5, 0, 8], direction: [0, 1, 0] });
const belt = await bitbybit.occt.shapes.face.createFaceFromMultipleCircleTanWires({
circles: [a, b, c],
combination: Bit.Inputs.OCCT.combinationCirclesForFaceEnum.inOrderClosed,
unify: true,
tolerance: 1e-7,
});
Joins circles from consecutive lists with tangent belts, the way
createFaceFromMultipleCircleTanWires joins single circles.
allWithAll joins every circle of a list with every circle of the next; inOrder joins
circles at the same position in neighboring lists, which need equal lengths; inOrderClosed
also closes each list into a ring. unify fuses the faces; otherwise they form a compound.
The lists of circle wires, how to pair them, whether to fuse the result and the tolerance
The fused shape, or the compound of belt faces
Creates a face that covers a whole surface, out to the surface's natural bounds.
tolerance is used to detect degenerate edges, such as the pole of a sphere. Surfaces come
from geom.surfaces.
The surface and the tolerance for degenerate edges
The face
Creates a face by cutting a surface with a wire that lies on it.
With inside true the wire is turned so the face is the region it encloses; with false the
wire's own direction decides, and a wire running the other way gives the region outside it.
Surfaces come from geom.surfaces.
The surface, the wire on it and which side to keep
The face
Creates a B-spline face through a grid of points, or near them.
The rows step along u and each row runs along v. Interpolating passes through every point at
degree 3, closed in u when periodic; approximating keeps within tolerance at a degree from
degreeMin to degreeMax. Neighbouring rows or columns holding the same points are refused.
The rows of points, whether to interpolate, and the degrees and tolerance of an approximation
The face
Creates the ruled surface between two edges, or two wires edge by edge: straight lines from one to the other.
Each line joins the points at the same share of the two curves, so reversing one twists the surface. Wires need as many edges each, paired as each wire runs. The shapes given are left unchanged.
Two edges or two wires
A face for two edges, a shell of one face per pair of edges for two wires
const bottom = await bitbybit.occt.shapes.edge.line({ start: [0, 0, 0], end: [10, 0, 0] });
const top = await bitbybit.occt.shapes.edge.arcThroughThreePoints({ start: [0, 5, 0], middle: [5, 5, 3], end: [10, 5, 0] });
const face = await bitbybit.occt.shapes.face.ruledBetween({ shapeA: bottom, shapeB: top });
Creates a B-spline face bounded by two, three or four edges.
Four edges, in any order and direction, must close up. Of three, one must meet the other two, and a straight side closes their free ends. Two are opposite sides joined start to start; the curved style instead sweeps one along the other from a shared corner.
The boundary edges and the filling style
The face
Creates a face that fills a closed loop of edges and passes near given points.
The edges may come in any order and direction. Each continuity says whether the patch passes
through its edge, meets the face beside it at a tangent, or also bends as it does; an edge that
stores no face takes that face in supports.
The boundary edges, their continuities and support faces, the points and the fit's settings
The face
const cylinder = await bitbybit.occt.shapes.solid.createCylinder({ radius: 2, height: 5, center: [0, 0, 0], direction: [0, 1, 0] });
const side = await bitbybit.occt.shapes.face.getFace({ shape: cylinder, index: 0 });
const rim = await bitbybit.occt.shapes.edge.getEdge({ shape: cylinder, index: 0 });
const dome = await bitbybit.occt.shapes.face.fillPatch({
edges: [rim],
continuities: [Bit.Inputs.OCCT.continuityEnum.tangent],
supports: [side],
points: [[0, 7, 0]],
});
Creates a flat triangular face from three points.
The triangle as three points
The face
Creates one flat triangular face per triangle of a mesh.
A triangle that cannot form a face, for instance one with repeated points, is skipped with a warning in the console.
The mesh as a list of triangles
One face per triangle that could be built
Picks one face out of a shape by its position, counting from 0, in the order the kernel walks the shape.
The shape must be a face or something built from faces; an index beyond the last face throws an error.
The shape and the 0-based index
The face at that index
Lists every face of a shape in the order the kernel walks it.
The shape
The faces found in the shape
Flips a face so its normal points the other way.
The geometry stays the same; only the orientation changes, which decides the outside of a
shell and the direction normalOnUV reports.
The face
The flipped face
Reads the smallest U parameter value of a face, in the surface's own units.
Together with getUMaxBound, getVMinBound and getVMaxBound it gives the range that the
UV fractions used elsewhere in this class map onto.
The face
The lower U bound
Reads the largest U parameter value of a face, in the surface's own units.
The face
The upper U bound
Reads the smallest V parameter value of a face, in the surface's own units.
The face
The lower V bound
Reads the largest V parameter value of a face, in the surface's own units.
The face
The upper V bound
Measures the surface area of a face, in square model units.
The face
The area
Measures the surface area of each face in a list, in square model units.
The faces
One area per face, in the same order
Finds the center of mass of a face, the point its area balances on.
On a curved or ring-shaped face this point can lie off the surface.
The face
The center of mass
Finds the center of mass of each face in a list.
The faces
One point per face, in the same order
Lays rectangular wires over a face, one per cell of an nrRectanglesU by nrRectanglesV
division of its UV range, following the surface.
Border offsets trim the range; each rectangle is centered in its cell, sized by the scale patterns, rounded by the fillet pattern, skipped by the inclusion pattern. One crossing a trim or hole is left out.
The face, the cell counts, the border offsets and the optional patterns
The rectangle wires, cell by cell
Cuts a grid of rectangular holes into a face and returns the perforated face.
The holes follow the cells and patterns of subdivideToRectangleWires; with no scale pattern
each covers half its cell, and existing holes stay. With holesToFaces true one face per hole
follows the perforated face.
The face, the cell counts, the border offsets, the optional patterns and whether to return the hole faces
The perforated face, followed by the hole faces when asked for
const [perforated] = await bitbybit.occt.shapes.face.subdivideToRectangleHoles({
shape: face,
nrRectanglesU: 6,
nrRectanglesV: 4,
scalePatternU: [0.6],
scalePatternV: [0.6],
filletPattern: [0.5],
inclusionPattern: [true],
holesToFaces: false,
offsetFromBorderU: 0.05,
offsetFromBorderV: 0.05,
});
Lays a honeycomb of hexagonal wires over a face, nrHexagonsU by nrHexagonsV of them
fitted into its UV range, each following the surface.
Border offsets trim the range; flatU turns a flat side toward U, the extend flags stretch
the outer rows past the edges, and patterns repeat per hexagon. One crossing a trim or hole is
left out.
The face, the hexagon counts, the orientation, the border offsets, the extend flags and the optional patterns
The hexagon wires, row by row
Cuts a honeycomb of hexagonal holes into a face and returns the perforated face.
The holes follow the layout and patterns of subdivideToHexagonWires; with no scale pattern
each is half its hexagon, and existing holes stay. With holesToFaces true one face per hole
follows the perforated face.
The face, the hexagon counts, the orientation, the border offsets, the optional patterns and whether to return the hole faces
The perforated face, followed by the hole faces when asked for
const [perforated] = await bitbybit.occt.shapes.face.subdivideToHexagonHoles({
shape: face,
nrHexagonsU: 8,
nrHexagonsV: 6,
flatU: false,
holesToFaces: false,
scalePatternU: [0.7],
scalePatternV: [0.7],
filletPattern: [0],
inclusionPattern: [true],
offsetFromBorderU: 0.05,
offsetFromBorderV: 0.05,
});
Creates a flat face from a list of corner points, closing the outline from the last point back to the first.
The points must lie in one plane.
The corner points in order
The face
Creates a flat circular face, a disc.
direction is the normal of its plane: the default [0, 1, 0] lays it flat on the ground.
The disc face
Fills a rectangle on the ground plane with a grid of flat hexagonal faces, centered on the origin.
The hexagons are scaled so nrHexagonsInWidth fit across width and nrHexagonsInHeight
across height. The scale, fillet and inclusion patterns are read hexagon by hexagon and
repeat; the extend flags stretch the outer rows past the edges to cover the rectangle.
The rectangle size, the hexagon counts, the extend flags and the optional patterns
One face per hexagon, row by row
Creates a flat elliptical face.
direction is the normal of its plane: the default [0, 1, 0] lays it flat on the ground.
radiusMajor must be at least radiusMinor.
The two radii, the center and the plane normal
The ellipse face
Creates a flat square face centered on center.
direction is the normal of its plane: the default [0, 1, 0] lays it flat on the ground.
The square face
Creates a flat rectangular face centered on center.
On the ground plane width runs along X and length along Z; direction is the normal of
the plane, and the default [0, 1, 0] keeps the face flat on the ground.
The width, the length, the center and the plane normal
The rectangle face
Creates a flat L-shaped face: two rectangular legs joined at a corner.
The first leg has widthFirst and lengthFirst, the second widthSecond and
lengthSecond; align puts the corner on the outside, inside or middle of the legs, and
rotation turns the shape in its plane, in degrees. It lies flat on the ground unless
direction says otherwise.
The two leg sizes, the alignment, the rotation, the center and the plane normal
The L-shaped face
Creates a flat star-shaped face with numRays points.
The points reach outerRadius and the notches between them innerRadius; half keeps only
the first half of the rays. offsetOuterEdges lifts the ray tips out of the plane and is
meant for the wire; a flat face needs it at 0. It lies flat on the ground unless direction
says otherwise.
The star face
Creates a flat face shaped like a stylized Christmas tree: nrSkirts layers of branches,
narrowing from outerDist to innerDist off the trunk line, on a trunk of trunkHeight and
trunkWidth.
Unlike the other flat shapes here it stands upright in the XY plane, tip along Y; direction
is the trunk-to-tip direction, rotation spins it about that axis, in degrees.
The tree proportions, the trunk size, the options, the origin and the trunk-to-tip direction
The tree face
Creates a flat parallelogram face: a rectangle of width and height whose sides lean over
by angle degrees.
With aroundCenter true the shape is centered on center; otherwise it starts there and
extends in the positive directions. direction is the normal of the plane; the default [0, 1, 0] lays it flat on the ground.
The width, the height, the lean angle, whether to center it, the center and the plane normal
The parallelogram face
Creates a flat heart-shaped face that fits roughly into a square of sizeApprox.
rotation turns it in its plane, in degrees. direction is the normal of the plane; the
default [0, 1, 0] lays it flat on the ground.
The approximate size, the rotation, the center and the plane normal
The heart face
Creates a flat regular polygon face with nrCorners corners, all on a circle of radius.
direction is the normal of the plane; the default [0, 1, 0] lays it flat on the ground.
The number of corners, the radius, the center and the plane normal
The polygon face
Rebuilds the surface of a face as a B-spline of the given U and V degrees.
Lowering a degree smooths the surface into a simpler approximation within tolerance;
raising it is exact. keepTrim keeps the original boundary wires, which is reliable when
raising; otherwise the face covers the whole new surface. A rebuild that fails gives a null
face.
The face, the target U and V degrees, the tolerance and whether to keep the boundary
The rebuilt face
Changes how the UV parameters run over a face: swap U and V, reverse U, reverse V, or any combination.
The geometry stays the same; only the parameter directions change, which matters for every
method here that works in UV, such as subdivideToPoints or wireAlongParam. The face is
rebuilt over the surface's natural bounds.
The face and which flips to apply
The face with the changed parametrization
Reparametrizes a face so equal steps in U or V give roughly equal distances on the surface.
Many surfaces bunch their parameters up in places, so a UV grid over them looks uneven; this
resamples the surface at samples points per direction and refits it, which evens out
subdivideToPoints and its siblings. The face is rebuilt over the new bounds.
The face, which directions to normalize, the sample count and the fit tolerance
The reparametrized face
Faces in OpenCascade: bounded pieces of a surface, flat or curved, with an outer boundary wire and optional inner wires that make holes. Build them from wires or surfaces, through point grids, between or inside edges, or as ready-made flat shapes (circles, rectangles, stars, beam profiles) that lie on the ground plane unless
directionsays otherwise; walk their surface through UV parameters to get points, normals, iso curves and grids of wires; cut hole patterns into them, lay them flat, and measure area and center of mass. U and V are the two directions of a surface, given here as fractions from 0 to 1 of the face's own range. Faces join edge to edge into shells, whichshapes.shellhandles.