Skip to main content

Common

commonAPI#

Provides functions for interaction with the classcad common api.

clear#

Clears the complete drawing.

Declaration

async (drawingId: DrawingID): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingIDThe drawing id.

Returns Promise<void>

evaluateExpression#

Evaluates an expression.

Declaration

async (drawingId: DrawingID, objId: ObjectID, expr: string): Promise<string | number | PointMemValue | (string | number | PointMemValue)[]>

Params

NameTypeDefaultDescription
drawingIdDrawingIDThe drawing id.
objIdObjectID
exprstringExpression string to be evaluated.

Returns Promise<string | number | PointMemValue | (string | number | PointMemValue)[]>

getFacetingParameters#

Gets the faceting parameters used to tessellate surfaces and curves.

Declaration

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

Params

NameTypeDefaultDescription
drawingIdDrawingIDThe drawing id.

Returns Promise<[number, number]>
A JSON structure containing the faceting parameters: [angleToleranceInDegrees, ChordHeightTolerance].

setColor#

Sets the r,g,b values of a product.

Declaration

async (drawingId: DrawingID, productIds: ObjectID[], r: number, g: number, b: number): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
productIdsObjectID[]The array with ids of the products to change color.
rnumberThe red value (0...255).
gnumberThe green value (0...255).
bnumberThe blue value (0...255).

Returns Promise<void>

setFacetingParameters#

Sets the faceting parameters of current drawing

Declaration

async (drawingId: DrawingID, distanceTol: number, angleTol: number): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingIDThe drawing id.
distanceTolnumberDistance tolerance between geometrical arc and tesselated arc
angleTolnumberAngle tolerance between two surfaces of tesselation

Returns Promise<void>

setTransparency#

Sets the transparency of a product.

Declaration

async (drawingId: DrawingID, productIds: ObjectID[], transparency: number): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
productIdsObjectID[]The array with ids of the products to change color.
transparencynumberNumber value from 0 to 1.

Returns Promise<void>

setObjectCoordSystem#

Calls "SetObjectCoordSystem" on object or sets object coord system if function does not exist.

Declaration

async (drawingId: DrawingID, id: ObjectID, origin: PointMemValue, xVec: PointMemValue, yVec: PointMemValue): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
idObjectID
originPointMemValue
xVecPointMemValue
yVecPointMemValue

Returns Promise<void>

setObjectName#

Calls "SetObjectName" on object or sets object name if function does not exist.

Declaration

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

Params

NameTypeDefaultDescription
drawingIdDrawingID
idObjectID
namestring

Returns Promise<void>

updateDimensionPosition#

Updates position of dimension text.

Declaration

async (drawingId: DrawingID, dimensionId: ObjectID, point: PointMemValue): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingID
dimensionIdObjectID
pointPointMemValue

Returns Promise<void>