@buerli.io/core
The state the buerli packages share: the drawings, each with its structure tree, its geometry, its selection
and its plugins, and the messages for the app. @buerli.io/classcad fills a drawing as ClassCAD changes it, and
@buerli.io/react renders it; apps mostly reach it through those two, and use a few things from here directly.
What it exposes
- getDrawing: a drawing's state, its structure tree, geometry, selection and plugins, and its API.
- DrawingState and DrawingAPI: what a drawing holds and what it can do.
- api: the store itself, with all drawings, to read, change and subscribe to.
- subscribeToDrawing: calls back when a part of a drawing changes.
- showMessage: tells the user something, in the message display of react-cad and Buerligons.
- Selector and SelectedItem: the lists the user picks faces, edges and other items into.
- GeometryConfig: how the geometry of solids is shown.
Example
import { BuerliCadFacade, createApi, init, WASMClient } from '@buerli.io/classcad'
import { getDrawing } from '@buerli.io/core'
init(drawingId => new WASMClient(drawingId, { token: 'ccpk_…' }))
// Connecting makes a drawing in the store
const drawingId = await new BuerliCadFacade().connect()
if (drawingId) {
await createApi(drawingId).v1.part.create({ name: 'Part' })
// The structure tree that ClassCAD sent: its objects by id
const { tree } = getDrawing(drawingId).structure
console.log(Object.values(tree).map(object => `${object.class} ${object.name}`))
}
API
| Name | Description |
|---|---|
| Drawings | A drawing is one model in the store: its structure tree, geometry, selections and plugins, which @buerli.io/classcad keeps up to date. Read it when an app needs to know what the model holds. |
| Messages | Messages for the user, which the message displays of react-cad and Buerligons show: to tell what an app is doing. |
| Selection | Selectors, the lists the user picks faces, edges and other items into in the 3D view, and what the user has selected in the model: for apps that let the user pick. |
| Geometry | How the geometry of solids is shown, and the bounds of a model. The three.js geometry itself, made from the graphic ClassCAD sends, is for apps that work with faces and edges directly. |
Advanced
Most apps do not need these directly: types they meet through the exports above, and what is there for special cases or for building on buerli itself.
| Name | Description |
|---|---|
| Measure | Positions, lengths, distances and angles of elements of the geometry, as the Measure plugin of react-cad shows them. |
| Plugins | Plugins add panels and 3D views to a CAD app, for the features of a model or for a whole drawing: for those who make plugins. |
| Utilities | Math for the coordinate systems of ClassCAD, and timing. |