Skip to main content

API Usage

This section focuses on how to use ClassCAD from your own applications: choosing the right API (Part vs Solid, Assembly, Sketch, …), and understanding a few conventions that appear throughout the reference documentation.

tip

The API reference is detailed by design. If the parameter objects feel complex, start with the guides below and keep the “Conventions” section in mind.


Start Here


API Reference Overview

The API reference is grouped by modeling domains:

  • Part API: history/feature-based modeling
  • Solid API: direct solid operations inside a solid container
  • Assembly API: constraint-based assembly modeling
  • Sketch API: parametric 2D sketches with constraints
  • Curve API: curves, polylines, Bezier/interpolation
  • Drawing API: 2D views/hidden-line removal + DXF/SVG export
  • Common API: shared utilities (load/save/import/export, etc.)

Conventions You’ll See Often

Single JSON Parameter Object

Most calls accept a single JSON object as parameter. This keeps the API resilient when new optional keys are added over time.

Depending on the client integration, you may have two ways to call methods:

  • Unwrapped API: returns the result (throws on errors)
  • Wrapped API: returns the full response object with result plus message arrays

See details in Getting Started.

Object vs Array of Objects

Some endpoints accept either a single parameter object or an array of parameter objects to reduce network round-trips in remote/proxy operation.

Part API: targets and Solid Indices

Most Part API operations work on a single solid, but some features (e.g. pattern features) produce multiple solids. If you need to reference specific solids, you can pass { id, indices } in targets.

await api.v1.part.mirror({
id: partId,
targets: [
{ id: patternFeatureId, indices: [2, 4] },
{ id: shaftFeatureId },
],
references: [20],
})

Sketch API: Points Must Lie on the Workplane

Sketch geometry points are passed as [x, y, z], but sketches are planar. Only points with z = 0 are accepted; providing z != 0 results in an error.