Solid
#
solidAPIProvides functions for interaction with the classcad solid api.
#
clearSolidClears 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>
#
clearSolidsClears all solids in the drawing.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | Id of the drawing |
Returns Promise<void>
#
copyCreates 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
#
createBoxCreates 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
#
createConeCreates 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
#
createCylinderCreates 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
#
createExtrudeExtrudes 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
#
createExtrudeRegionExtrudes 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
#
createFilletCreates 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
#
createRevolveRevolves 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
#
createRevolveRegionRevolves 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
#
createSphereCreates 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
#
edgeLoopsReturns 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
#
exportWrites 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
#
importLoads 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
#
initInitializes the drawing and creates an initial part.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
drawingId | DrawingID | Id of the drawing |
Returns Promise<void>
#
intersectCreates 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
#
loadLoads 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
#
mirrorMirrors 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>
#
moveToMoves 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>
#
offsetCreates 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
#
pickReturns 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
#
rotateToRotates 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>
#
saveWrites 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
#
scaleScales 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>
#
sliceSlices 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>
#
solidExtendAtPlaneThe 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>
#
subtractCreats 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
#
unionCreates 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