@buerli.io/classcad

Connect buerli to the ClassCAD Server

Usage no npm install needed!

<script type="module">
  import buerliIoClasscad from 'https://cdn.skypack.dev/@buerli.io/classcad';
</script>

README

@buerli.io/classcad

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.

Install

npm install @buerli.io/classcad
yarn add @buerli.io/classcad

Usage example

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 (of1, step, ...) is loaded directly after the drawing is created ccAPI.baseModeler.load.