import { BufferGeometry, Material, Object3D, Scene } from 'three'; import { DrawingID, ObjectID, InteractionInfo } from '@buerli.io/core'; import { ScgGraphicType } from '@classcad/api-js'; import { UnwrappedApiType } from './createUnwrappedApi'; declare type GrT = ScgGraphicType.POINT | ScgGraphicType.LINE | ScgGraphicType.ARC | ScgGraphicType.CIRCLE | ScgGraphicType.PLANE | ScgGraphicType.CYLINDER | ScgGraphicType.CONE | ScgGraphicType.SPHERE | ScgGraphicType.NURBSCURVE | ScgGraphicType.NURBSSURFACE; export declare type ClassCADApi = UnwrappedApiType; /** * Basic ClassCAD API functions. * All other API's are using these base functions. */ export declare class BuerliCadFacade { private _drawingId; private _api; static utils: { connect: (drawingName?: string) => Promise; disconnect: (drawingId: DrawingID) => Promise; reconnect: (drawingId: DrawingID) => Promise; fetchTree: (drawingId: DrawingID) => Promise; undo: (drawingId: DrawingID, state?: string) => Promise; redo: (drawingId: DrawingID, state?: string) => Promise; callMiddleware: (drawingId: DrawingID, middlewareCommand: string, data: any) => Promise; }; get drawingId(): DrawingID; get api(): ClassCADApi; /** * Disconnect from ClassCAD and remove the buerli drawing from the buerli state. */ destroy(): Promise; /** * Creates a new drawing and its Socket client and connects it to the server. * * @returns The id of the new drawing. */ connect(drawingName?: string): Promise; /** * Disconnect from ClassCAD. * - The buerli drawing will be kept! * - It does not remove the Socket client! * - The ClassCAD API will not be available anymore */ disconnect(): Promise; /** * Executes the following sequence: * 1. @see Connection.disconnect * 2. connect (internal function) * 3. @see api.v1.common.recalc */ reconnect(): Promise; /** * Creates the buffer geometry of any product (part or assembly). * @param productId id of the product to create buffer geometry from * @example * // Creates a cone with bottom diameter = 20, top diameter = 0 and height = 30 * const part = api.createPart('Part') * api.cone(part, [], 20, 0, 30) * const geoms = await api.createBufferGeometry(part) * return geoms.map(geom => new THREE.Mesh(geom, new THREE.MeshStandardMaterial())) * @return array of buffer geometry */ createBufferGeometry(objectId?: ObjectID | ObjectID[]): Promise; /** * Creates the threeJS scene of any product (part or assembly). * @param productId id of the product to create scene from * @param options optional object to define different settings. * @param meshPerGeometry boolean flag to define if a part/solid will have a mesh for each * geometry element or if the elements will be merged to one mesh * @return object containing all the created THREE objects like scene, nodes and materials * @example // tbd */ createScene(objectId?: ObjectID | ObjectID[], options?: { meshPerGeometry?: boolean; structureOnly?: boolean; }): Promise<{ scene: Scene; nodes: { [key: string]: Object3D; }; materials: { [key: string]: Material; }; }>; createThreeShape(owner: ObjectID, shape: THREE.Shape): Promise; createPolyline(owner: ObjectID, fPts: { point: THREE.Vector3; radius: number; }[], close?: boolean): Promise; selectGeometry(types: GrT[], count?: number): Promise; } export {};