Solid
#
ApiNoHistoryA simple and intuitive javascript based api that incorporates solid operations like shapes, booleans (unions, subtracts, intersections), extrusions, revolves, blends, chamfers, slices, arrays, patterns, offsets, etc. The api is compatible with THREEJS and understands some of its primitives like curves and paths.
#
boxCreates a simple box.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
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 ID
Example
#
clearSolidClears the target solid in the drawing.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
solidId | VID | Id of the solid to be deleted |
Returns Promise<void>
Example
#
clearSolidsClears all existing solids in the drawing.
Declaration
Returns Promise<void>
Example
#
coneCreates a simple cone.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
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 ID
Example
#
copyCreates a copy of the solid.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
solidId | VID | Id of the solid to create a copy from |
Returns ID
Example
#
createBufferGeometryCreates the buffer geometry of the solid.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
solidId | VID | Id of the solid to create buffer geometry from |
Returns Promise<BufferGeometry | undefined>
Example
#
createSceneCreates ThreeJS scene from the given solids.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
solids | VID[] | Ids of the solids to create scene from | |
options.meshPerGeometry? | boolean |
Returns Promise<{ scene: Scene; part: THREE.Group; solids: THREE.Group[]; meshes: THREE.Mesh[] }>
#
cylinderCreates a simple cylinder.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
height | number | Height of the cylinder (z-axis) | |
diameter | number | Diamter of the cylinder |
Returns ID
Example
#
edgeLoopsReturns all adjacent edges of a face or vertex
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
breps | VIDs | Face or vertex ids to get the adjacent edges from |
Returns IDs
Example
#
exportWrites the current solid or specific solids to a stream in stp data format and returns the data.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
solidIds? | VIDs | [optional] specific solidIds to write to stream |
Returns Promise<Uint8Array | null>
Example
#
extendSolidAtPlaneThe 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 |
---|---|---|---|
target | VID | ||
point | Vec | Position of plane | |
normal | Vec | Normal vector of plane | |
distance | number | Distance of extension |
Returns Promise<void>
Example
#
extrudeCreates an extrusion.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
height | Vec | Height of extrusion | |
region | Polyline l THREE.Shape | Region which will be extruded, defined by Polyline or THREE.Shape |
Returns ID
Example
#
filletCreates a fillet at the given edges
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
radius | number | Radius of the fillet | |
edges | VIDs | Edges to create fillets on |
Returns ID
Example
#
getDrawingReturns the drawing of the current headless-session
Declaration
Returns DrawingState
DrawingState
Example
#
getDrawingIdReturns the drawing id of the current headless-session
Declaration
Returns DrawingID
DrawingID
Example
#
getStateReturns the state tree of the current headless-session
Declaration
Returns BuerliState
BuerliState
Example
#
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 |
---|---|---|---|
data | ArrayBuffer | Data as arraybuffer in stp format |
Returns IDs
Example
#
intersectCreates an intersection between solid and bodies.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
solidId | VID | Id of the solid to intersect | |
keepSolid | boolean | If true, the solid will be kept and can be used again | |
bodies | VID[] | Bodies to intersect with the solid |
Returns ID
Example
#
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 |
---|---|---|---|
data | ArrayBuffer | Data as arraybuffer in ofb format |
Returns IDs
#
mirrorMirrors the solid at the specified plane.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
solidId | VID | ||
point | Vec | Position of the mirror plane | |
normal | Vec | Normal vector of the mirror plane |
Returns Promise<void>
Example
#
moveToMoves the solid to the given position.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
solidId | VID | Id of the solid which will be moved | |
position | Vec | Position to move the solid to |
Returns Promise<void>
Example
#
offsetCreates an offset of the solid.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
solidId | VID | Solid which becomes an offset | |
offsetDistance | number | Distance of offset |
Returns ID
Example
#
pickReturns all edges or faces depending on type which matches the points.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
solidId | VID | Id of the solid to look for edges and faces | |
type | 'vertex' l 'edge' l 'face' | Type of geometry to look for --> 'edge' or 'face' | |
points | Vec[] | Points where edges and faces will be expected |
Returns IDs
Example
#
revolveRevolves the given region.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
position | Vec | Position of rotation axis | |
direction | Vec | Direction of rotation axis | |
angle | number | Angle of rotation in rad | |
region | Polyline l THREE.Shape | Region which will be revolved, defined by Polyline or THREE.Shape |
Returns ID
Example
#
rotateToRotates the given solid.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
solidId | VID | Id of the solid to rotate | |
rotationVec | Vec | Vector of rotation around x-, y- and z-axis |
Returns Promise<void>
Example
#
saveWrites the current drawing as native file format to a stream and returns the data. Native file is 'ofb', for 'stp' file format use export method.
Important notes about the ofb format:
- It contains binary geometry blocks.
- Do not try to convert it to text, the geometry blocks will get damaged!
Declaration
Returns Promise<Uint8Array | null>
Example
#
scaleScales the solid in all or specified axis.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
solidId | VID | Id of the solid to scale | |
vectorOrFactor | Vec 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>
Example
#
setFacetingParametersSets the global faceting parameters that will stick for this drawing. This defines how detailed solids will be displayed and can yield smaller payloads.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
distanceTol | number | Distance tolerance | |
angleTol | number | Angle tolerance |
Returns Promise<void>
Void
Example
#
setFacetingParamsSets the faceting parameters of graphic objects. This defines how detailed solids will be displayed.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
distanceTol | number | Tolerated distance between theoretic and tesselated arc | |
angleTol | number | Tolerated angle between normal vectors of faces which build an arc |
Returns ID
Example
#
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 |
---|---|---|---|
solidId | VID | Id of solid to slice | |
point | Vec | Position of plane | |
normal | Vec | Normal vector of plane |
Returns Promise<void>
Example
#
sphereCreates a simple sphere.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
radius | number | Radius of the sphere |
Returns ID
Example
#
subtractCreates a subtraction between solid and bodies.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
solidId | VID | Id of the solid to subtract | |
keepSolid | boolean | If true, the solid will be kept and can be used again | |
bodies | VID[] | Bodies to subtract from the solid |
Returns ID
Example
#
unionCreates an union between solid and bodies.
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
solidId | VID | Id of the solid to unify | |
keepSolid | boolean | If true, the solid will be kept and can be used again | |
bodies | VID[] | Bodies to unify with the solid |
Returns ID
Example
#
createPolylineCreates a polyline from the given fillet points
Declaration
Params
Name | Type | Default | Description |
---|---|---|---|
fPts | FilletPoint[] | Points of the polyline with its associated fillet radius |
Returns Polyline
Example
#
FilletPointPoint definition where the fillet will be added with a specified radius.
Members
Name | Type | Description |
---|---|---|
point | Vector3 | Point where the corner of the polyline will be. |
radius | number | Radius of the fillet at the position of point. |
#
PolylinePolyline of points and bulges. Bulges define the arc between the current and the next point.
Members
Name | Type | Description |
---|---|---|
points | Vector3[] | Points where the corners of the polyline will be. |
bulges | number[] | Bulges which define the arcs. |