Bitbybit Docs
    Preparing search index...

    Class OCCTW

    A API OpenCascade (OCCT) tal como é acedida a partir de um script: todos os métodos do kernel occt, assíncronos, com as formas a viver no kernel e passadas como referências, mais os carregadores io que leem ficheiros STEP e IGES entregues como File ou como texto. As classes de serviço estão documentadas no próprio OCCTService do kernel.

    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
    path: OCCTPath
    svg: OCCTSVG
    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<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; smaller values follow curved surfaces more closely and cost more triangles. adjustYtoZ swaps Y and Z. A null shape gives empty lists.

      Parameters

      Returns Promise<DecomposedMeshDto>

      The mesh as face, edge and point lists

      const mesh = await bitbybit.occt.shapeToMesh({ shape: sphere, precision: 0.01, adjustYtoZ: false });
      console.log(mesh.faceList.length, mesh.edgeList.length);

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