Bitbybit Docs
    Preparing search index...

    Class OCCTW

    The OpenCascade (OCCT) API as reached from a script: every method of the occt kernel, asynchronous, with the shapes living in the kernel and passed around as references, plus io loaders that read STEP and IGES files handed in as a File or as text. The service classes are documented on the kernel's own OCCTService.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    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
    path: OCCTPath
    sketch: OCCTSketch
    parts: OCCTParts
    svg: OCCTSVG
    design: OCCTDesign
    recipes: OCCTRecipes
    context: ContextBase
    occWorkerManager: OCCTWorkerManager

    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<Bit.Inputs.Base.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 });

    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();