@bitbybit-dev/occt
Version:
Bit By Bit Developers CAD algorithms using OpenCascade Technology kernel. Run in Node and in Browser.
1,082 lines (961 loc) • 177 kB
TypeScript
/**
* BitbybitOcct - OCCT WebAssembly Bindings
* TypeScript definitions for Open CASCADE Technology WASM module
*
* @packageDocumentation
*/
// =============================================================================
// Emscripten File System Types
// =============================================================================
export interface EmscriptenFS {
readFile(path: string, opts?: { encoding?: string; flags?: string }): string | Uint8Array;
writeFile(path: string, data: string | ArrayBufferView, opts?: { encoding?: string; flags?: string }): void;
unlink(path: string): void;
mkdir(path: string, mode?: number): void;
rmdir(path: string): void;
readdir(path: string): string[];
stat(path: string): { size: number; mtime: Date; isDirectory(): boolean; isFile(): boolean };
createDataFile(parent: string, name: string, data: string | ArrayBufferView, canRead: boolean, canWrite: boolean, canOwn?: boolean): void;
}
// =============================================================================
// Module Declaration
// =============================================================================
export interface BitbybitOcctModule {
// Emscripten File System
FS: EmscriptenFS;
// Geometry Primitives - 3D
gp_XYZ: gp_XYZ_Constructor;
gp_Pnt: gp_Pnt_Constructor;
gp_Vec: gp_Vec_Constructor;
gp_Dir: gp_Dir_Constructor;
gp_Ax1: gp_Ax1_Constructor;
gp_Ax2: gp_Ax2_Constructor;
gp_Ax3: gp_Ax3_Constructor;
gp_Mat: gp_Mat_Constructor;
gp_Trsf: gp_Trsf_Constructor;
gp_Pln: gp_Pln_Constructor;
gp_Lin: gp_Lin_Constructor;
gp_Circ: gp_Circ_Constructor;
gp_Elips: gp_Elips_Constructor;
gp_GTrsf: gp_GTrsf_Constructor;
// Geometry Primitives - 2D
gp_XY: gp_XY_Constructor;
gp_Pnt2d: gp_Pnt2d_Constructor;
gp_Vec2d: gp_Vec2d_Constructor;
gp_Dir2d: gp_Dir2d_Constructor;
gp_Ax2d: gp_Ax2d_Constructor;
gp_Ax22d: gp_Ax22d_Constructor;
gp_Lin2d: gp_Lin2d_Constructor;
gp_Circ2d: gp_Circ2d_Constructor;
gp_Elips2d: gp_Elips2d_Constructor;
gp_Trsf2d: gp_Trsf2d_Constructor;
// Topological Shapes
TopoDS_Shape: TopoDS_Shape_Constructor;
TopoDS_Vertex: TopoDS_Vertex_Constructor;
TopoDS_Edge: TopoDS_Edge_Constructor;
TopoDS_Wire: TopoDS_Wire_Constructor;
TopoDS_Face: TopoDS_Face_Constructor;
TopoDS_Shell: TopoDS_Shell_Constructor;
TopoDS_Solid: TopoDS_Solid_Constructor;
TopoDS_CompSolid: TopoDS_CompSolid_Constructor;
TopoDS_Compound: TopoDS_Compound_Constructor;
// Shape Explorer
TopExp_Explorer: TopExp_Explorer_Constructor;
// Primitive Creation
BRepPrimAPI_MakeBox: BRepPrimAPI_MakeBox_Constructor;
BRepPrimAPI_MakeCylinder: BRepPrimAPI_MakeCylinder_Constructor;
BRepPrimAPI_MakeSphere: BRepPrimAPI_MakeSphere_Constructor;
BRepPrimAPI_MakeCone: BRepPrimAPI_MakeCone_Constructor;
BRepPrimAPI_MakeTorus: BRepPrimAPI_MakeTorus_Constructor;
BRepPrimAPI_MakePrism: BRepPrimAPI_MakePrism_Constructor;
BRepPrimAPI_MakeRevol: BRepPrimAPI_MakeRevol_Constructor;
BRepPrimAPI_MakeWedge: BRepPrimAPI_MakeWedge_Constructor;
// Boolean Operations
BRepAlgoAPI_Fuse: BRepAlgoAPI_Fuse_Constructor;
BRepAlgoAPI_Cut: BRepAlgoAPI_Cut_Constructor;
BRepAlgoAPI_Common: BRepAlgoAPI_Common_Constructor;
BRepAlgoAPI_Section: BRepAlgoAPI_Section_Constructor;
BRepAlgoAPI_Splitter: BRepAlgoAPI_Splitter_Constructor;
// Shape Building
BRepBuilderAPI_MakeVertex: BRepBuilderAPI_MakeVertex_Constructor;
BRepBuilderAPI_MakeEdge: BRepBuilderAPI_MakeEdge_Constructor;
BRepBuilderAPI_MakeWire: BRepBuilderAPI_MakeWire_Constructor;
BRepBuilderAPI_MakeFace: BRepBuilderAPI_MakeFace_Constructor;
BRepBuilderAPI_MakePolygon: BRepBuilderAPI_MakePolygon_Constructor;
BRepBuilderAPI_Transform: BRepBuilderAPI_Transform_Constructor;
BRepBuilderAPI_MakeShell: BRepBuilderAPI_MakeShell_Constructor;
BRepBuilderAPI_MakeSolid: BRepBuilderAPI_MakeSolid_Constructor;
BRepBuilderAPI_Sewing: BRepBuilderAPI_Sewing_Constructor;
BRepBuilderAPI_Copy: BRepBuilderAPI_Copy_Constructor;
BRepBuilderAPI_GTransform: BRepBuilderAPI_GTransform_Constructor;
// Offset/Pipe/Loft Operations
BRepOffsetAPI_MakeOffset: BRepOffsetAPI_MakeOffset_Constructor;
BRepOffsetAPI_MakeOffsetShape: BRepOffsetAPI_MakeOffsetShape_Constructor;
BRepOffsetAPI_MakeThickSolid: BRepOffsetAPI_MakeThickSolid_Constructor;
BRepOffsetAPI_ThruSections: BRepOffsetAPI_ThruSections_Constructor;
BRepOffsetAPI_MakePipe: BRepOffsetAPI_MakePipe_Constructor;
BRepOffsetAPI_MakePipeShell: BRepOffsetAPI_MakePipeShell_Constructor;
// Projection
BRepProj_Projection: BRepProj_Projection_Constructor;
// Boolean Operations Builder
BOPAlgo_Builder: BOPAlgo_Builder_Constructor;
// Fillets and Chamfers
BRepFilletAPI_MakeFillet: BRepFilletAPI_MakeFillet_Constructor;
BRepFilletAPI_MakeChamfer: BRepFilletAPI_MakeChamfer_Constructor;
// BRepFill
BRepFill_Filling: BRepFill_Filling_Constructor;
// BRepClass
BRepClass_FaceClassifier: BRepClass_FaceClassifier_Constructor;
// Geometry Properties
GProp_GProps: GProp_GProps_Constructor;
// Bounding Box
Bnd_Box: Bnd_Box_Constructor;
// Meshing
BRepMesh_IncrementalMesh: BRepMesh_IncrementalMesh_Constructor;
Poly_Triangle: Poly_Triangle_Constructor;
Poly_Triangulation: Poly_Triangulation_Constructor;
Poly_Connect: Poly_Connect_Constructor;
TopLoc_Location: TopLoc_Location_Constructor;
// Geometry Collections
TColgp_Array1OfPnt2d: TColgp_Array1OfPnt2d_Constructor;
TColgp_Array1OfDir: TColgp_Array1OfDir_Constructor;
// Geometry Surfaces
Geom_CylindricalSurface: Geom_CylindricalSurface_Constructor;
// Presentation/Visualization helpers
StdPrs_ToolTriangulatedShape: StdPrs_ToolTriangulatedShape_Static;
// Data Exchange
STEPControl_Reader: STEPControl_Reader_Constructor;
STEPControl_Writer: STEPControl_Writer_Constructor;
IGESControl_Reader: IGESControl_Reader_Constructor;
IGESControl_Writer: IGESControl_Writer_Constructor;
StlAPI_Writer: StlAPI_Writer_Constructor;
// XCAF (Extended CAD Framework) for Assembly Support
TDF_Label: TDF_Label_Constructor;
TDF_LabelSequence: TDF_LabelSequence_Constructor;
Standard_GUID: Standard_GUID_Constructor;
Quantity_Color: Quantity_Color_Constructor;
Quantity_ColorRGBA: Quantity_ColorRGBA_Constructor;
Quantity_TypeOfColor: Quantity_TypeOfColor;
XCAFDoc_ColorType: XCAFDoc_ColorType;
TCollection_AsciiString: TCollection_AsciiString_Constructor;
Handle_TDF_Attribute: Handle_TDF_Attribute_Constructor;
Handle_XCAFDoc_ShapeTool: Handle_XCAFDoc_ShapeTool_Constructor;
Handle_XCAFDoc_ColorTool: Handle_XCAFDoc_ColorTool_Constructor;
Handle_XCAFDoc_MaterialTool: Handle_XCAFDoc_MaterialTool_Constructor;
Handle_TDocStd_Document: Handle_TDocStd_Document_Constructor;
XCAFDoc_ShapeTool: XCAFDoc_ShapeTool_Interface;
XCAFDoc_ColorTool: XCAFDoc_ColorTool_Interface;
TDataStd_Name: TDataStd_Name_Constructor;
TDataStd_Real: TDataStd_Real_Constructor;
TDataStd_Integer: TDataStd_Integer_Constructor;
// XCAF Static Functions
XCAFDoc_DocumentTool_ShapeTool(label: TDF_Label): Handle_XCAFDoc_ShapeTool;
XCAFDoc_DocumentTool_ColorTool(label: TDF_Label): Handle_XCAFDoc_ColorTool;
XCAFDoc_DocumentTool_MaterialTool(label: TDF_Label): Handle_XCAFDoc_MaterialTool;
// XCAFDoc_ShapeTool static methods
XCAFDoc_ShapeTool_IsAssembly(label: TDF_Label): boolean;
XCAFDoc_ShapeTool_IsReference(label: TDF_Label): boolean;
XCAFDoc_ShapeTool_IsSimpleShape(label: TDF_Label): boolean;
XCAFDoc_ShapeTool_IsComponent(label: TDF_Label): boolean;
XCAFDoc_ShapeTool_IsShape(label: TDF_Label): boolean;
XCAFDoc_ShapeTool_GetLocation(label: TDF_Label): TopLoc_Location;
XCAFDoc_ShapeTool_GetShape_1(label: TDF_Label, shape: TopoDS_Shape): boolean;
XCAFDoc_ShapeTool_GetShape_2(label: TDF_Label): TopoDS_Shape;
XCAFDoc_ShapeTool_GetReferredShape(label: TDF_Label, referredLabel: TDF_Label): boolean;
XCAFDoc_ShapeTool_GetComponents(label: TDF_Label, components: TDF_LabelSequence, getSubChilds: boolean): boolean;
XCAFDoc_ShapeTool_NbComponents(label: TDF_Label, getSubChilds: boolean): number;
// XCAFDoc_ColorTool helpers
XCAFDoc_ColorTool_GetColor_1(tool: XCAFDoc_ColorTool, label: TDF_Label, color: Quantity_Color): boolean;
XCAFDoc_ColorTool_GetColor_7(tool: XCAFDoc_ColorTool, shape: TopoDS_Shape, type: EmbindEnumValue, color: Quantity_Color): boolean;
XCAFDoc_ColorTool_GetColors(tool: XCAFDoc_ColorTool, labels: TDF_LabelSequence): void;
// TDataStd_Name helper
TDataStd_Name_GetID(): Standard_GUID;
// STEPCAF Reader (reads STEP with assembly structure)
STEPCAFControl_Reader_ReadFile(filePath: string, appName: string): Handle_TDocStd_Document;
// =====================================================================================
// HIGH-LEVEL ASSEMBLY CONVERSION FUNCTIONS (run entirely in C++ for performance)
// =====================================================================================
/**
* Convert STEP file to glTF format.
* Runs entirely in C++ for maximum performance.
* Preserves assembly hierarchy, colors, materials, and transformations.
*
* @param stepFilePath - Path to input STEP file (in virtual filesystem)
* @param gltfFilePath - Path to output glTF/GLB file (in virtual filesystem)
* @param meshPrecision - Mesh linear deflection. With meshRelative=true this is a
* fraction of each edge's length (e.g. 0.005 = 0.5%); otherwise absolute (mm).
* @param meshAngle - Mesh angular deflection in radians (typical 0.5)
* @param meshRelative - When true, use size-aware relative deflection per face (faster
* for mixed-scale assemblies, slight visual approximation on tiny features).
* @param internalVerticesMode - Add interior vertices for better curved face fidelity (slower, set false for speed)
* @param controlSurfaceDeflection - Extra post-pass refining triangles that bulge beyond the deflection (slower, set false for speed)
* @param isBinary - true for GLB (binary), false for glTF+bin (JSON)
* @returns true on success
*/
ConvertStepToGltf(stepFilePath: string, gltfFilePath: string, meshPrecision: number, meshAngle: number, meshRelative: boolean, internalVerticesMode: boolean, controlSurfaceDeflection: boolean, isBinary: boolean, faceCountThreshold?: number): boolean;
/**
* Advanced STEP to glTF conversion with full control over reading and export options.
* Use this for file system based conversion (e.g., in Node.js or with virtual filesystem).
*
* STEP Reading Options (affect parsing speed - disable what you don't need):
* @param stepFilePath - Path to input STEP file (in virtual filesystem)
* @param gltfFilePath - Path for output glTF/GLB file
* @param readColors - Read color attributes (needed for colored glTF)
* @param readNames - Read name attributes (for glTF node names)
* @param readMaterials - Read material attributes (for glTF materials)
* @param readLayers - Read layer attributes (usually not needed for glTF, set false)
* @param readProps - Read validation properties (usually not needed for glTF, set false)
*
* Mesh Options:
* @param meshDeflection - Mesh deflection (precision) - smaller = more detailed mesh
* @param meshAngle - Mesh angular deflection in radians (default 0.5)
* @param meshParallel - Enable parallel meshing (for multi-threaded builds)
* @param meshRelative - Use relative deflection per-face bounding box (slower, set false for speed)
* @param internalVerticesMode - Add internal vertices for better mesh quality (slower, set false for speed)
* @param controlSurfaceDeflection - Perform extra surface deviation checks (slower, set false for speed)
* @param faceCountThreshold - Face count threshold for adaptive meshing (-1 to disable)
*
* glTF Writer Options:
* @param isBinary - true for GLB (binary), false for glTF (JSON)
* @param mergeFaces - Merge faces within a single part (smaller file size)
* @param splitIndices16 - Prefer 16-bit indices when merging (smaller binary)
* @param parallelWrite - Enable parallel glTF writing
* @param embedTextures - Embed textures in GLB (only for binary mode)
* @param forceUVExport - Export UV coordinates even without textures
* @param nodeNameFormat - Node naming format:
* 0=Empty, 1=Product, 2=Instance, 3=InstanceOrProduct, 4=ProductOrInstance, 5=ProductAndInstance, 6=ProductAndInstanceAndOcaf
* @param meshNameFormat - Mesh naming format (same values as nodeNameFormat)
* @param trsfFormat - Transformation format: 0=Compact (TRS), 1=Mat4, 2=TRS
*
* Coordinate System Options:
* @param adjustZtoY - Convert Z-up (OCCT) to Y-up (glTF standard), default true
* @param scale - Scale factor for the model (e.g., 0.001 to convert mm to m), default 1.0
*
* @returns true on success, false on failure
*/
ConvertStepToGltfAdvanced(
stepFilePath: string,
gltfFilePath: string,
// STEP reading options
readColors: boolean,
readNames: boolean,
readMaterials: boolean,
readLayers: boolean,
readProps: boolean,
// Mesh options
meshDeflection: number,
meshAngle: number,
meshParallel: boolean,
meshRelative: boolean,
internalVerticesMode: boolean,
controlSurfaceDeflection: boolean,
faceCountThreshold: number,
// glTF writer options
isBinary: boolean,
mergeFaces: boolean,
splitIndices16: boolean,
parallelWrite: boolean,
embedTextures: boolean,
forceUVExport: boolean,
nodeNameFormat: number,
meshNameFormat: number,
trsfFormat: number,
// Coordinate system options
adjustZtoY: boolean,
scale: number
): boolean;
/**
* Parse STEP file and return assembly structure as JSON.
* Runs entirely in C++ for maximum performance.
* Returns JSON with nodes containing: id, name, isAssembly, visible, color, transform.
*
* @param stepFilePath - Path to input STEP file (in virtual filesystem)
* @returns JSON string with assembly structure
*/
ParseStepAssemblyToJson(stepFilePath: string): string;
/**
* Convert STEP content to GLB format from memory.
* For browser use - reads STEP from string, returns GLB as byte array.
* Automatically detects and decompresses STEP-Z (.stpz) gzip-compressed files.
*
* @param stepContent - STEP file content as string (supports gzip-compressed STEP-Z)
* @param meshPrecision - Mesh deflection for triangulation
* @param faceCountThreshold - Legacy per-sub-shape meshing fallback threshold.
* Default -1 = single-pass meshing of the whole assembly (fastest, recommended).
* Set to a positive value (e.g. 100000) to fall back to per-solid meshing
* when the total face count exceeds it (memory-constrained environments).
* @returns GLB binary data as Uint8Array (empty on failure)
*/
ConvertStepToGltfFromMemory(stepContent: string, meshPrecision: number, meshAngle?: number, meshRelative?: boolean, internalVerticesMode?: boolean, controlSurfaceDeflection?: boolean, faceCountThreshold?: number): Uint8Array;
/**
* Parse STEP assembly from memory to JSON.
* For browser use - reads STEP from string, returns JSON string.
* Automatically detects and decompresses STEP-Z (.stpz) gzip-compressed files.
*
* @param stepContent - STEP file content as string (supports gzip-compressed STEP-Z)
* @returns JSON string with assembly structure
*/
ParseStepAssemblyToJsonFromMemory(stepContent: string): string;
/**
* Convert STEP to GLB format from binary data.
* Use this for compressed STEP-Z files - read with FileReader.readAsArrayBuffer.
*
* @param stepData - STEP file content as Uint8Array (supports gzip-compressed STEP-Z)
* @param meshPrecision - Mesh deflection for triangulation
* @param faceCountThreshold - Legacy per-sub-shape meshing fallback threshold.
* Default -1 = single-pass meshing of the whole assembly (fastest, recommended).
* Set to a positive value to fall back to per-solid meshing for very large
* assemblies in memory-constrained environments.
* @returns GLB binary data as Uint8Array (empty on failure)
*/
ConvertStepToGltfFromBinary(stepData: Uint8Array, meshPrecision: number, meshAngle?: number, meshRelative?: boolean, internalVerticesMode?: boolean, controlSurfaceDeflection?: boolean, faceCountThreshold?: number): Uint8Array;
/**
* Advanced STEP to GLB conversion with full control over reading and export options.
* Use this for maximum control over conversion behavior and performance tuning.
*
* STEP Reading Options (affect parsing speed - disable what you don't need):
* @param stepData - STEP file content as Uint8Array (supports gzip-compressed STEP-Z)
* @param readColors - Read color attributes (needed for colored glTF)
* @param readNames - Read name attributes (for glTF node names)
* @param readMaterials - Read material attributes (for glTF materials)
* @param readLayers - Read layer attributes (usually not needed for glTF, set false)
* @param readProps - Read validation properties (usually not needed for glTF, set false)
*
* Mesh Options:
* @param meshDeflection - Mesh deflection (precision) - smaller = more detailed mesh
* @param meshAngle - Mesh angular deflection in radians (default 0.5)
* @param meshParallel - Enable parallel meshing (for multi-threaded builds)
* @param meshRelative - Use relative deflection per-face bounding box (slower, set false for speed)
* @param internalVerticesMode - Add internal vertices for better mesh quality (slower, set false for speed)
* @param controlSurfaceDeflection - Perform extra surface deviation checks (slower, set false for speed)
* @param faceCountThreshold - Face count threshold for adaptive meshing (-1 to disable)
*
* glTF Writer Options:
* @param mergeFaces - Merge faces within a single part (smaller JSON size)
* @param splitIndices16 - Prefer 16-bit indices when merging (smaller binary)
* @param parallelWrite - Enable parallel glTF writing
* @param embedTextures - Embed textures in GLB (only for binary mode)
* @param forceUVExport - Export UV coordinates even without textures
* @param nodeNameFormat - Node naming format:
* 0=Empty, 1=Product, 2=Instance, 3=InstanceOrProduct, 4=ProductOrInstance, 5=ProductAndInstance, 6=ProductAndInstanceAndOcaf
* @param meshNameFormat - Mesh naming format (same values as nodeNameFormat)
* @param trsfFormat - Transformation format: 0=Compact (TRS), 1=Mat4, 2=TRS
*
* Coordinate System Options:
* @param adjustZtoY - Convert Z-up (OCCT) to Y-up (glTF standard), default true
* @param scale - Scale factor for the model (e.g., 0.001 to convert mm to m), default 1.0
*
* @returns GLB binary data as Uint8Array (empty on failure)
*/
ConvertStepToGltfFromBinaryAdvanced(
stepData: Uint8Array,
// STEP reading options
readColors: boolean,
readNames: boolean,
readMaterials: boolean,
readLayers: boolean,
readProps: boolean,
// Mesh options
meshDeflection: number,
meshAngle: number,
meshParallel: boolean,
meshRelative: boolean,
internalVerticesMode: boolean,
controlSurfaceDeflection: boolean,
faceCountThreshold: number,
// glTF writer options
mergeFaces: boolean,
splitIndices16: boolean,
parallelWrite: boolean,
embedTextures: boolean,
forceUVExport: boolean,
nodeNameFormat: number,
meshNameFormat: number,
trsfFormat: number,
// Coordinate system options
adjustZtoY: boolean,
scale: number
): Uint8Array;
/**
* Convert STEP file to glTF/GLB with explicit Draco geometry compression settings.
* Same shape as `ConvertStepToGltf` plus 8 trailing Draco parameters.
* Draco compression is only applied when OCCT was built with USE_DRACO=ON; otherwise
* the Draco parameters are accepted but silently ignored (no error).
*
* @param useDraco - Enable Draco geometry compression on output
* @param dracoCompressionLevel - 0 (fastest, largest) ... 10 (slowest, smallest). 7 is a good default.
* @param dracoQuantizePositionBits - Quantization bits for vertex positions (default 14)
* @param dracoQuantizeNormalBits - Quantization bits for normals (default 10)
* @param dracoQuantizeTexcoordBits - Quantization bits for UVs (default 12)
* @param dracoQuantizeColorBits - Quantization bits for colors (default 8)
* @param dracoQuantizeGenericBits - Quantization bits for generic attributes (default 12)
* @param dracoUnifiedQuantization - Apply a single quantization grid across all attributes
*/
ConvertStepToGltfWithDraco(
stepFilePath: string,
gltfFilePath: string,
meshPrecision: number,
meshAngle: number,
meshRelative: boolean,
internalVerticesMode: boolean,
controlSurfaceDeflection: boolean,
isBinary: boolean,
faceCountThreshold: number,
useDraco: boolean,
dracoCompressionLevel: number,
dracoQuantizePositionBits: number,
dracoQuantizeNormalBits: number,
dracoQuantizeTexcoordBits: number,
dracoQuantizeColorBits: number,
dracoQuantizeGenericBits: number,
dracoUnifiedQuantization: boolean
): boolean;
/**
* Advanced STEP -> glTF conversion with full reading/mesh/writer/coord options AND
* explicit Draco geometry compression settings (8 trailing parameters).
* See `ConvertStepToGltfAdvanced` for the meaning of the first 25 parameters and
* `ConvertStepToGltfWithDraco` for the Draco knobs.
*/
ConvertStepToGltfAdvancedWithDraco(
stepFilePath: string,
gltfFilePath: string,
readColors: boolean,
readNames: boolean,
readMaterials: boolean,
readLayers: boolean,
readProps: boolean,
meshDeflection: number,
meshAngle: number,
meshParallel: boolean,
meshRelative: boolean,
internalVerticesMode: boolean,
controlSurfaceDeflection: boolean,
faceCountThreshold: number,
isBinary: boolean,
mergeFaces: boolean,
splitIndices16: boolean,
parallelWrite: boolean,
embedTextures: boolean,
forceUVExport: boolean,
nodeNameFormat: number,
meshNameFormat: number,
trsfFormat: number,
adjustZtoY: boolean,
scale: number,
useDraco: boolean,
dracoCompressionLevel: number,
dracoQuantizePositionBits: number,
dracoQuantizeNormalBits: number,
dracoQuantizeTexcoordBits: number,
dracoQuantizeColorBits: number,
dracoQuantizeGenericBits: number,
dracoUnifiedQuantization: boolean
): boolean;
/**
* Convert binary STEP (Uint8Array, optionally gzipped .stpz) to GLB with explicit
* Draco compression settings. Returns the GLB as a Uint8Array.
*/
ConvertStepToGltfFromBinaryWithDraco(
stepData: Uint8Array,
meshPrecision: number,
meshAngle: number,
meshRelative: boolean,
internalVerticesMode: boolean,
controlSurfaceDeflection: boolean,
faceCountThreshold: number,
useDraco: boolean,
dracoCompressionLevel: number,
dracoQuantizePositionBits: number,
dracoQuantizeNormalBits: number,
dracoQuantizeTexcoordBits: number,
dracoQuantizeColorBits: number,
dracoQuantizeGenericBits: number,
dracoUnifiedQuantization: boolean
): Uint8Array;
/**
* Advanced binary STEP -> GLB conversion with full reading/mesh/writer/coord options
* AND explicit Draco compression settings.
*/
ConvertStepToGltfFromBinaryAdvancedWithDraco(
stepData: Uint8Array,
readColors: boolean,
readNames: boolean,
readMaterials: boolean,
readLayers: boolean,
readProps: boolean,
meshDeflection: number,
meshAngle: number,
meshParallel: boolean,
meshRelative: boolean,
internalVerticesMode: boolean,
controlSurfaceDeflection: boolean,
faceCountThreshold: number,
mergeFaces: boolean,
splitIndices16: boolean,
parallelWrite: boolean,
embedTextures: boolean,
forceUVExport: boolean,
nodeNameFormat: number,
meshNameFormat: number,
trsfFormat: number,
adjustZtoY: boolean,
scale: number,
useDraco: boolean,
dracoCompressionLevel: number,
dracoQuantizePositionBits: number,
dracoQuantizeNormalBits: number,
dracoQuantizeTexcoordBits: number,
dracoQuantizeColorBits: number,
dracoQuantizeGenericBits: number,
dracoUnifiedQuantization: boolean
): Uint8Array;
/**
* Parse STEP assembly from binary data to JSON.
* Use this for compressed STEP-Z files - read with FileReader.readAsArrayBuffer.
*
* @param stepData - STEP file content as Uint8Array (supports gzip-compressed STEP-Z)
* @returns JSON string with assembly structure
*/
ParseStepAssemblyToJsonFromBinary(stepData: Uint8Array): string;
/**
* Read STEP from binary data.
* Use this for compressed STEP-Z files - read with FileReader.readAsArrayBuffer.
*
* @param stepData - STEP file content as Uint8Array (supports gzip-compressed STEP-Z)
* @returns The shape read from STEP, or null shape on failure
*/
ReadSTEPFromBinary(stepData: Uint8Array): TopoDS_Shape;
/**
* Read IGES from binary data.
* Use this for compressed IGES files - read with FileReader.readAsArrayBuffer.
*
* @param igesData - IGES file content as Uint8Array (supports gzip-compressed)
* @returns The shape read from IGES, or null shape on failure
*/
ReadIGESFromBinary(igesData: Uint8Array): TopoDS_Shape;
// =====================================================================================
// ASSEMBLY CREATION FUNCTIONS (Document-based API for visual programming)
// These functions return document handles directly - caller manages lifetime.
// =====================================================================================
/**
* Build an assembly document from a structure definition and return the document handle directly.
* The caller is responsible for managing the document lifetime.
*
* Structure JSON format (for creating new assembly):
* {
* "parts": [
* { "id": "part-1", "shapeIndex": 0, "name": "Box", "color": { "r": 1, "g": 0, "b": 0, "a": 1 } }
* ],
* "nodes": [
* { "id": "asm-1", "type": "assembly", "name": "Root" },
* { "id": "inst-1", "type": "instance", "parentId": "asm-1", "partId": "part-1",
* "name": "Box 1", "translation": [10, 0, 0], "rotation": [0, 0, 45], "scale": 1.0 }
* ]
* }
*
* When updating an existing document, you can also include:
* - "removals": ["0:1:1:2", "0:1:1:3:1"] - Labels to remove (parts, instances, or assemblies)
* - "partUpdates": [{ "label": "0:1:1:1", "shapeIndex": 0, "name": "New Name", "color": {...} }] - Updates to apply
*
* Processing order for updates:
* 1. Removals are applied first
* 2. Part updates are applied second
* 3. New parts and nodes are added last
*
* Imported parts (cross-document reuse):
* The structure may also contain a `loadedParts` array. Each entry copies a label
* (or the full free-shapes root) from a source document into the new document,
* preserving sub-assembly hierarchy, names and colors. The copied root becomes a
* part referenceable by `partId` from any instance node, allowing a STEP-loaded
* assembly to be placed multiple times in a new assembly.
*
* loadedParts: [
* { id, sourceDocumentIndex, sourceLabel?, name?, colorRgba? }
* ]
*
* `sourceDocumentIndex` is the index into the `sourceDocuments` parameter.
* If `sourceLabel` is omitted, all free shapes of the source document are imported
* (wrapped in a new assembly compound when there are multiple).
*
* @param structureJson - JSON string with assembly structure (parts, nodes, optional removals/partUpdates/loadedParts)
* @param shapesArray - Array of TopoDS_Shape objects, referenced by shapeIndex in parts and partUpdates
* @param existingDoc - Optional existing document handle to update (for removals/partUpdates/additions)
* @param sourceDocuments - Optional array of source document handles referenced by loadedParts entries
* @returns Handle to the created/updated document. Call IsNull() to check for errors.
*/
BuildAssemblyDocument(structureJson: string, shapesArray: TopoDS_Shape[], existingDoc: Handle_TDocStd_Document | undefined, sourceDocuments: Handle_TDocStd_Document[]): Handle_TDocStd_Document;
/**
* Export a document to STEP format (takes document handle directly).
* Unlike ExportAssemblyToStepBinary, this does not use global document storage.
*
* @param document - Document handle from BuildAssemblyDocument
* @param fileName - File name for the STEP header
* @param author - Author name for the STEP header
* @param organization - Organization name for the STEP header
* @returns STEP file content as Uint8Array, or undefined on failure
*/
ExportDocumentToStep(document: Handle_TDocStd_Document, fileName: string, author: string, organization: string): Uint8Array | undefined;
/**
* Export a document to compressed STEP-Z format (takes document handle directly).
* Unlike ExportAssemblyToStepZ, this does not use global document storage.
*
* @param document - Document handle from BuildAssemblyDocument
* @param fileName - File name for the STEP header
* @param author - Author name for the STEP header
* @param organization - Organization name for the STEP header
* @returns Compressed STEP-Z content as Uint8Array, or undefined on failure
*/
ExportDocumentToStepZ(document: Handle_TDocStd_Document, fileName: string, author: string, organization: string): Uint8Array | undefined;
/**
* Export a document to glTF binary (GLB) format (takes document handle directly).
* Uses optimized mesh parameters (no internal vertices, no surface deflection control).
*
* @param document - Document handle from BuildAssemblyDocument
* @param meshDeflection - Mesh precision for triangulation (default 0.1)
* @param meshAngle - Angular deflection for meshing in radians (default 0.5)
* @param internalVerticesMode - Add interior vertices for better curved face fidelity (slower, set false for speed)
* @param controlSurfaceDeflection - Extra post-pass refining triangles that bulge beyond the deflection (slower, set false for speed)
* @param mergeFaces - Whether to merge faces with same material (default false)
* @param forceUVExport - Whether to export texture coordinates (default false)
* @returns GLB content as Uint8Array, or undefined on failure
*/
ExportDocumentToGltf(document: Handle_TDocStd_Document, meshDeflection: number, meshAngle: number, internalVerticesMode: boolean, controlSurfaceDeflection: boolean, mergeFaces: boolean, forceUVExport: boolean): Uint8Array | undefined;
/**
* Export a document to glTF binary (GLB) format with explicit Draco geometry
* compression settings (8 trailing parameters). Mirrors `ExportDocumentToGltf` but
* exposes the Draco knobs that are otherwise defaulted internally.
* Draco compression is only applied when OCCT was built with USE_DRACO=ON; otherwise
* the Draco parameters are accepted but silently ignored (no error).
*
* @param useDraco - Enable Draco geometry compression on output
* @param dracoCompressionLevel - 0 (fastest, largest) ... 10 (slowest, smallest). 7 is a good default.
* @param dracoQuantizePositionBits - Quantization bits for positions (default 14)
* @param dracoQuantizeNormalBits - Quantization bits for normals (default 10)
* @param dracoQuantizeTexcoordBits - Quantization bits for UVs (default 12)
* @param dracoQuantizeColorBits - Quantization bits for colors (default 8)
* @param dracoQuantizeGenericBits - Quantization bits for generic attributes (default 12)
* @param dracoUnifiedQuantization - Apply a single quantization grid across all attributes
*/
ExportDocumentToGltfWithDraco(
document: Handle_TDocStd_Document,
meshDeflection: number,
meshAngle: number,
internalVerticesMode: boolean,
controlSurfaceDeflection: boolean,
mergeFaces: boolean,
forceUVExport: boolean,
useDraco: boolean,
dracoCompressionLevel: number,
dracoQuantizePositionBits: number,
dracoQuantizeNormalBits: number,
dracoQuantizeTexcoordBits: number,
dracoQuantizeColorBits: number,
dracoQuantizeGenericBits: number,
dracoUnifiedQuantization: boolean
): Uint8Array | undefined;
// =====================================================================================
// DOCUMENT-BASED QUERY FUNCTIONS
// These functions take a document handle directly and do not use global storage.
// =====================================================================================
/**
* Get all parts and assemblies in a document.
* @param document - Document handle from BuildAssemblyDocument or LoadStepToDoc
* @returns JSON string with array of part info objects
*/
GetDocumentPartsFromDoc(document: Handle_TDocStd_Document): string;
/**
* Get a shape from a label in a document.
* @param document - Document handle
* @param label - Label string (e.g., "0:1:1:1")
* @returns Shape at the label
*/
GetShapeFromDocLabel(document: Handle_TDocStd_Document, label: string): TopoDS_Shape;
/**
* Get the color of a label in a document.
* @param document - Document handle
* @param label - Label string
* @returns JSON string with color info: { hasColor, r, g, b, a }
*/
GetDocLabelColor(document: Handle_TDocStd_Document, label: string): string;
/**
* Get the transform of a label in a document.
* @param document - Document handle
* @param label - Label string
* @returns JSON string with transform info: { matrix, translation, quaternion, scale }
*/
GetDocLabelTransform(document: Handle_TDocStd_Document, label: string): string;
/**
* Get detailed info about a label in a document.
* @param document - Document handle
* @param label - Label string
* @returns JSON string with label info: { label, name, type, isAssembly, children, etc. }
*/
GetDocLabelInfo(document: Handle_TDocStd_Document, label: string): string;
/**
* Get full assembly hierarchy from a document.
* @param document - Document handle
* @returns JSON string with hierarchy: { nodes: [...] }
*/
GetDocAssemblyHierarchy(document: Handle_TDocStd_Document): string;
/**
* Set color on a label in a document.
* @param document - Document handle
* @param label - Label string
* @param r - Red component (0-1)
* @param g - Green component (0-1)
* @param b - Blue component (0-1)
* @param a - Alpha component (0-1)
* @returns true on success
*/
SetDocLabelColor(document: Handle_TDocStd_Document, label: string, r: number, g: number, b: number, a: number): boolean;
/**
* Set name on a label in a document.
* @param document - Document handle
* @param label - Label string
* @param name - New name
* @returns true on success
*/
SetDocLabelName(document: Handle_TDocStd_Document, label: string, name: string): boolean;
/**
* Load STEP data and return document handle directly.
* Supports both regular STEP and gzip-compressed STEP-Z.
* @param stepData - STEP file content as Uint8Array (supports gzip-compressed STEP-Z)
* @returns Document handle. Call IsNull() to check for errors. Caller manages lifetime.
*/
LoadStepToDoc(stepData: Uint8Array): Handle_TDocStd_Document;
// BRep Builder
BRep_Builder: BRep_Builder_Constructor;
// Static utility classes (namespace-style access)
BRepBndLib: BRepBndLib_Static;
BRepTools: BRepTools_Static;
BRep_Tool: BRep_Tool_Static;
// Shape Iterators
BRepTools_WireExplorer: BRepTools_WireExplorer_Constructor;
TopoDS_Iterator: TopoDS_Iterator_Constructor;
TopTools_ListOfShape: TopTools_ListOfShape_Constructor;
// Curve Adaptors
BRepAdaptor_Curve: BRepAdaptor_Curve_Constructor;
BRepAdaptor_CompCurve: BRepAdaptor_CompCurve_Constructor;
GCPnts_TangentialDeflection: GCPnts_TangentialDeflection_Constructor;
GCPnts_AbscissaPoint: GCPnts_AbscissaPoint_Constructor;
// Shape Fix / Repair
ShapeFix_Shape: ShapeFix_Shape_Constructor;
ShapeFix_Wire: ShapeFix_Wire_Constructor;
// 2D Fillets
BRepFilletAPI_MakeFillet2d: BRepFilletAPI_MakeFillet2d_Constructor;
ChFi2d_FilletAlgo: ChFi2d_FilletAlgo_Constructor;
// 2D Geometry Construction (GccEnt, GccAna)
GccEnt_QualifiedCirc: GccEnt_QualifiedCirc_Constructor;
GccEnt_QualifiedLin: GccEnt_QualifiedLin_Constructor;
GccAna_Lin2d2Tan: GccAna_Lin2d2Tan_Constructor;
GccAna_Circ2d2TanRad: GccAna_Circ2d2TanRad_Constructor;
// Enumerations (embind exports as objects with value properties)
TopAbs_ShapeEnum: TopAbs_ShapeEnum;
TopAbs_Orientation: TopAbs_Orientation;
TopAbs_State: TopAbs_State;
IFSelect_ReturnStatus: IFSelect_ReturnStatus;
STEPControl_StepModelType: STEPControl_StepModelType;
GccEnt_Position: GccEnt_Position;
GeomFill_Trihedron: GeomFill_Trihedron;
GeomAbs_Shape: GeomAbs_Shape;
GeomAbs_JoinType: GeomAbs_JoinType;
BRepFill_TypeOfContact: BRepFill_TypeOfContact;
GeomAbs_CurveType: GeomAbs_CurveType;
BRepBuilderAPI_WireError: BRepBuilderAPI_WireError;
ChFi3d_FilletShape: ChFi3d_FilletShape;
BRepOffset_Mode: BRepOffset_Mode;
Approx_ParametrizationType: Approx_ParametrizationType;
// TopoDS Downcasting Functions (convert TopoDS_Shape to specific sub-type)
CastToVertex(shape: TopoDS_Shape): TopoDS_Vertex;
CastToEdge(shape: TopoDS_Shape): TopoDS_Edge;
CastToWire(shape: TopoDS_Shape): TopoDS_Wire;
CastToFace(shape: TopoDS_Shape): TopoDS_Face;
CastToShell(shape: TopoDS_Shape): TopoDS_Shell;
CastToSolid(shape: TopoDS_Shape): TopoDS_Solid;
CastToCompSolid(shape: TopoDS_Shape): TopoDS_CompSolid;
CastToCompound(shape: TopoDS_Shape): TopoDS_Compound;
// TopoDS_Shape utility functions
TopoDS_Shape_HashCode(shape: TopoDS_Shape, upperBound?: number): number;
// BRep_Tool functions
BRep_Tool_Pnt(vertex: TopoDS_Vertex): gp_Pnt;
BRep_Tool_Tolerance_Vertex(vertex: TopoDS_Vertex): number;
BRep_Tool_Tolerance_Edge(edge: TopoDS_Edge): number;
BRep_Tool_Tolerance_Face(face: TopoDS_Face): number;
BRep_Tool_IsGeometric(edge: TopoDS_Edge): boolean;
BRep_Tool_Degenerated(edge: TopoDS_Edge): boolean;
// BRepBuilderAPI_MakeFace factory functions (for surface-based face creation)
MakeFaceFromFaceSurfaceAndWire(face: TopoDS_Face, wire: TopoDS_Wire, inside: boolean): TopoDS_Face;
MakeFaceFromFaceSurface(face: TopoDS_Face, tolDegen: number): TopoDS_Face;
MakeFaceFromWireOnlyPlane(wire: TopoDS_Wire, onlyPlane: boolean): TopoDS_Face;
// BRepGProp functions
BRepGProp_LinearProperties(shape: TopoDS_Shape, props: GProp_GProps): void;
BRepGProp_SurfaceProperties(shape: TopoDS_Shape, props: GProp_GProps): void;
BRepGProp_VolumeProperties(shape: TopoDS_Shape, props: GProp_GProps): void;
// Triangulation helpers
/** Gets the triangulation of a face. Nodes are in local coordinates. */
GetFaceTriangulation(face: TopoDS_Face): Poly_Triangulation;
/** Gets the location (transformation) of a face. Use with GetFaceTriangulation to transform nodes to global coordinates. */
GetFaceLocation(face: TopoDS_Face): TopLoc_Location;
// Factory functions for alternate constructors (embind can't distinguish by type)
gp_Dir_fromVec(vec: gp_Vec): gp_Dir;
gp_Pnt_fromXYZ(xyz: gp_XYZ): gp_Pnt;
gp_Vec_fromXYZ(xyz: gp_XYZ): gp_Vec;
gp_Vec_fromPoints(p1: gp_Pnt, p2: gp_Pnt): gp_Vec;
// GccAna_Lin2d2Tan factory functions (embind can't distinguish 3-param constructors by type)
/** Line tangent to a circle and passing through a point */
GccAna_Lin2d2Tan_fromQualifiedCircAndPoint(qualCirc: GccEnt_QualifiedCirc, point: gp_Pnt2d, tolerance: number): GccAna_Lin2d2Tan;
/** Line tangent to two circles */
GccAna_Lin2d2Tan_fromTwoQualifiedCirc(qualCirc1: GccEnt_QualifiedCirc, qualCirc2: GccEnt_QualifiedCirc, tolerance: number): GccAna_Lin2d2Tan;
// GccAna_Circ2d2TanRad factory functions (embind can't distinguish 4-param constructors by type)
/** Circle tangent to two circles */
GccAna_Circ2d2TanRad_fromTwoQualifiedCirc(qualCirc1: GccEnt_QualifiedCirc, qualCirc2: GccEnt_QualifiedCirc, radius: number, tolerance: number): GccAna_Circ2d2TanRad;
/** Circle tangent to a circle and a line */
GccAna_Circ2d2TanRad_fromQualifiedCircAndLin(qualCirc: GccEnt_QualifiedCirc, qualLin: GccEnt_QualifiedLin, radius: number, tolerance: number): GccAna_Circ2d2TanRad;
/** Circle tangent to a circle and passing through a point */
GccAna_Circ2d2TanRad_fromQualifiedCircAndPoint(qualCirc: GccEnt_QualifiedCirc, point: gp_Pnt2d, radius: number, tolerance: number): GccAna_Circ2d2TanRad;
/** Circle tangent to a line and passing through a point */
GccAna_Circ2d2TanRad_fromQualifiedLinAndPoint(qualLin: GccEnt_QualifiedLin, point: gp_Pnt2d, radius: number, tolerance: number): GccAna_Circ2d2TanRad;
/** Circle tangent to two lines */
GccAna_Circ2d2TanRad_fromTwoQualifiedLin(qualLin1: GccEnt_QualifiedLin, qualLin2: GccEnt_QualifiedLin, radius: number, tolerance: number): GccAna_Circ2d2TanRad;
// ==========================================================================
// Output Parameter Wrapper Functions
// ==========================================================================
// These functions return typed result structs instead of using reference
// output parameters (which embind doesn't support).
// Coordinate extraction (returns CoordResult instead of modifying references)
gp_Pnt_GetCoord(pnt: gp_Pnt): CoordResult;
gp_Vec_GetCoord(vec: gp_Vec): CoordResult;
gp_Dir_GetCoord(dir: gp_Dir): CoordResult;
gp_XYZ_GetCoord(xyz: gp_XYZ): CoordResult;
// Edge/curve parameters
BRep_Tool_GetEdgeParameters(edge: TopoDS_Edge): EdgeCurveResult;
GetEdgeCurve(edge: TopoDS_Edge): Handle_Geom_Curve;
EvaluateEdgeCurve(edge: TopoDS_Edge, param: number): CurvePointResult;
GetEdgeLength(edge: TopoDS_Edge): number;
// Wire/CompCurve helpers
GetWireLength(wire: TopoDS_Wire): number;
EvaluateWireAtParam(wire: TopoDS_Wire, param: number): CurvePointResult;
EvaluateWireAtActualParam(wire: TopoDS_Wire, param: number): CurvePointResult;
GetPointAtLengthOnWire(wire: TopoDS_Wire, length: number): gp_Pnt;
GetPointAtLengthOnEdge(edge: TopoDS_Edge, length: number): gp_Pnt;
GetWireParameterBounds(wire: TopoDS_Wire): UVBoundsResult;
// gp_Trsf helpers
GetTransformationValue(trsf: gp_Trsf, row: number, col: number): number;
// Bnd_Box helpers
GetBndBoxCornerMin(box: Bnd_Box): gp_Pnt;
GetBndBoxCornerMax(box: Bnd_Box): gp_Pnt;
BRepBndLib_AddToBox(shape: TopoDS_Shape, box: Bnd_Box): void;
ComputeShapeBoundingBox(shape: TopoDS_Shape): BoundingBoxResult;
// BRepTools helpers
BRepTools_Clean(shape: TopoDS_Shape): void;
BRepTools_Clean_Force(shape: TopoDS_Shape, force: boolean): void;
BRepTools_CleanGeometry(shape: TopoDS_Shape): void;
// BRepLib static functions
BRepLib_BuildCurves3d(shape: TopoDS_Shape): boolean;
BRepLib_BuildCurves3d_WithTolerance(shape: TopoDS_Shape, tolerance: number): boolean;
BRepLib_BuildCurves3d_Full(shape: TopoDS_Shape, tolerance: number, continuity: EmbindEnumValue, maxDegree: number, maxSegment: number): boolean;
// GCPnts_AbscissaPoint static functions
GCPnts_AbscissaPoint_Length_Curve(curve: BRepAdaptor_Curve): number;
GCPnts_AbscissaPoint_Length_CompCurve(curve: BRepAdaptor_CompCurve): number;
// BRep_Tool additional helpers
BRep_Tool_IsClosed(shape: TopoDS_Shape): boolean;
BRep_Tool_Triangulation(face: TopoDS_Face, loc: TopLoc_Location): Poly_Triangulation;
// Wire/Curve derivative helpers
GetDerivativesOnWireAtLength(wire: TopoDS_Wire, length: number): DerivativesResult;
GetDerivativesOnWireAtParam(wire: TopoDS_Wire, param: number): DerivativesResult;
GetDerivativesOnEdgeAtParam(edge: TopoDS_Edge, param: number): DerivativesResult;
// Edge creation helpers
MakeEdgeFromCurve(curve: Handle_Geom_Curve): TopoDS_Edge;
MakeEdgeFromCurveWithBounds(curve: Handle_Geom_Curve, u1: number, u2: number): TopoDS_Edge;
MakeEdgeFromTrimmedCurve(curve: Handle_Geom_Curve): TopoDS_Edge;
/**
* Trim an edge to given parameter bounds
* Creates a new edge that is a subset of the original edge
* @param edge The edge to trim
* @param u1 Start parameter (must be within edge's parameter range)
* @param u2 End parameter (must be within edge's parameter range)
* @returns New trimmed edge, or null edge if operation fails
*/
TrimEdgeToParams(edge: TopoDS_Edge, u1: number, u2: number): TopoDS_Edge;
// UV parameters on face
BRep_Tool_GetUVAtVertex(vertex: TopoDS_Vertex, face: TopoDS_Face): UVResult;
// Properties computation (returns struct instead of using reference params)
ComputeVolumeProperties(shape: TopoDS_Shape): PropertiesResult;
ComputeSurfaceProperties(shape: TopoDS_Shape): PropertiesResult;
ComputeLinearProperties(shape: TopoDS_Shape): PropertiesResult;
// BRep_Builder wrappers (return shape instead of reference param)
BRep_Builder_MakeCompound(builder: BRep_Builder): TopoDS_Compound;
BRep_Builder_MakeWire(builder: BRep_Builder): TopoDS_Wire;
BRep_Builder_MakeShell(builder: BRep_Builder): TopoDS_Shell;
BRep_Builder_MakeSolid(builder: BRep_Builder): TopoDS_Solid;
BRep_Builder_MakeCompSolid(builder: BRep_Builder): TopoDS_CompSolid;
// ==========================================================================
// Bounding Box and Shape Utilities
// ==========================================================================
/** Get axis-aligned bounding box of shape */
GetBoundingBox(shape: TopoDS_Shape): BoundingBoxResult;
/** Create a box from corner point and dimensions */
MakeBoxFromPntAndDims(corner: gp_Pnt, dx: number, dy: number, dz: number): TopoDS_Shape;
/** Create a sphere from gp_Ax2 (axes) and radius.
* Factory function because embind can't distinguish (gp_Ax2, double) from (gp_Pnt, double) */
MakeSphereFromAx2(axes: gp_Ax2, radius: number): BRepPrimAPI_MakeSphere;
/** Create a cone from gp_Ax2 (axes), R1, R2, and height (without angle).
* Factory function because embind can't distinguish (gp_Ax2, R1, R2, H) from (R1, R2, H, angle) */
MakeConeFromAx2(axes: gp_Ax2, r1: number, r2: number, height: number): BRepPrimAPI_MakeCone;
/** Fix shape problems (gaps, degeneracies, etc.) */
ShapeFix_Shape_Perform(shape: TopoDS_Shape): TopoDS_Shape;
/** Unify same-domain faces and edges */
ShapeUpgrade_UnifySameDomain_Perform(
shape: TopoDS_Shape,
unifyEdges: boolean,
unifyFaces: boolean,
concatBSplines: boolean
): TopoDS_Shape;
/** Sew faces together into shell/solid */
BRepBuilderAPI_Sewing_Perform(shape: TopoDS_Shape, tolerance: number): TopoDS_Shape;
/** Copy a shape */
BRepBuilderAPI_Copy_Shape(shape: TopoDS_Shape, copyGeom: boolean): TopoDS_Shape;
// ==========================================================================
// Additional Helper Functions
// ==========================================================================
/** Check if bounding box is thin (flat) in any direction */
Bnd_Box_IsThin(box: Bnd_Box, tolerance: number): boolean;
/**
* Classify a point relative to a solid
* @param shape The shape (must be a solid)
* @param point The point to classify
* @param tolerance Classification tolerance
* @returns 0=IN, 1=OUT, 2=ON, 3=UNKNOWN
*/
ClassifyPointInSolid(shape: TopoDS_Shape, point: gp_Pnt, tolerance: number): number;
/** Compute length of a BRepAdaptor_Curve */
GCPnts_AbscissaPoint_CurveLength(curve: BRepAdaptor_Curve): number;
/** Compute length of a BRepAdaptor_Curve between two parameters */
GCPnts_AbscissaPoint_CurveLengthBetween(curve: BRepAdaptor_Curve, u1: number, u2: number): number;
/** Compute length of a BRepAdaptor_CompCurve */
GCPnts_AbscissaPoint_CompCurveLength(curve: BRepAdaptor_CompCurve): number;
/** Compute length of a BRepAdaptor_CompCurve between two parameters */
GCPnts_AbscissaPoint_CompCurveLengthBetween(curve: BRepAdaptor_CompCurve, u1: number, u2: number): number;
/** Create GCPnts_AbscissaPoint from a CompCurve (alternative constructor) */
GCPnts_AbscissaPoint_FromCompCurve(curve: BRepAdaptor_CompCurve, abscissa: number, u0: number): GCPnts_AbscissaPoint;
/** Create a gp_Mat from 9 values (row-major) */
CreateGpMat(a11: number, a12: number, a13: number,
a21: number, a22: number, a23: number,
a31: number, a32: number, a33: number): gp_Mat;
/** Get the vectorial part (3x3 matrix) of a transformation */
gp_Trsf_VectorialPart(trsf: gp_Trsf): gp_Mat;
/** Get the homogeneous vectorial part of a transformation */
gp_Trsf_HVectorialPart(trsf: gp_Trsf): gp_Mat;
/** Project a wire onto a shape and return the result as a compound */
ProjectWireOnShape(wire: TopoDS_Wire, shape: TopoDS_Shape, direction: gp_Dir): TopoDS_Compound;
/** Set mode with contact for pipe shell */
BRepOffsetAPI_MakePipeShell_SetModeWithContact(maker: BRepOffsetAPI_MakePipeShell, isWithContact: boolean, isByCorrectedFrenet: boolean): void;
/** Get the Nth derivative of a BRepAdaptor_Curve at parameter U */
BRepAdaptor_Curve_DN(curve: BRepAdaptor_Curve, u: number, n: number): gp_Vec;
/** Get the Nth derivative of a BRepAdaptor_CompCurve at parameter U */
BRepAdaptor_CompCurve_DN(curve: BRepAdaptor_CompCurve, u: number, n: number): gp_Vec;
/** Create a 2D ellipse from axis and radii */
CreateGeom2d_Ellipse(axis: gp_Ax22d, majorRadius: number, minorRadius: number): Geom2d_Ellipse;
/** Create a 2D circle from axis and radius */
CreateGeom2d_Circle(axis: gp_Ax22d, radius: number): Geom2d_Circle;
/** Create a 2D li