Guides
The API by domain
- Part: feature-based modelling, with a history.
- Solid: direct operations on solids.
- Assembly: parts and subassemblies, placed by constraints.
- Sketch: parametric 2D sketches with constraints.
- Curve: curves, polylines, Bézier and interpolated curves.
- Drawing: 2D views with hidden lines, DXF and SVG export.
- Common: load, save, import and export.
Conventions
Each method takes one parameter object. New optional keys can be added to it without breaking existing calls.
With @buerli.io/classcad, a call returns its result and throws on errors. The raw API returns an object with result and the messages instead.
Some methods take an array of parameter objects as well, to do several operations in one call.
Most Part API operations work on one solid, but some features, such as patterns, produce several. To reference particular solids, pass { id, indices } in targets:
await api.v1.part.mirror({
id: partId,
targets: [
{ id: patternFeatureId, indices: [2, 4] },
{ id: shaftFeatureId },
],
references: [20],
})
Sketch points are given as [x, y, z], but a sketch is planar: only z = 0 is accepted.