Solid
solidAPI#
Provides functions for interaction with the classcad solid api.
clearSolid#
Clears the given solid in the drawing.
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing | |
| solid | ObjectID | Id of the solid to clear |
Returns Promise<void>
clearSolids#
Clears all solids in the drawing.
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing |
Returns Promise<void>
copy#
Creates a copy of the given solid
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing | |
| solid | ObjectID | Id of the solid to copy |
Returns Promise<number>
Id of the created copy soild
createBox#
Creates a simple box solid
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing | |
| length | number | Length of the box (x-axis) | |
| width | number | Width of the box (y-axis) | |
| height | number | Height of the box (z-axis) |
Returns Promise<number>
Id of the created box solid
createCone#
Creates a simple cone solid
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing | |
| height | number | Height of the cone (z-axis) | |
| diameter1 | number | Diameter at the bottom of the cone | |
| diameter2 | number | Diameter at the top of the cone |
Returns Promise<number>
Id of the created cone solid
createCylinder#
Creates a simple cylinder solid
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing | |
| height | number | Height of the cylinder (z-axis) | |
| diameter | number | Diameter of the cylinder |
Returns Promise<number>
Id of the created cylinder solid
createExtrude#
Extrudes the region which is defined by the points and bulges
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing | |
| height | PointMemValue | Height of extrusion | |
| points | PointMemValue[] | Points which define the corners (vertices) of the polyline | |
| bulges | number[] | Bulge between two points. The bulge is tan(a/4), a is the included angle for the arc between the two points. Bulge is positive for arcs directed counterclockwise when looking in opposite direction of the normal. A semicircle has the bulge 1, a straight line the bulge 0. |
Returns Promise<number>
Id of the extruded solid
createExtrudeRegion#
Extrudes the region which is defined by the curve array
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing | |
| height | PointMemValue | Height of extrusion | |
| curveArray | CurveArray | The specific curve array, which is the result of transforming the THREE.Shape.curves into drawable region in ClassCAD. Depending on the curve types used in the THREE.Shape, this array contains all necessary points and control points in a multidimensional array. |
Returns Promise<number>
Id of the extruded solid
createFillet#
Creates a fillet at the given edges with given radius
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing | |
| radius | number | Radius of the fillet | |
| edges | ObjectID[] | Edges to create fillets on |
Returns Promise<number>
Id of the fillet solid
createRevolve#
Revolves the region which is defined by the points and bulges
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing | |
| position | PointMemValue | Position of rotation axis | |
| direction | PointMemValue | Direction of rotation axis | |
| angle | number | Angle of rotation in rad | |
| points | PointMemValue[] | Points which define the corners (vertices) of the polyline | |
| bulges | number[] | Bulge between two points. The bulge is tan(a/4), a is the included angle for the arc between the two points. Bulge is positive for arcs directed counterclockwise when looking in opposite direction of the normal. A semicircle has the bulge 1, a straight line the bulge 0. |
Returns Promise<number>
Id of the revolved solid
createRevolveRegion#
Revolves the region which is defined by the curve array
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing | |
| position | PointMemValue | Position of rotation axis | |
| direction | PointMemValue | Direction of rotation axis | |
| angle | number | Angle of rotation in rad | |
| curveArray | CurveArray | The specific curve array, which is the result of transforming the THREE.Shape.curves into drawable region in ClassCAD. Depending on the curve types used in the THREE.Shape, this array contains all necessary points and control points in a multidimensional array. |
Returns Promise<number>
Id of the revolved solid
createSphere#
Creates a simple sphere solid.
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing | |
| radius | number | Radius of the sphere |
Returns Promise<number>
Id of the created sphere solid
edgeLoops#
Returns all adjacent edges of a face or vertex
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing | |
| breps | ObjectID[] | Face or vertex ids to get the adjacent edges from |
Returns Promise<number[]>
Ids of all adjacent edges
export#
Writes the current solid or specific solids to a stream in stp data format and returns the data.
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing | |
| type | 'stp' | Type of the exported file, currently only 'stp' files possible | |
| solids? | ObjectID[] | Optional ids of the solids to export, otherwise all solids will be exported |
Returns Promise<any>
Data stream of the exported solids
import#
Loads an arraybuffer in stp file format. All solids existing in stp data will be returned in an array. Current drawing will not be overwritten, imports will just be added.
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing | |
| data | ArrayBuffer | Data of file as arraybuffer | |
| type | 'stp' | Type of importing file, currently only 'stp' possible |
Returns Promise<number[]>
Ids of all imported solids
init#
Initializes the drawing and creates an initial part.
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing |
Returns Promise<void>
intersect#
Creates an intersection between two solids.
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing | |
| solid1 | ObjectID | Id of the base solid of intersection | |
| keepSolid | boolean | Flag, whether to keep the solid or delete it after intersection | |
| solid2 | ObjectID | Id of the solid to intersect with base solid |
Returns Promise<number>
Id of result solid after intersection
load#
Loads an arraybuffer in native file format. Native file format is 'ofb', if you want to load 'stp' file formats, use import function. Current drawing will be overwritten by loaded data.
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing | |
| data | ArrayBuffer | Data of file as arraybuffer | |
| type | string | Type of loading file, currently only 'ofb' possible | |
| doClearDrawingAndInitialiseBM | boolean | Flag, whether to clear and initialise the drawing or not |
Returns Promise<number>
Id of the loaded product in the file
mirror#
Mirrors the solid at the specified plane.
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing | |
| solid | ObjectID | Id of the solid to be mirrored | |
| point | PointMemValue | Position of mirror plane | |
| normal | PointMemValue | Normal vector of mirror plane |
Returns Promise<void>
moveTo#
Moves the solid to the given position in global coordinates
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing | |
| solid | ObjectID | Id of the solid to move | |
| position | PointMemValue | Position to move the solid to |
Returns Promise<void>
offset#
Creates an offset of the solid.
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing | |
| solid | ObjectID | Id of the solid which becomes an offset | |
| offsetDistance | number | Distance of the offset |
Returns Promise<number>
Id of the offset solid
pick#
Returns all geometry depending on given type which matches the points.
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing | |
| solid | ObjectID | Id of the solid to look for geometry | |
| type | 'vertex' l 'edge' l 'face' | Type of geometry to look for, 'vertex' l 'edge' l 'face' | |
| points | PointMemValue[] | Points where geometry will be exptected |
Returns Promise<number[]>
Ids of all found geometry
rotateTo#
Rotates the given solid around x-, y- and z-axis with defined angles.
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing | |
| solid | ObjectID | Id of the solid to rotate | |
| rotationVec | PointMemValue | Vector of rotation around x-, y- and z-axis in rad |
Returns Promise<void>
save#
Writes the current drawing as native file format to a stream and returns the data. Native file format is 'ofb', for 'stp' file format use export method.
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing | |
| type | 'ofb' | Type of the saved file, currently only 'ofb' files possible |
Returns Promise<any>
Data stream of the saved solids
scale#
Scales the solid in all or specified axis.
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing | |
| solid | ObjectID | Id of the solid to scale | |
| pointOrFactor | PointMemValue l number | If factor is defined, the solid will be scaled in all direction with same scale value. Otherwise in the given x-, y- and z-direction of the vector. |
Returns Promise<void>
slice#
Slices the solid at specified plane. Part of solid which is on the positive side of defined plane will be removed.
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing | |
| solid | ObjectID | Id of the solid to slice | |
| point | PointMemValue | Position of the slice plane | |
| normal | PointMemValue | Normal vector of the slice plane |
Returns Promise<void>
solidExtendAtPlane#
The solid is extended at the defined plane with a solid created by extruding the section defined by the plane.
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing | |
| solid | ObjectID | Id of the solid which will be extended | |
| point | PointMemValue | Position of plane to extend from | |
| normal | PointMemValue | Normal vector of plane to extend from | |
| distance | number | Distance of extrusion |
Returns Promise<void>
subtract#
Creats a subtractio between two solids
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing | |
| solid1 | ObjectID | Id of the base solid of subtraction | |
| keepSolid | boolean | If true, the solid will be kept and can be used again | |
| solid2 | ObjectID | Id of the solid to subtract from base solid |
Returns Promise<number>
Id of result solid after intersection
union#
Creates a union between two solids
Declaration
Params
| Name | Type | Default | Description |
|---|---|---|---|
| drawingId | DrawingID | Id of the drawing | |
| solid1 | ObjectID | Id of the base solid of union | |
| keepSolid | boolean | If true, the solid will be kept and can be used again | |
| solid2 | ObjectID | Id of the solid to unite with base solid |
Returns Promise<number>
Id of the result solid after union