UNPKG

@bitbybit-dev/occt

Version:

Bit By Bit Developers CAD algorithms using OpenCascade Technology kernel. Run in Node and in Browser.

94 lines (93 loc) 2.8 kB
import { OpenCascadeInstance, TopoDS_Shape, TDocStd_Document } from "../../bitbybit-dev-occt/bitbybit-dev-occt"; import { OccHelper } from "../occ-helper"; export interface AssemblyComponent { id: string; name: string; type: "assembly" | "part"; shape?: TopoDS_Shape; children: AssemblyComponent[]; transformation: { translation: [number, number, number]; rotation: [number, number, number, number]; scale: [number, number, number]; matrix: number[]; }; properties: { volume?: number; surfaceArea?: number; centerOfMass?: [number, number, number]; boundingBox?: { min: [number, number, number]; max: [number, number, number]; }; }; attributes: { material?: string; density?: number; mass?: number; [key: string]: any; }; color?: { r: number; g: number; b: number; a: number; }; pmi?: PMIData[]; } export interface PMIData { type: "dimension" | "tolerance" | "annotation" | "feature"; text: string; position: [number, number, number]; direction: [number, number, number]; properties: { [key: string]: any; }; } export interface AssemblyStructure { version: string; units: string; root: AssemblyComponent; metadata: { totalParts: number; totalAssemblies: number; createdAt: string; source: string; }; } export declare class OCCTIOAssembly { private readonly occ; private readonly och; constructor(occ: OpenCascadeInstance, och: OccHelper); private colorAssignments; private parseComponentWithXCAF; private extractChildrenWithXCAF; private extractColorFromXCAF; private convertQuantityColorToRgba; private extractSubShapeColor; private extractNameFromLabel; private extractAttributesFromXCAF; private extractProperties; private extractPMI; private extractAnnotationsFromShape; private extractCylindricalFeatures; private extractTransformation; private extractTransformationMatrix; private matrixToQuaternion; private generateId; private countComponents; serializeAssembly(assembly: AssemblyStructure): string; private cleanAssemblyForSerialization; parseXCAFDocument(doc: TDocStd_Document): AssemblyStructure; private createEmptyRootComponent; private parseXCAFComponent; private extractXCAFChildren; private extractNameFromXCAFLabel; private extractXCAFColor; private extractXCAFAttributes; private extractMaterialFromLabel; private extractMaterialName; private extractMaterialDensity; private extractAdditionalMaterialProperties; private buildColorAssignments; }