Usage information and reference details can be found in the buerli documentation
@buerli.io/classcad
is completely implemented in Typescript and accordingly offers documented types for all interfaces.
npm install @buerli.io/classcad
yarn add @buerli.io/classcad
import { ccAPI } from '@buerli.io/classcad'
const loadFile = async (fileName: string, data: ArrayBuffer): Promise<DrawingID | null> => {
const type = extname(fileName).replace('.', '')
const drawingId = await ccAPI.base.createCCDrawing()
if (drId) {
await ccAPI.baseModeler.load(drawingId, data, type, fileName)
}
return drawingId
}
The example shows how to create a new drawing. The API call ccAPI.base.createCCDrawing
creates both the websocket and a drawing in buerli-core and connects the two. The data of the drawing can then be retrieved using the drawing ID returned. In addition, the content of a file (ofb, step, ...) is loaded directly after the drawing is created ccAPI.baseModeler.load
.