3D shapes

box

Creates a box with its bottom lying on X-Z plan with its center at the origin.

Syntax

cadlib.box( {width, height, depth});

Parameters

Name Type Description
width number width of the box
height number height of the box
depth number depth of the box

Returns

Return

Solid


cylinder

A cylinder with its bottom lying on X-Z plan with a given center.

Syntax

cadlib.cylinder(options)

//Arguments

options: {
    center,	 // (Point): Specifies center of the bottom face of the cynlinder.
    up, 	// (Vector): Unit vector in the direction of cylinder axis
    radius,	// (Number): Radius of the cylinder
    height	// (Number): Height of the cynlinder
}

//Returns

Solid

Capped Sphere

Sphere with its bottom lying on X-Z plan with a given center.

Syntax

cadlib.cylinder(options)

//Arguments

options: {
    center, //(Point): Specifies center of the sphere.
    radius, //(Number): Radius of the sphere
    angle1, //(Number, Optional): Angle of the top cap in degrees.
    angle2, //(Number, Optional): Angle of the bottom cap in degrees

// Returns

Solid


//Example

Torus

Syntax

cadlib.torus(options)

//Arguments

options: {
    center, // (Point): Specifies center of the sphere.
    axis, // (Vector): Unit vector in the direction of torus.
    innerRadius, // (Number): Inner radius of the sphere
    outerRadius  // (Number): Outer radius of the sphere

//Returns

Solid



Capped Cone

Capped cone with center of the origin and axis in up (positive Y) direction.

Syntax


cadlib.cone(options)

//Arguments

options: {
    height, // (Number): Height of the cone.
    r1, // (Number): Radius of the bottom face
    r2, // (Number): Radius of the top face
}

Returns

Solid


Pie

Creates a pie.

Syntax

cadlib.pie(edges);

Parameters

Name Type Description
angle number Angle in degrees
r1 number radius 1
r2 number radius 2
height number height of the pie

Returns

Solid