Skip to main content

Assembly Builder

assemblyBuilderAPI#

Provides functions for interaction with the classcad assembly builder api.

addAssemblyNode#

Declaration

async (drawingId: DrawingID, parentId: ObjectID, name: string): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
parentIdObjectID
namestring

Returns Promise<void>

addAssemblyNodeWithIdent#

Declaration

async (drawingId: DrawingID, parentIdent: string, nodeIdent: string, name: string): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
parentIdentstring
nodeIdentstring
namestring

Returns Promise<void>

addNodes#

Declaration

async (drawingId: DrawingID, nodes: NodeParam[]): Promise<number[]>

Params

NameTypeDefaultDescription
drawingIdDrawingID
nodesNodeParam[]

Returns Promise<number[]>

addProductReference#

Declaration

async (drawingId: DrawingID, productId: ObjectID, parentId: ObjectID, transformation: any): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
productIdObjectID
parentIdObjectID
transformationany

Returns Promise<void>

addProductReferenceWithIdent#

Declaration

async (drawingId: DrawingID, productIdent: string, nodeIdent: string, parentIdent: string, transformation: any): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
productIdentstring
nodeIdentstring
parentIdentstring
transformationany

Returns Promise<void>

convertToTemplate#

Declaration

async (drawingId: DrawingID, name: string): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
namestring

Returns Promise<void>

create3DConstraint#

Creates new 3D constraint in the assembly

Declaration

async (drawingId: DrawingID, assemblyId: ObjectID, cctype: string, name: string): Promise<number>

Params

NameTypeDefaultDescription
drawingIdDrawingID
assemblyIdObjectID
cctypestring
namestring

Returns Promise<number>
The id of the new created constraint or null.

createRootAssembly#

Creates a new rootAssembly.

Declaration

async (drawingId: DrawingID, name: string = 'AssemblyRoot'): Promise<number>

Params

NameTypeDefaultDescription
drawingIdDrawingID
name?string'AssemblyRoot'The name for the rootAssembly, is optional, default is 'Assembly'.

Returns Promise<number>

createAssemblyAsTemplate#

Creates a new assembly.

Declaration

async (drawingId: DrawingID, name: string = 'Assembly'): Promise<number>

Params

NameTypeDefaultDescription
drawingIdDrawingID
name?string'Assembly'The name for the assembly, is optional, default is 'Assembly'.

Returns Promise<number>

createPartAsTemplate#

Creates a new part and puts it in the part container. This part can be used to build assemblies.

Declaration

async (drawingId: DrawingID, name: string = 'Part'): Promise<number>

Params

NameTypeDefaultDescription
drawingIdDrawingID
name?string'Part'The name for the assembly part, is optional, default is 'Part'.

Returns Promise<number>

createRootAssemblyWithIdent#

Declaration

async (drawingId: DrawingID, name: string, ident: string): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
namestring
identstring

Returns Promise<void>

exportNode#

Exports 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

async (drawingId: DrawingID, nodeOrProdId: ObjectID, type: 'ofb' | 'stp' | 'step' | 'stl' = 'ofb'): Promise<Uint8Array | null>

Params

NameTypeDefaultDescription
drawingIdDrawingID
nodeOrProdIdObjectIDNode 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>

getAssemblyFromContainer#

Returns the assembly with given name from assembly container. If asmName is empty, all assemblies from assembly container will be returned.

Declaration

async (drawingId: DrawingID, asmName: string | null): Promise<number | number[]>

Params

NameTypeDefaultDescription
drawingIdDrawingID
asmNamestring l nullName of assembly to look for

Returns Promise<number | number[]>

getAssemblyNode#

Returns the node with given name of given reference with specified name. If nodeName is empty, all nodes from the given reference will be returned.

Declaration

async (drawingId: DrawingID, refId: ObjectID, nodeName: string | null): Promise<number | number[]>

Params

NameTypeDefaultDescription
drawingIdDrawingID
refIdObjectIDProduct reference to look for children of it
nodeNamestring l nullName of the child to look for

Returns Promise<number | number[]>

getPartFromContainer#

Returns the part with given name from part container. If partName is empty, all parts from part container will be returned.

Declaration

async (drawingId: DrawingID, partName: string | null): Promise<number | number[]>

Params

NameTypeDefaultDescription
drawingIdDrawingID
partNamestring l nullName of part to look for

Returns Promise<number | number[]>

getWorkCoordSystem#

Returns all wcs ids of refId with wcsName, if wcsName is empty all wcs ids will be returned.

Declaration

async (drawingId: DrawingID, refId: ObjectID, wcsName: string | null): Promise<number | number[]>

