Class: SolidBuilder
The SolidBuilder class provides static methods for creating various solid shapes.
Static Method: box
Creates a box solid with the specified dimensions.
Parameters
origin(IVector): The origin point of the box.width(number): The width of the box.length(number): The length of the box.height(number): The height of the box.
Returns
A Solid object representing the box.
Example
const origin = new Vector(1, 1, 1);
const width = 0.5;
const length = 10;
const height = 0.5;
SolidBuilder.box(origin, width, length, height);
Static Method: box2Pnt
Creates a solid box between two points.
Parameters
point1(IVector): The first point defining the box.point2(IVector): The second point defining the box.
Returns
A Solid object representing the created box.
Example
const point1 = new Vector(1, 1, 1);
const point2 = new Vector(1, 1, 1);
SolidBuilder.box2Pnt(point1, point2);
Static Method: sphere
Creates a sphere solid with the given origin and radius.
Parameters
origin(IVector): The origin point of the sphere.radius(number): The radius of the sphere.
Returns
A Solid object representing the sphere.
Example
const origin = new Vector(1, 1, 1);
const radius = 10;
SolidBuilder.sphere(origin, radius);
Static Method: cone
Creates a cone solid.
Parameters
origin(IVector): The origin point of the cone.radius1(number): The radius of the base of the cone.radius2(number): The radius of the top of the cone.height(number): The height of the cone.
Returns
A Solid object representing the cone.
Example
const origin = new Vector(1, 1, 1);
const radius1 = 0.5;
const radius2 = 0.5;
const height = 0.5;
SolidBuilder.cone(origin, radius1, radius2, height);
Static Method: cylinder
Creates a cylinder solid with the specified origin, radius, and height.
Parameters
origin(IVector): The origin point of the cylinder.radius(number): The radius of the cylinder.height(number): The height of the cylinder.
Returns
A Solid object representing the cylinder.
Example
const origin = new Vector(1, 1, 1);
const radius = 10;
const height = 0.5;
SolidBuilder.cylinder(origin, radius, height);
Static Method: torus
Creates a torus solid.
Parameters
origin(IVector): The origin of the torus.radius1(number): The major radius of the torus.radius2(number): The minor radius of the torus.
Returns
A Solid object representing the torus.
Example
const origin = new Vector(1, 1, 1);
const radius1 = 0.5;
const radius2 = 0.5;
SolidBuilder.torus(origin, radius1, radius2);
Static Method: loft
Creates a lofted solid from the given array of surfaces.
Parameters
surfaces(ISurface[]): The array of surfaces to loft.degree(number): The degree of the lofted solid.
Returns
A new Solid object representing the lofted solid.
Example
const surfaces = /* specify a surfaces */;
const degree = 0.5;
SolidBuilder.loft(surfaces, degree);