@bitbybit-dev/occt
Version:
Bit By Bit Developers CAD algorithms using OpenCascade Technology kernel. Run in Node and in Browser.
107 lines (106 loc) • 5.11 kB
TypeScript
import { BitbybitOcctModule, TopoDS_Shape } from "../../bitbybit-dev-occt/bitbybit-dev-occt";
import { OccHelper } from "../occ-helper";
import * as Inputs from "../api/inputs";
import * as Models from "../api/models";
import { IO } from "@bitbybit-dev/base/lib/api/inputs";
export declare class OCCTIO {
private readonly occ;
private readonly och;
constructor(occ: BitbybitOcctModule, och: OccHelper);
saveShapeSTEP(inputs: Inputs.OCCT.SaveStepDto<TopoDS_Shape>): string;
saveShapeStl(inputs: Inputs.OCCT.SaveStlDto<TopoDS_Shape>): string;
/** This function parses the contents of a `.STEP` or `.IGES` file as a Shape.
*
* Accepts:
* - string: for plain text files (.step, .stp, .iges, .igs)
* - ArrayBuffer: for compressed files (.stpz, .igz) or binary content
*/
loadSTEPorIGES(inputs: Inputs.OCCT.LoadStepOrIgesDto): TopoDS_Shape | undefined;
shapeToDxfPaths(inputs: Inputs.OCCT.ShapeToDxfPathsDto<TopoDS_Shape>): IO.DxfPathDto[];
dxfPathsWithLayer(inputs: Inputs.OCCT.DxfPathsWithLayerDto): IO.DxfPathsPartDto;
dxfCreate(inputs: Inputs.OCCT.DxfPathsPartsListDto): string;
/**
* Convert a STEP file to glTF format (binary GLB).
*
* Uses OCCT's native RWGltf_CafWriter for fast conversion with full preservation of:
* - Assembly hierarchy (as glTF node tree)
* - Instance/product names
* - Surface colors and materials
* - Transformations
*
* The coordinate system is automatically converted from OCCT (Z-up) to glTF (Y-up).
*
* Note: File/Blob inputs must be converted to ArrayBuffer before calling this method.
* The worker layer handles this conversion automatically.
*
* @param inputs - STEP file content and mesh precision settings. Accepts string, ArrayBuffer, or Uint8Array.
* @returns GLB binary data as Uint8Array (can be used directly with Three.js, Babylon.js, etc.)
*/
convertStepToGltf(inputs: Inputs.OCCT.ConvertStepToGltfDto): Uint8Array;
/**
* Convert a STEP file to glTF format with full control over all options.
*
* This advanced method allows fine-grained control over:
* - STEP reading options (colors, names, materials, layers, props)
* - Mesh generation options (deflection, angle, parallel, threshold)
* - glTF export options (merge faces, indices, naming, transforms)
*
* Use this for performance tuning - disable features you don't need for faster processing.
*
* @param inputs - Advanced options including STEP data, mesh settings, and glTF export settings.
* @returns GLB binary data as Uint8Array
*/
convertStepToGltfAdvanced(inputs: Inputs.OCCT.ConvertStepToGltfAdvancedDto): Uint8Array;
/**
* Convert a STEP file to glTF format (binary GLB) with explicit Draco
* geometry compression settings.
*
* Same conversion path as `convertStepToGltf` but exposes the Draco knobs
* supported by the underlying native function.
*
* @param inputs - STEP file content, mesh precision settings, and Draco knobs.
* @returns GLB binary data as Uint8Array
*/
convertStepToGltfWithDraco(inputs: Inputs.OCCT.ConvertStepToGltfWithDracoDto): Uint8Array;
/**
* Convert a STEP file to glTF format with full control over all reading, meshing
* and writer options, plus explicit Draco geometry compression settings.
*
* Same conversion path as `convertStepToGltfAdvanced` but exposes the 8 Draco
* knobs.
*
* @param inputs - Advanced options including STEP data, mesh settings, glTF
* export settings and Draco knobs.
* @returns GLB binary data as Uint8Array
*/
convertStepToGltfAdvancedWithDraco(inputs: Inputs.OCCT.ConvertStepToGltfAdvancedWithDracoDto): Uint8Array;
/**
* Parse a STEP file and return the assembly structure as JSON.
*
* Uses OCCT's native XCAFPrs_DocumentExplorer for efficient traversal.
* Runs entirely in C++ for maximum performance.
*
* Note: File/Blob inputs must be converted to ArrayBuffer before calling this method.
* The worker layer handles this conversion automatically.
*
* Returns an object containing an array of nodes with:
* - id: Unique path identifier for each node
* - name: Part or assembly name
* - isAssembly: Whether this is an assembly node (has children)
* - visible: Visibility flag
* - colorRgba: Surface colorRgba (if set) with r, g, b, a components
* - transform: 4x4 transformation matrix in column-major order (if not identity)
*
* @param inputs - STEP file content. Accepts string, ArrayBuffer, or Uint8Array.
* @returns Parsed assembly structure
*/
parseStepToJson(inputs: Inputs.OCCT.ParseStepAssemblyToJsonDto): Models.OCCT.AssemblyJsonResult;
/**
* Convert gltfNameFormatEnum string to OCCT numeric value.
*/
private gltfNameFormatEnumToOcct;
/**
* Convert gltfTransformFormatEnum string to OCCT numeric value.
*/
private gltfTransformFormatEnumToOcct;
}