Bitbybit Docs
    Preparing search index...

    Class OCCTFace

    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, or as ready-made flat shapes (circles, rectangles, stars, beam profiles) that lie on the ground plane unless direction says otherwise; walk their surface through UV parameters to get points, normals and grids of wires; cut hole patterns into them; 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, which shapes.shell handles.

    Index

    Constructors

    beam profiles

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

      Parameters

      • inputs: IBeamProfileDto

        The profile size, the two thicknesses, the alignment, the rotation, the center and the plane normal

      Returns Promise<TopoDSFacePointer>

      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.

      Parameters

      • inputs: HBeamProfileDto

        The profile size, the two thicknesses, the alignment, the rotation, the center and the plane normal

      Returns Promise<TopoDSFacePointer>

      The H-beam profile face

      const profile = await bitbybit.occt.shapes.face.createHBeamProfileFace({
      width: 20,
      height: 10,
      webThickness: 2,
      flangeThickness: 3,
      alignment: Bit.Inputs.Base.basicAlignmentEnum.midMid,
      rotation: 0,
      center: [0, 0, 0],
      direction: [0, 1, 0],
      });
    • 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.

      Parameters

      • inputs: TBeamProfileDto

        The profile size, the two thicknesses, the alignment, the rotation, the center and the plane normal

      Returns Promise<TopoDSFacePointer>

      The T-beam profile face

      const profile = await bitbybit.occt.shapes.face.createTBeamProfileFace({
      width: 10,
      height: 12,
      webThickness: 2,
      flangeThickness: 2,
      alignment: Bit.Inputs.Base.basicAlignmentEnum.midMid,
      rotation: 0,
      center: [0, 0, 0],
      direction: [0, 1, 0],
      });
    • 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.

      Parameters

      • inputs: UBeamProfileDto

        The profile size, the thicknesses, the flange width, the alignment, the rotation, the center and the plane normal

      Returns Promise<TopoDSFacePointer>

      The U-beam profile face

      const profile = await bitbybit.occt.shapes.face.createUBeamProfileFace({
      width: 10,
      height: 6,
      webThickness: 1,
      flangeThickness: 1,
      flangeWidth: 3,
      alignment: Bit.Inputs.Base.basicAlignmentEnum.midMid,
      rotation: 0,
      center: [0, 0, 0],
      direction: [0, 1, 0],
      });

    debug

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

      Parameters

      Returns Promise<FaceDebugInfo>

      The report

      const info = await bitbybit.occt.shapes.face.debugInfo({ shape: face });
      console.log(info.type, info.isPlanar, info.area);

    extract

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

      Parameters

      Returns Promise<Point3[]>

      The points, row by row

      const points = await bitbybit.occt.shapes.face.subdivideToPoints({
      shape: face,
      nrDivisionsU: 10,
      nrDivisionsV: 5,
      shiftHalfStepU: false,
      removeStartEdgeU: false,
      removeEndEdgeU: false,
      shiftHalfStepV: false,
      removeStartEdgeV: false,
      removeEndEdgeV: false,
      });
    • 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.

      Parameters

      Returns Promise<TopoDSWirePointer[]>

      The wires, in order along the chosen direction

      const lines = await bitbybit.occt.shapes.face.subdivideToWires({ shape: face, nrDivisions: 10, isU: true, shiftHalfStep: false, removeStart: false, removeEnd: false });
      
    • 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.

      Parameters

      Returns Promise<Point3[]>

      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.

      Parameters

      Returns Promise<Vector3[]>

      The unit normals, row by row

      const normals = await bitbybit.occt.shapes.face.subdivideToNormals({
      shape: face,
      nrDivisionsU: 10,
      nrDivisionsV: 5,
      shiftHalfStepU: false,
      removeStartEdgeU: false,
      removeEndEdgeU: false,
      shiftHalfStepV: false,
      removeStartEdgeV: false,
      removeEndEdgeV: false,
      });
    • 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.

      Parameters

      Returns Promise<Point2[]>

      The UV pairs, row by row

      const uvs = await bitbybit.occt.shapes.face.subdivideToUV({
      shape: face,
      nrDivisionsU: 10,
      nrDivisionsV: 5,
      shiftHalfStepU: false,
      removeStartEdgeU: false,
      removeEndEdgeU: false,
      shiftHalfStepV: false,
      removeStartEdgeV: false,
      removeEndEdgeV: false,
      });
    • 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.

      Parameters

      Returns Promise<Point3>

      The point on the surface

      const middle = await bitbybit.occt.shapes.face.pointOnUV({ shape: face, paramU: 0.5, paramV: 0.5 });
      
    • 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.

      Parameters

      Returns Promise<Vector3>

      The unit normal

      const normal = await bitbybit.occt.shapes.face.normalOnUV({ shape: face, paramU: 0.5, paramV: 0.5 });
      
    • 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.

      Parameters

      Returns Promise<Point3[]>

      One point per pair, in the same order

      const points = await bitbybit.occt.shapes.face.pointsOnUVs({ shape: face, paramsUV: [[0, 0], [0.5, 0.5], [1, 1]] });
      
    • 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 of the underlying surface; unlike normalOnUV, they are not flipped for a reversed face.

      Parameters

      Returns Promise<Vector3[]>

      One unit normal per pair, in the same order

      const normals = await bitbybit.occt.shapes.face.normalsOnUVs({ shape: face, paramsUV: [[0, 0], [0.5, 0.5], [1, 1]] });
      
    • 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.

      Parameters

      Returns Promise<Point3[]>

      The points along the line, in order

      const midline = await bitbybit.occt.shapes.face.subdivideToPointsOnParam({ shape: face, isU: true, param: 0.5, nrPoints: 10, shiftHalfStep: false, removeStartPoint: false, removeEndPoint: false });
      
    • 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.

      Parameters

      Returns Promise<TopoDSWirePointer>

      The wire on the surface

      const middle = await bitbybit.occt.shapes.face.wireAlongParam({ shape: face, isU: true, param: 0.5 });
      
    • 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.

      Parameters

      Returns Promise<TopoDSWirePointer[]>

      One wire per fraction, in the same order

      const wires = await bitbybit.occt.shapes.face.wiresAlongParams({ shape: face, isU: false, params: [0.25, 0.5, 0.75] });
      

    filter

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

      Parameters

      Returns Promise<Point3[]>

      The points that passed, in their original order

      const onFace = await bitbybit.occt.shapes.face.filterFacePoints({
      shape: face,
      points: grid,
      tolerance: 1e-4,
      useBndBox: false,
      gapTolerance: 0.1,
      keepIn: true,
      keepOn: true,
      keepOut: false,
      keepUnknown: false,
      });
    • 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.

      Parameters

      Returns Promise<Point3[] | Point3[][]>

      One list of points per face, or a single joined list

      const perFace = await bitbybit.occt.shapes.face.filterFacesPoints({
      shapes: faces,
      points: grid,
      tolerance: 1e-4,
      useBndBox: false,
      gapTolerance: 0.1,
      keepIn: true,
      keepOn: true,
      keepOut: false,
      keepUnknown: false,
      flatPointsArray: false,
      });

    from

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

      Parameters

      Returns Promise<TopoDSFacePointer[]>

      One face per wire, in the same order

      const patches = await bitbybit.occt.shapes.face.createFacesFromWiresOnFace({ wires: circlesOnSphere, face: sphereFace, inside: true });
      
    • 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.

      Parameters

      Returns Promise<TopoDSFacePointer>

      The new face

      const patch = await bitbybit.occt.shapes.face.createFaceFromWireOnFace({ wire: circleOnCylinder, face: cylinderFace, inside: true });
      
    • 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.

      Parameters

      Returns Promise<TopoDSFacePointer>

      The new face

      const wire = await bitbybit.occt.shapes.wire.createCircleWire({ radius: 5, center: [0, 0, 0], direction: [0, 1, 0] });
      const disc = await bitbybit.occt.shapes.face.createFaceFromWire({ shape: wire, planar: true });
    • 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.

      Parameters

      Returns Promise<TopoDSFacePointer>

      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.

      Parameters

      Returns Promise<TopoDSFacePointer>

      The face with holes

      const perforated = await bitbybit.occt.shapes.face.createFaceFromWiresOnFace({ wires: [outerOnCylinder, holeOnCylinder], face: cylinderFace, inside: true });
      
    • 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.

      Parameters

      Returns Promise<TopoDSFacePointer[]>

      One face per wire, in the same order

      const faces = await bitbybit.occt.shapes.face.createFacesFromWires({ shapes: wires, planar: true });
      
    • 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.

      Parameters

      Returns Promise<TopoDSShapePointer>

      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.

      Parameters

      Returns Promise<TopoDSShapePointer>

      The fused shape, or the compound of belt faces

      const mesh = await bitbybit.occt.shapes.face.createFaceFromMultipleCircleTanWireCollections({
      listsOfCircles: [bottomRow, middleRow, topRow],
      combination: Bit.Inputs.OCCT.combinationCirclesForFaceEnum.inOrderClosed,
      unify: true,
      tolerance: 1e-7,
      });
    • 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.

      Parameters

      Returns Promise<TopoDSFacePointer>

      The face

      const face = await bitbybit.occt.shapes.face.faceFromSurface({ shape: surface, tolerance: 1e-7 });
      

    from base

    • Creates a flat triangular face from three points.

      Parameters

      Returns Promise<TopoDSFacePointer>

      The face

      const face = await bitbybit.occt.shapes.face.fromBaseTriangle({ triangle: [[0, 0, 0], [10, 0, 0], [0, 0, 10]] });
      
    • 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.

      Parameters

      Returns Promise<TopoDSFacePointer[]>

      One face per triangle that could be built

      const faces = await bitbybit.occt.shapes.face.fromBaseMesh({
      mesh: [[[0, 0, 0], [10, 0, 0], [0, 0, 10]], [[10, 0, 0], [10, 0, 10], [0, 0, 10]]],
      });

    get

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

      Parameters

      Returns Promise<TopoDSFacePointer>

      The face at that index

      const first = await bitbybit.occt.shapes.face.getFace({ shape: box, index: 0 });
      
    • 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.

      Parameters

      Returns Promise<TopoDSFacePointer>

      The flipped face

      const flipped = await bitbybit.occt.shapes.face.reversedFace({ shape: 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.

      Parameters

      Returns Promise<number>

      The lower U bound

      const uMin = await bitbybit.occt.shapes.face.getUMinBound({ shape: face });
      
    • Reads the largest U parameter value of a face, in the surface's own units.

      Parameters

      Returns Promise<number>

      The upper U bound

      const uMax = await bitbybit.occt.shapes.face.getUMaxBound({ shape: face });
      
    • Reads the smallest V parameter value of a face, in the surface's own units.

      Parameters

      Returns Promise<number>

      The lower V bound

      const vMin = await bitbybit.occt.shapes.face.getVMinBound({ shape: face });
      
    • Reads the largest V parameter value of a face, in the surface's own units.

      Parameters

      Returns Promise<number>

      The upper V bound

      const vMax = await bitbybit.occt.shapes.face.getVMaxBound({ shape: face });
      
    • Measures the surface area of a face, in square model units.

      Parameters

      Returns Promise<number>

      The area

      const area = await bitbybit.occt.shapes.face.getFaceArea({ shape: face });
      
    • Measures the surface area of each face in a list, in square model units.

      Parameters

      Returns Promise<number[]>

      One area per face, in the same order

      const areas = await bitbybit.occt.shapes.face.getFacesAreas({ shapes: faces });
      
    • 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.

      Parameters

      Returns Promise<Point3>

      The center of mass

      const center = await bitbybit.occt.shapes.face.getFaceCenterOfMass({ shape: face });
      
    • Finds the center of mass of each face in a list.

      Parameters

      Returns Promise<Point3[]>

      One point per face, in the same order

      const centers = await bitbybit.occt.shapes.face.getFacesCentersOfMass({ shapes: faces });
      

    patterns

    • Lays rectangular wires over a face, one per cell of an nrRectanglesU by nrRectanglesV division of its UV range, following the surface.

      The border offsets trim the range at each end. Each rectangle sits centered in its cell, sized by the scale patterns as a fraction of it; the fillet pattern rounds corners, the inclusion pattern skips cells.

      Parameters

      Returns Promise<TopoDSWirePointer[]>

      The rectangle wires, cell by cell

      const cells = await bitbybit.occt.shapes.face.subdivideToRectangleWires({
      shape: face,
      nrRectanglesU: 6,
      nrRectanglesV: 4,
      scalePatternU: [0.8, 0.5],
      scalePatternV: [0.8],
      filletPattern: [0.3],
      inclusionPattern: [true, true, false],
      offsetFromBorderU: 0.05,
      offsetFromBorderV: 0.05,
      });
    • Cuts a grid of rectangular holes into a face and returns the perforated face.

      The holes follow the same cells and patterns as subdivideToRectangleWires; when no scale pattern is given each hole covers half its cell. With holesToFaces true the result also carries one face per hole, after the perforated face, which is handy for lids or fillers.

      Parameters

      Returns Promise<TopoDSFacePointer[]>

      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.

      The border offsets trim a fraction of the range at each end; flatU turns a flat side toward U, the extend flags stretch the outer rows past the edges. Scale, fillet and inclusion patterns repeat per hexagon.

      Parameters

      Returns Promise<TopoDSWirePointer[]>

      The hexagon wires, row by row

      const cells = await bitbybit.occt.shapes.face.subdivideToHexagonWires({
      shape: face,
      nrHexagonsU: 8,
      nrHexagonsV: 6,
      flatU: false,
      scalePatternU: [0.9],
      scalePatternV: [0.9],
      filletPattern: [0.2],
      inclusionPattern: [true],
      offsetFromBorderU: 0,
      offsetFromBorderV: 0,
      });
    • Cuts a honeycomb of hexagonal holes into a face and returns the perforated face.

      The holes follow the same layout and patterns as subdivideToHexagonWires; when no scale pattern is given each hole is half the size of its hexagon. With holesToFaces true the result also carries one face per hole, after the perforated face.

      Parameters

      Returns Promise<TopoDSFacePointer[]>

      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,
      });

    primitives

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

      Parameters

      Returns Promise<TopoDSFacePointer>

      The face

      const face = await bitbybit.occt.shapes.face.createPolygonFace({ points: [[0, 0, 0], [10, 0, 0], [10, 0, 10], [0, 0, 10]] });
      
    • 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.

      Parameters

      Returns Promise<TopoDSFacePointer>

      The disc face

      const disc = await bitbybit.occt.shapes.face.createCircleFace({ radius: 5, center: [0, 0, 0], direction: [0, 1, 0] });
      
    • 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.

      Parameters

      • inputs: HexagonsInGridDto

        The rectangle size, the hexagon counts, the extend flags and the optional patterns

      Returns Promise<TopoDSFacePointer[]>

      One face per hexagon, row by row

      const cells = await bitbybit.occt.shapes.face.hexagonsInGrid({
      width: 20,
      height: 10,
      nrHexagonsInWidth: 8,
      nrHexagonsInHeight: 4,
      flatTop: false,
      scalePatternWidth: [0.9],
      scalePatternHeight: [0.9],
      });
    • 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.

      Parameters

      Returns Promise<TopoDSFacePointer>

      The ellipse face

      const face = await bitbybit.occt.shapes.face.createEllipseFace({ radiusMinor: 3, radiusMajor: 6, center: [0, 0, 0], direction: [0, 1, 0] });
      
    • 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.

      Parameters

      Returns Promise<TopoDSFacePointer>

      The square face

      const face = await bitbybit.occt.shapes.face.createSquareFace({ size: 10, center: [0, 0, 0], direction: [0, 1, 0] });
      
    • 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.

      Parameters

      Returns Promise<TopoDSFacePointer>

      The rectangle face

      const face = await bitbybit.occt.shapes.face.createRectangleFace({ width: 20, length: 10, center: [0, 0, 0], direction: [0, 1, 0] });
      
    • 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.

      Parameters

      • inputs: LPolygonDto

        The two leg sizes, the alignment, the rotation, the center and the plane normal

      Returns Promise<TopoDSFacePointer>

      The L-shaped face

      const face = await bitbybit.occt.shapes.face.createLPolygonFace({
      widthFirst: 2,
      lengthFirst: 10,
      widthSecond: 2,
      lengthSecond: 6,
      align: Bit.Inputs.OCCT.directionEnum.outside,
      rotation: 0,
      center: [0, 0, 0],
      direction: [0, 1, 0],
      });
    • 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.

      Parameters

      • inputs: Bit.Inputs.OCCT.StarDto

        The two radii, the number of rays, the center, the plane normal and the options

      Returns Promise<TopoDSFacePointer>

      The star face

      const star = await bitbybit.occt.shapes.face.createStarFace({ outerRadius: 5, innerRadius: 2, numRays: 5, center: [0, 0, 0], direction: [0, 1, 0], offsetOuterEdges: 0, half: false });
      
    • 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.

      Parameters

      • inputs: ChristmasTreeDto

        The tree proportions, the trunk size, the options, the origin and the trunk-to-tip direction

      Returns Promise<TopoDSFacePointer>

      The tree face

      const tree = await bitbybit.occt.shapes.face.createChristmasTreeFace({
      height: 10,
      innerDist: 1.5,
      outerDist: 4,
      nrSkirts: 4,
      trunkHeight: 1.5,
      trunkWidth: 1,
      half: false,
      rotation: 0,
      origin: [0, 0, 0],
      direction: [0, 1, 0],
      });
    • 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.

      Parameters

      • inputs: ParallelogramDto

        The width, the height, the lean angle, whether to center it, the center and the plane normal

      Returns Promise<TopoDSFacePointer>

      The parallelogram face

      const face = await bitbybit.occt.shapes.face.createParallelogramFace({ width: 10, height: 5, angle: 30, aroundCenter: true, center: [0, 0, 0], direction: [0, 1, 0] });
      
    • 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.

      Parameters

      • inputs: Heart2DDto

        The approximate size, the rotation, the center and the plane normal

      Returns Promise<TopoDSFacePointer>

      The heart face

      const heart = await bitbybit.occt.shapes.face.createHeartFace({ sizeApprox: 10, rotation: 0, center: [0, 0, 0], direction: [0, 1, 0] });
      
    • 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.

      Parameters

      • inputs: NGonWireDto

        The number of corners, the radius, the center and the plane normal

      Returns Promise<TopoDSFacePointer>

      The polygon face

      const hexagon = await bitbybit.occt.shapes.face.createNGonFace({ nrCorners: 6, radius: 5, center: [0, 0, 0], direction: [0, 1, 0] });
      

    rebuild

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

      Parameters

      Returns Promise<TopoDSFacePointer>

      The rebuilt face

      const smoother = await bitbybit.occt.shapes.face.rebuildFaceDegree({ shape: face, uDegree: 2, vDegree: 2, tolerance: 0.01, keepTrim: true });
      
    • 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.

      Parameters

      Returns Promise<TopoDSFacePointer>

      The face with the changed parametrization

      const flipped = await bitbybit.occt.shapes.face.flipFaceUV({ shape: face, swapUV: true, reverseU: false, reverseV: false });
      
    • 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.

      Parameters

      Returns Promise<TopoDSFacePointer>

      The reparametrized face

      const even = await bitbybit.occt.shapes.face.normalizeFaceParametrization({ shape: face, normalizeU: true, normalizeV: true, samples: 50, tolerance: 0.001 });