Skip to main content

Assembly Constraints

The dialogs of an assembly's constraints, which fix instances to each other or let them move at their mates (fastened, slider, revolute, cylindrical, planar, parallel, spherical), and of groups, patterns and gears of instances. An app maps the constraint classes to them in init's plugins; the assembly toolbar opens one for a new constraint, and a double click in the constraint list for one that is there.

Plugins​

Fastened​

The Fastened constraint's dialog: fixes two instances to each other, at a mate of each.

It is the plugin of the constraint class CC_FastenedConstraint: an app maps the class to it in init's plugins, and react-cad opens it when the assembly toolbar makes a new fastened constraint and when one is double-clicked in the constraint list. The dialog picks the two mates and either keeps the instances where they are (Use current transform) or takes offsets along and rotations about X, Y and Z. Apply updates the constraint (assembly.updateFastened) and the dialog stays open.

Example​

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

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

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

Revolute​

The Revolute constraint's dialog: lets an instance turn about the Z axis of another one's mate.

It is the plugin of the constraint class CC_RevoluteConstraint: an app maps the class to it in init's plugins, and react-cad opens it when the assembly toolbar makes a new revolute constraint and when one is double-clicked in the constraint list. The dialog picks the two mates, takes the Z offset and optional limits of the rotation, and once the constraint exists, its Values section turns the instance within them. Apply updates the constraint (assembly.updateRevolute) and the dialog stays open.

Example​

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

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

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

CircularPatternConstraint​

The Circular Pattern constraint's dialog: copies an instance about the Z axis of a mate.

It is the plugin of the constraint class CC_CircularPatternConstraint: an app maps the class to it in init's plugins, and react-cad opens it when the assembly toolbar makes a new circular pattern and when one is double-clicked in the constraint list. The dialog picks the instance and the mate, and takes the number of copies, the angle between them and an offset along the axis. Apply updates the constraint (assembly.updateCircularPattern) and the dialog stays open.

Example​

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

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

// Code opens one by making it the active feature, with the `constraint` that `api.v1.assembly.circularPattern`
// returns:
getDrawing(drawingId).api.plugin.setActiveFeature(constraintId)

Cylindrical​

The Cylindrical constraint's dialog: lets an instance slide along and turn about the Z axis of another one's mate.

It is the plugin of the constraint class CC_CylindricalConstraint: an app maps the class to it in init's plugins, and react-cad opens it when the assembly toolbar makes a new cylindrical constraint and when one is double-clicked in the constraint list. The dialog picks the two mates and takes optional limits of the Z offset and the rotation, and once the constraint exists, its Values section moves the instance within them. Apply updates the constraint (assembly.updateCylindrical) and the dialog stays open.

Example​

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

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

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

FastenedOrigin​

The Fastened Origin constraint's dialog: fixes an instance at the assembly's origin, at one of its mates.

It is the plugin of the constraint class CC_FastenedOriginConstraint: an app maps the class to it in init's plugins, and react-cad opens it when the assembly toolbar makes a new fastened origin and when one is double-clicked in the constraint list. The dialog picks the mate and either keeps the instance where it is (Use current transform) or takes offsets along and rotations about X, Y and Z. Apply updates the constraint (assembly.updateFastenedOrigin) and the dialog stays open.

Example​

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

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

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

Gear​

The Gear relation's dialog: couples two revolute constraints, so that one turns with the other by a ratio.

It is the plugin of the constraint class CC_GearRelation: an app maps the class to it in init's plugins, and react-cad opens it when the assembly toolbar makes a new gear relation and when one is double-clicked in the constraint list. The dialog picks the two revolute constraints and takes the ratio and the second gear's rotation shift. Apply updates the relation (assembly.updateGear) and the dialog stays open.

Example​

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

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

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

Group​

The Group constraint's dialog: makes instances move as one.

It is the plugin of the constraint class CC_GroupConstraint: an app maps the class to it in init's plugins, and react-cad opens it when the assembly toolbar makes a new group and when one is double-clicked in the constraint list. The dialog picks the instances. Apply updates the constraint (assembly.updateGroup) and the dialog stays open.

Example​

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

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

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

LinearPatternConstraint​

The Linear Pattern constraint's dialog: copies an instance along the Z axes of one or two mates.

It is the plugin of the constraint class CC_LinearPatternConstraint: an app maps the class to it in init's plugins, and react-cad opens it when the assembly toolbar makes a new linear pattern and when one is double-clicked in the constraint list. The dialog picks the instance and the mate of the first direction, optionally a second one, and takes the number of copies and the offset along each. Apply updates the constraint (assembly.updateLinearPattern) and the dialog stays open.

Example​

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

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

// Code opens one by making it the active feature, with the `constraint` that `api.v1.assembly.linearPattern`
// returns:
getDrawing(drawingId).api.plugin.setActiveFeature(constraintId)

Parallel​

The Parallel constraint's dialog: keeps the Z axes of two instances' mates parallel.

It is the plugin of the constraint class CC_ParallelConstraint: an app maps the class to it in init's plugins, and react-cad opens it when the assembly toolbar makes a new parallel constraint and when one is double-clicked in the constraint list. The dialog picks the two mates and takes optional limits of the X, Y and Z offsets and the rotation, and once the constraint exists, its Values section moves the instance within them. Apply updates the constraint (assembly.updateParallel) and the dialog stays open.

Example​

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

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

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

Planar​

The Planar constraint's dialog: lets an instance slide and turn in the XY plane of another one's mate.

It is the plugin of the constraint class CC_PlanarConstraint: an app maps the class to it in init's plugins, and react-cad opens it when the assembly toolbar makes a new planar constraint and when one is double-clicked in the constraint list. The dialog picks the two mates, takes the Z offset and optional limits of the X and Y offsets and the rotation, and once the constraint exists, its Values section moves the instance within them. Apply updates the constraint (assembly.updatePlanar) and the dialog stays open.

Example​

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

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

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

Slider​

The Slider constraint's dialog: lets an instance slide along the Z axis of another one's mate.

It is the plugin of the constraint class CC_SliderConstraint: an app maps the class to it in init's plugins, and react-cad opens it when the assembly toolbar makes a new slider and when one is double-clicked in the constraint list. The dialog picks the two mates, takes the X and Y offsets and optional limits of the Z offset, and once the constraint exists, its Values section moves the instance within them. Apply updates the constraint (assembly.updateSlider) and the dialog stays open.

Example​

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

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

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

Spherical​

The Spherical constraint's dialog: joins two instances at their mates' origins like a ball joint.

It is the plugin of the constraint class CC_SphericalConstraint: an app maps the class to it in init's plugins, and react-cad opens it when the assembly toolbar makes a new spherical constraint and when one is double-clicked in the constraint list. The dialog picks the two mates and takes an optional limit of the rotation. Apply updates the constraint (assembly.updateSpherical) and the dialog stays open.

Example​

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

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

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