Skip to main content

Work Geometry

The dialogs of a part's work points, axes, planes and coordinate systems: the references that sketches, features and assembly mates are placed on. They are registered and opened as the feature plugins are, and their views draw the work geometry in the scene.

Plugins​

WorkAxis​

The Work Axis feature's dialog: places a work axis by coordinates or on geometry: a curve, two points, two planes.

It is the plugin of the feature class CC_WorkAxis: an app maps the class to it in init's plugins, and react-cad opens it when the toolbar makes a new work axis and when one is double-clicked in the feature list. The dialog picks the type (a point and a direction as coordinates, a curve, two points, two planes, or a point and a direction picked in the model) and the geometry it is made from. Apply updates the feature (part.updateWorkAxis). Its view draws the axis while the feature is shown or its dialog is open.

Example​

import { init, ScgClassType, WASMClient } from '@buerli.io/classcad'
import { getDrawing } from '@buerli.io/core'
import { elements, WorkAxis } from '@buerli.io/react-cad'

init(drawingId => new WASMClient(drawingId, { token: 'ccpk_…' }), {
elements,
plugins: { [ScgClassType.CCWorkAxis]: WorkAxis },
})

// Code opens one by making it the active feature, with the id that `api.v1.part.workAxis` returns:
getDrawing(drawingId).api.plugin.setActiveFeature(axisId)

WorkCSys​

The Work Coordinate System feature's dialog: places a coordinate system on an origin and two axes, offset and rotated.

It is the plugin of the feature class CC_WorkCSys: an app maps the class to it in init's plugins, and react-cad opens it when the toolbar makes a new coordinate system and when one is double-clicked in the feature list. The dialog picks the type: Set takes an origin (a point, a vertex, an arc or a circle) and a primary and a secondary axis, the primary one invertible; Set and Custom take an offset and a rotation as Euler angles; Fixed is read-only. Apply updates the feature (part.updateWorkCSys). Its view draws the coordinate system, and its preview while the dialog is open.

Example​

import { init, ScgClassType, WASMClient } from '@buerli.io/classcad'
import { getDrawing } from '@buerli.io/core'
import { elements, WorkCSys } from '@buerli.io/react-cad'

init(drawingId => new WASMClient(drawingId, { token: 'ccpk_…' }), {
elements,
plugins: { [ScgClassType.CCWorkCSys]: WorkCSys },
})

// Code opens one by making it the active feature, with the id that `api.v1.part.workCSys` returns:
getDrawing(drawingId).api.plugin.setActiveFeature(csysId)

WorkPlane​

The Work Plane feature's dialog: places a work plane on a base plane, a plane, points or lines, with an offset.

It is the plugin of the feature class CC_WorkPlane: an app maps the class to it in init's plugins, and react-cad opens it when the toolbar makes a new work plane and when one is double-clicked in the feature list. The dialog picks the type (one of the base planes, a plane, three points, a line and a point, a point and a normal, a point and a plane, a line and a plane at an angle, or a position and a normal as coordinates) and the geometry, and takes the offset or the angle. Apply updates the feature (part.updateWorkPlane). Its view draws the plane while the feature is shown or its dialog is open.

Example​

import { init, ScgClassType, WASMClient } from '@buerli.io/classcad'
import { getDrawing } from '@buerli.io/core'
import { elements, WorkPlane } from '@buerli.io/react-cad'

init(drawingId => new WASMClient(drawingId, { token: 'ccpk_…' }), {
elements,
plugins: { [ScgClassType.CCWorkPlane]: WorkPlane },
})

// Code opens one by making it the active feature, with the id that `api.v1.part.workPlane` returns:
getDrawing(drawingId).api.plugin.setActiveFeature(planeId)

WorkPoint​

The Work Point feature's dialog: places a work point by coordinates or on geometry: a vertex, a midpoint, a center.

It is the plugin of the feature class CC_WorkPoint: an app maps the class to it in init's plugins, and react-cad opens it when the toolbar makes a new work point and when one is double-clicked in the feature list. The dialog picks the type (coordinates, a point, the midpoint of a line or of two points, the center of an arc or circle, the barycenter of a face, the intersection of two lines, or the incircle center of three lines) and the geometry it is made from. Apply updates the feature (part.updateWorkPoint). Its view draws the point while the feature is shown or its dialog is open.

Example​

import { init, ScgClassType, WASMClient } from '@buerli.io/classcad'
import { getDrawing } from '@buerli.io/core'
import { elements, WorkPoint } from '@buerli.io/react-cad'

init(drawingId => new WASMClient(drawingId, { token: 'ccpk_…' }), {
elements,
plugins: { [ScgClassType.CCWorkPoint]: WorkPoint },
})

// Code opens one by making it the active feature, with the id that `api.v1.part.workPoint` returns:
getDrawing(drawingId).api.plugin.setActiveFeature(pointId)

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.

WorkCoordSystem​

The dialog of CC_WorkCoordSystem features: places a coordinate system at an origin and two axes, or at coordinates.

It is the plugin of the feature class CC_WorkCoordSystem, which ClassCAD's v0 API updates (feature.updateWorkCoordSystem); the coordinate systems that react-cad's toolbar makes are of the class CC_WorkCSys, whose plugin is WorkCSys. An app whose models have such features (no call of ClassCAD's API makes one) maps the class to it in init's plugins, and a double click in the feature list opens it. Set takes an origin and a primary and a secondary axis; Custom takes the origin and the directions of the axes as coordinates; both take an offset and a rotation as Euler angles.

Example​

import { init, ScgClassType, WASMClient } from '@buerli.io/classcad'
import { getDrawing } from '@buerli.io/core'
import { elements, WorkCoordSystem } from '@buerli.io/react-cad'

init(drawingId => new WASMClient(drawingId, { token: 'ccpk_…' }), {
elements,
plugins: { [ScgClassType.CCWorkCoordSystem]: WorkCoordSystem },
})

// Code opens one of the drawing's tree by making it the active feature:
const { structure, api } = getDrawing(drawingId)
const csys = Object.values(structure.tree).find(obj => obj.class === ScgClassType.CCWorkCoordSystem)
if (csys) api.plugin.setActiveFeature(csys.id)