Bitbybit Docs
    Preparing search index...

    Class OCCT

    The entry point to the OpenCascade kernel: every OCCT feature is reached through one of its properties. shapes builds and reads vertices, edges, wires, faces, shells, solids and compounds; operations, booleans, fillets, transforms, corners, draft and features change shapes; select picks faces and edges by what they are and where they lie; analysis answers questions about shapes with points and numbers; geom handles curves and surfaces; io reads and writes STEP, IGES, STL and other files; sketch draws flat outlines with a pen; assembly, dimensions, brepGraph, path and svg cover documents, annotations, topology graphs, machining paths and SVG. The methods on the service itself turn shapes into triangle meshes for drawing.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    occWorkerManager: OCCTWorkerManager
    shapes: OCCTShapes
    geom: OCCTGeom
    fillets: OCCTFillets
    transforms: OCCTTransforms
    operations: OCCTOperations
    booleans: OCCTBooleans
    dimensions: OCCTDimensions
    shapeFix: OCCTShapeFix
    assembly: OCCTAssembly
    brepGraph: OCCTBrepGraph
    corners: OCCTCorners
    draft: OCCTDraft
    features: OCCTFeatures
    select: OCCTSelect
    analysis: OCCTAnalysis
    io: OCCTIO
    path: OCCTPath
    sketch: OCCTSketch
    svg: OCCTSVG

    convert

    • Triangulates a shape and returns every triangle as three points, in one flat list over all faces.

      precision is the meshing tolerance in model units: smaller values follow curved surfaces more closely and give more triangles. adjustYtoZ swaps the Y and Z axes for tools that treat Z as up, and reversedPoints flips the winding of each triangle.

      Parameters

      Returns Promise<Point3[][]>

      One list of three points per triangle

      const triangles = await bitbybit.occt.shapeFacesToPolygonPoints({ shape: sphere, precision: 0.01, adjustYtoZ: false, reversedPoints: false });
      
    • Triangulates a shape into a mesh for drawing: one entry per face with its vertices, normals, UVs and triangle indexes, one per edge with its points, and the vertex points.

      precision is the meshing tolerance in model units. isoCurvesU and isoCurvesV add each face's iso curves as polylines, and surfaceAnalysis a value per vertex. A null shape gives empty lists.

      Parameters

      Returns Promise<DecomposedMeshDto>

      The mesh as face, edge and point lists, with iso curves and analysis values when asked for

      const mesh = await bitbybit.occt.shapeToMesh({ shape: sphere, precision: 0.01, isoCurvesU: 4, isoCurvesV: 4, surfaceAnalysis: Bit.Inputs.OCCT.surfaceAnalysisEnum.gaussian });
      console.log(mesh.isoCurveList?.length, mesh.faceList[0]?.analysisValues);
    • Meshes a shape into one indexed triangle mesh whose faces share vertices where they meet, the form manifold.shapes.manifoldFromMesh takes, so an OCCT solid can carry on as a Manifold solid.

      Vertices are shared through the shape's own edges, not by matching coordinates, so a closed solid gives a closed mesh. precision is the meshing tolerance.

      Parameters

      Returns Promise<Bit.Inputs.OCCT.DecomposedManifoldMeshDto>

      The mesh: three numbers per vertex and three vertex indexes per triangle

      const mesh = await bitbybit.occt.shapeToManifoldMesh({ shape: solid, precision: 0.01 });
      const manifold = await bitbybit.manifold.manifold.shapes.manifoldFromMesh({ mesh });
    • Triangulates several shapes with the same settings, as shapeToMesh does for one, iso curves and surface analysis included.

      Parameters

      Returns Promise<DecomposedMeshDto[]>

      One mesh per shape, in the same order

      const meshes = await bitbybit.occt.shapesToMeshes({ shapes: [box, sphere], precision: 0.01, isoCurvesU: 2, isoCurvesV: 2 });
      

    memory

    • Frees the memory a shape holds inside the kernel; the shape cannot be used afterwards. Call it for intermediate results a script no longer needs, so long sessions do not run out of memory.

      Parameters

      Returns Promise<void>

      const box = await bitbybit.occt.shapes.solid.createBox({ width: 10, length: 10, height: 10, center: [0, 0, 0] });
      const rounded = await bitbybit.occt.fillets.filletEdges({ shape: box, radius: 1 });
      await bitbybit.occt.deleteShape({ shape: box });
    • Frees the memory several shapes hold inside the kernel; they cannot be used afterwards. Call it for intermediate results a script no longer needs, so long sessions do not run out of memory.

      Parameters

      Returns Promise<void>

      await bitbybit.occt.deleteShapes({ shapes: [box, cylinder] });
      
    • Frees every shape the kernel holds at once, including the ones your variables still point to, so nothing created before can be used afterwards. Call it when starting over rather than between steps.

      Returns Promise<void>

      await bitbybit.occt.cleanAllCache();