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.
objIdObjectIDObjectID of any (?) object related to expr evaluation.
exprstringExpression string to be evaluated.

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

getDatabaseSettings#

Returns the current general settings from the internal classcad database.

Declaration

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

Params

NameTypeDefaultDescription
drawingIdDrawingIDThe drawing id.

Returns Promise<number[]>
Array containing the general settings

  • [0] = isGraphicEnabled
  • [1] = isCCGraphicEnabled
  • [2] = isInvisibleGraphicEnabled
  • [3] = isSketchGraphicEnabled
  • [4] = facetingParamsMode
  • [5] = facetingChordHeightTol
  • [6] = facetingAngleTol
  • [7] = doCurveTessellation

getFacetingParameters#

Gets the default 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].

setAppearance#

Sets the appearance of the given entities (solid, sheet, curve arrays) like color, transparency, chord height and angle tolerance

Declaration

async (drawingId: DrawingID, objectIds: ObjectID[], appearance: AppearanceParam): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingIDThe drawing id.
objectIdsObjectID[]The array with ids of the entities to change appearance.
appearanceAppearanceParamThe appearance to set on the given entities.

Returns Promise<void>

setColor#

DEPRECATED use setAppearance() instead, setColor() will be removed in a future release.

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
drawingIdDrawingIDThe drawing id.
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>

setDatabaseSettings#

Sets optional settings on internal classcad database for general classcad server behaviour.

Declaration

async (drawingId: DrawingID, settings?: Settings): Promise<void>

Params

NameTypeDefaultDescription
drawingIdDrawingIDThe drawing id.
settings?SettingsObject of optional parameters to define general settings.

Returns Promise<void>

setFacetingParameters#

Sets the default 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. Synonym for chordHeightTol.
angleTolnumberAngle tolerance between two surfaces of tesselation

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>

setTransparency#

DEPRECATED use setAppearance() instead, setTransparency() will be removed in a future release.

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>

updateDimensionPosition#

Updates position of dimension text.

Declaration

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

Params

NameTypeDefaultDescription
drawingIdDrawingID
dimensionIdObjectID
pointPointMemValue

Returns Promise<void>