Params

NameTypeDefaultDescription
drawingIdDrawingID
refIdObjectIDProduct reference to look for wcs in its children
wcsNamestring l nullName of the wcs to look for

Returns Promise<number | number[]>

getConstraint#

Returns constraint information about the constraint with name constrName

Declaration

async (drawingId: DrawingID, refId: ObjectID, constrName?: string): Promise<any>

Params

NameTypeDefaultDescription
drawingIdDrawingID
refIdObjectIDProdcut reference to look for the constraint
constrName?stringOptional name for the constraint to look for

Returns Promise<any>

loadProduct#

Loads the given data.

Declaration

async (drawingId: DrawingID, data: ArrayBuffer, type: 'ofb' | 'stp' | 'step' | 'stl', name?: string): Promise<number[]>

Params

NameTypeDefaultDescription
drawingIdDrawingIDThe drawing id.
dataArrayBufferThe 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?stringAn optional name for data to load (for example filename). Has just logging purpose.

Returns Promise<number[]>

loadProductFromUrl#

Loads a product from the given URL. Caller is responsible the identical product is not used already.

Declaration

async (drawingId: DrawingID, url: string, filetype: 'ofb' | 'stp' | 'step' | 'stl'): Promise<number[]>

Params

NameTypeDefaultDescription
drawingIdDrawingIDThe drawing id.
urlstringThe url.
filetype'ofb' l 'stp' l 'step' l 'stl'The file type.

Returns Promise<number[]>
The ids of the loaded products.

removeNodes#

Declaration

async (drawingId: DrawingID, nodes: {
referenceId: ObjectID;
ownerId: ObjectID;
}[]): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
nodes{ referenceId: ObjectID; ownerId: ObjectID }[]

Returns Promise<void>

removeProductReference#

Declaration

async (drawingId: DrawingID, referenceId: ObjectID): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
referenceIdObjectID

Returns Promise<void>

removeProductReferenceWithIdent#

Declaration

async (drawingId: DrawingID, referenceIdent: string): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
referenceIdentstring

Returns Promise<void>

setCurrentNode#

Declaration

async (drawingId: DrawingID, referenceId: ObjectID): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
referenceIdObjectID

Returns Promise<void>

setCurrentProductByIdent#

Declaration

async (drawingId: DrawingID, ident: string): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
identstring

Returns Promise<void>

setIdentForNodeOrProduct#

Declaration

async (drawingId: DrawingID, ident: string, objId: ObjectID): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
identstring
objIdObjectID

Returns Promise<void>

setNodeTransformation#

Declaration

async (drawingId: DrawingID, referenceId: ObjectID, ownerId: ObjectID, transformation: any): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
referenceIdObjectID
ownerIdObjectID
transformationany

Returns Promise<void>

update3DConstraintValues#

Updates multiple constraint's specified (with 'paramName') limited value

Declaration

async (drawingId: DrawingID, constraintValues: ConstraintValueParam[]): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
constraintValuesConstraintValueParam[]

Returns Promise<void>

updateCylindricalConstraints#

Updates multiple Cylindrical 3D constraints

Declaration

async (drawingId: DrawingID, constraints: CylindricalConstraint[]): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
constraintsCylindricalConstraint[]

Returns Promise<void>

updateFastenedConstraints#

Updates multiple Fastened 3D constraints

Declaration

async (drawingId: DrawingID, constraints: FastenedConstraint[]): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
constraintsFastenedConstraint[]

Returns Promise<void>

updateFastenedOriginConstraints#

Updates multiple Fastened Origin 3D constraints

Declaration

async (drawingId: DrawingID, constraints: FastenedOriginConstraint[]): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
constraintsFastenedOriginConstraint[]

Returns Promise<void>

updateParallelConstraints#

Updates multiple Parallel 3D constraints

Declaration

async (drawingId: DrawingID, constraints: ParallelConstraint[]): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
constraintsParallelConstraint[]

Returns Promise<void>

updatePlanarConstraints#

Updates multiple Planar 3D constraints

Declaration

async (drawingId: DrawingID, constraints: PlanarConstraint[]): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
constraintsPlanarConstraint[]

Returns Promise<void>

updateRevoluteConstraints#

Updates multiple Revolute 3D constraints

Declaration

async (drawingId: DrawingID, constraints: RevoluteConstraint[]): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
constraintsRevoluteConstraint[]

Returns Promise<void>

updateSliderConstraints#

Updates multiple Slider 3D constraints

Declaration

async (drawingId: DrawingID, constraints: SliderConstraint[]): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
constraintsSliderConstraint[]

Returns Promise<void>