Common
commonAPI#
Provides functions for interaction with the classcad common api.
clear#
Clears the complete drawing.
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | The drawing id. |
Returns Promise<void>
evaluateExpression#
Evaluates an expression.
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | The drawing id. | |
| objId | ObjectID | ObjectID of any (?) object related to expr evaluation. | |
| expr | string | Expression string to be evaluated. |
Returns Promise<string | number | PointMemValue | (string | number | PointMemValue)[]>
getDatabaseSettings#
Returns the current general settings from the internal classcad database.
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | The 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
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | The 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
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | The drawing id. | |
| objectIds | ObjectID[] | The array with ids of the entities to change appearance. | |
| appearance | AppearanceParam | The 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
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | The drawing id. | |
| productIds | ObjectID[] | The array with ids of the products to change color. | |
| r | number | The red value (0...255). | |
| g | number | The green value (0...255). | |
| b | number | The blue value (0...255). |
Returns Promise<void>
setDatabaseSettings#
Sets optional settings on internal classcad database for general classcad server behaviour.
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | The drawing id. | |
| settings? | Settings | Object of optional parameters to define general settings. |
Returns Promise<void>
setFacetingParameters#
Sets the default faceting parameters of current drawing
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | The drawing id. | |
| distanceTol | number | Distance tolerance between geometrical arc and tesselated arc. Synonym for chordHeightTol. | |
| angleTol | number | Angle 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
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | ||
| id | ObjectID | ||
| origin | PointMemValue | ||
| xVec | PointMemValue | ||
| yVec | PointMemValue |
Returns Promise<void>
setObjectName#
Calls "SetObjectName" on object or sets object name if function does not exist.
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | ||
| id | ObjectID | ||
| name | string |
Returns Promise<void>
setTransparency#
DEPRECATED use setAppearance() instead, setTransparency() will be removed in a future release.
Sets the transparency of a product.
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | ||
| productIds | ObjectID[] | The array with ids of the products to change color. | |
| transparency | number | Number value from 0 to 1. |
Returns Promise<void>
updateDimensionPosition#
Updates position of dimension text.
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | ||
| dimensionId | ObjectID | ||
| point | PointMemValue |
Returns Promise<void>