Assembly Builder
#
assemblyBuilderAPIProvides functions for interaction with the classcad assembly builder api.
#
addInstancesAdds products as instances to root assembly, assembly instance or assembly template.
- If the owner is an instance in the expanded tree, its template in the assembly container will also be updated.
- If the onwer is an assembly template, all instances of the template will also be updated
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | ||
instances | InstanceParam[] | Array of objects, containing the information of to adding instances |
Returns Promise<number[]>
Array containing the ids of the added instances
#
convertToTemplateConverts the current root assembly into a template and adds it to the assembly container. It also creates a new empty root assembly
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
name | string | Name of the converted template |
Returns Promise<void>
#
create3DConstraintCreates new 3D constraint in the assembly
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
assemblyId | ObjectID | Id of the assembly to create the constraint on | |
cctype | string | Type of constraint to create | |
name | string | Name of the created constraint |
Returns Promise<number>
The id of the new created constraint or null.
#
createAssemblyAsTemplateCreates a new assembly template. This template will be added to the assembly container and can be instantiated multiple times as a sub assembly in the root assembly or in other assembly template. Assembly templates can only be created if the root is already an assembly.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
name? | string | 'Assembly' | Optional name for the assembly template, default is 'Assembly'. |
Returns Promise<number>
Id of the assembly template
#
createPartAsTemplateCreates a new part template. This template will be added to the part container and can be instantiated multiple times in the root assembly or in assembly templates. Part templates can only be created if the root is already an assembly.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
name? | string | 'Part' | Optional name for the part template, default is 'Part'. |
Returns Promise<number>
Id of the part template
#
createRootAssemblyCreates a new root assembly.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
name? | string | 'AssemblyRoot' | Optional name for the root assembly, default is 'AssemblyRoot'. |
options.ident? | ObjectIdent |
Returns Promise<number>
The id of the created root assembly.
#
exportNodeExports the given node and its potential subtree in case of it is an assembly. The node will be converted to a CC_AssemblyRoot. All used products with its containers will be exported as well.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
nodeOrProdId | ObjectID | Node in expanded tree or product to export | |
type? | 'ofb' l 'stp' l 'step' l 'stl' | 'ofb' | Type of file: either 'ofb', 'stp' or 'stl' |
Returns Promise<Uint8Array | null>
The data or null.
#
finishMovingUnderConstraintsFinishes moving constrained objects (products).
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
assemblyId | ObjectID | Id of the assembly which contains moved objects. |
Returns Promise<void>
#
loadProductLoads the given data.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
data | ArrayBuffer | The data of the file as ArrayBuffer. | |
type | 'ofb' l 'stp' l 'step' l 'stl' | The data type. The server needs the type of the data to determine which import needs to be used. Possible values: 'ofb' l 'stp' l 'step' l 'stl'. | |
name? | string | An optional name for data to load (for example filename). Has just logging purpose. | |
options.ident? | ObjectIdent |
Returns Promise<number[]>
Array containing the id of the loaded products
#
loadProductFromUrlLoads a product from the given URL. Caller is responsible the identical product is not used already.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
url | string | The url. | |
filetype | 'ofb' l 'stp' l 'step' l 'stl' | The file type. | |
options.ident? | ObjectIdent |
Returns Promise<number[]>
The ids of the loaded products.
#
moveUnderConstraintsAttempts to move constrained objects (products). 'rotation' and 'offset' parameters should be decomposed from transform T: W0*T=W, where W0 is the original transform of the moved object, and W is a wanted transform.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
assemblyId | ObjectID | Id of the assembly which contains moved objects. | |
rotation | number[] | An array of 9 numbers which make 3 consecutive rotation (basis) vectors. | |
offset | number[] | An array of 3 numbers which make a translation vector. |
Returns Promise<void>
#
removeInstancesRemoves the given instances
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id | |
instances | { id: ObjectID l ObjectIdent }[] | Instances to be removed. Array of objects containing the instance id. |
Returns Promise<void>
#
setCurrentInstanceSets the current instance
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id | |
id | ObjectID | Id of the instance to set as the current |
Returns Promise<void>
#
startMovingUnderConstraintsPrepares to move constrained objects (products).
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | The drawing id. | |
assemblyId | ObjectID | Id of the assembly which contains moved objects. | |
productRefIds | ObjectID[] | An array of object ids to be moved. | |
pivotInfo | number[] | An array of numbers; For mucType === 0 or 1 it should contain 3 numbers which make a transform origin coords (for example, Gizmo position). | |
mucType | 0 l 1 l 2 | Should equal 0 in case of one-dimensionsal translation, 1 in case of two-dimensional translation, 2 in case of rotation |
Returns Promise<void>
#
transformInstancesTransforms the given instances by given transformations.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | ||
instances | { id: ObjectID l ObjectIdent; transformation: TransformParam; options?: { isLocal?: boolean } }[] | Array of objects, containing the information of to transform instances |
Returns Promise<void>
#
update3DConstraintValuesUpdates multiple constraint's specified (with 'paramName') limited value
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | ||
constraintValues | ConstraintValueParam[] | Array of objects, containing the information of to update 3d constraint values |
Returns Promise<void>
#
updateCircularPatternConstraintsUpdates multiple Circular Pattern 3D constraints
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | ||
constraints | CircularPatternConstraint[] | Array of objects, containing the information to update the circular pattern constraint |
Returns Promise<void>
#
updateCylindricalConstraintsUpdates multiple Cylindrical 3D constraints
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | ||
constraints | CylindricalConstraint[] | Array of objects, containing the information to update the cylindrical constraint |
Returns Promise<void>
#
updateFastenedConstraintsUpdates multiple Fastened 3D constraints
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | ||
constraints | FastenedConstraint[] | Array of objects, containing the information to update the fastened constraint |
Returns Promise<void>
#
updateFastenedOriginConstraintsUpdates multiple Fastened Origin 3D constraints
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | ||
constraints | FastenedOriginConstraint[] | Array of objects, containing the information to update the fastened origin constraint |
Returns Promise<void>
#
updateGearRelationsUpdates multiple Gear 3D relations
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | ||
relations | GearRelation[] | Array of objects, containing the information to update the gear relation |
Returns Promise<void>
#
updateGroupConstraintsUpdates multiple Group 3D constraints
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | ||
constraints | GroupConstraint[] | Array of objects, containing the information to update the group constraint |
Returns Promise<void>
#
updateLinearPatternConstraintsUpdates multiple Linear Pattern 3D constraints
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | ||
constraints | LinearPatternConstraint[] | Array of objects, containing the information to update the linear pattern constraint |
Returns Promise<void>
#
updateParallelConstraintsUpdates multiple Parallel 3D constraints
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | ||
constraints | ParallelConstraint[] | Array of objects, containing the information to update the parallel constraint |
Returns Promise<void>
#
updatePlanarConstraintsUpdates multiple Planar 3D constraints
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | ||
constraints | PlanarConstraint[] | Array of objects, containing the information to update the planar constraint |
Returns Promise<void>
#
updateRevoluteConstraintsUpdates multiple Revolute 3D constraints
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | ||
constraints | RevoluteConstraint[] | Array of objects, containing the information to update the revolute constraint |
Returns Promise<void>
#
updateSliderConstraintsUpdates multiple Slider 3D constraints
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | ||
constraints | SliderConstraint[] | Array of objects, containing the information to update the slider constraint |
Returns Promise<void>
#
updateSphericalConstraintsUpdates multiple Spherical 3D constraints
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | ||
constraints | SphericalConstraint[] | Array of objects, containing the information to update the spherical constraint |
Returns Promise<void>