Class: Solid

Class representing a Solid.

Implements

Extends

Implements

  • Solid

Constructors

new Solid()

new Solid(shape): Solid

Creates an instance of Geometry.

Parameters

shape: TopoDS_Shape

The geometric shape.

Returns

Solid

Inherited from

Geometry

Accessors

edges

get edges(): TopoDS_Edge[]

Retrieves the edges of the Solid.

Returns

TopoDS_Edge[]

An array of TopoDS_Edge objects representing the edges of the Solid.

Implementation of

ISolid.edges


faces

get faces(): TopoDS_Face[]

Returns an array of faces contained in the Solid.

Returns

TopoDS_Face[]

The array of faces.

Implementation of

ISolid.faces


shape

get shape(): TopoDS_Shape

Gets the geometric shape.

set shape(shape): void

Sets the geometric shape.

Parameters

shape: TopoDS_Shape

The new geometric shape.

Returns

TopoDS_Shape

Implementation of

ISolid.shape

Inherited from

Geometry.shape


type

get type(): Type

Gets the type of the solid.

Returns

Type

The type of the solid.

Implementation of

ISolid.type


wires

get wires(): TopoDS_Wire[]

Retrieves the wires contained in the Solid.

Returns

TopoDS_Wire[]

An array of TopoDS_Wire objects representing the wires in the Solid.

Implementation of

ISolid.wires

Methods

area()

area(): number

Calculates the area of the solid.

Returns

number

The area of the solid.

Implementation of

ISolid.area


bBox()

bBox(): object

Calculates the bounding box of the solid.

Returns

object

An object containing the width, length, height, area, center, and bounding box of the solid.

area

area: number

boundingBox

boundingBox: object

boundingBox.max

max: Vector = boundingMax

boundingBox.min

min: Vector = boundingMin

center

center: Vector

height

height: number

length

length: number

width

width: number

Implementation of

ISolid.bBox


boxCorners()

boxCorners(): object

Retrieves the corners of the box encapsulating the solid.

Returns

object

An object containing the corners of the box:

  • a: The first corner of the box.
  • b: The second corner of the box.
  • c: The third corner of the box.
  • d: The fourth corner of the box.
  • e: The fifth corner of the box.
  • f: The sixth corner of the box.
  • g: The seventh corner of the box.
  • h: The eighth corner of the box.

a

a: Vector

b

b: Vector

c

c: Vector

d

d: Vector

e

e: Vector

f

f: Vector

g

g: Vector

h

h: Vector

Implementation of

ISolid.boxCorners


boxProperties()

boxProperties(): object

Calculates the properties of a solid box.

Returns

object

An object containing the center, diagonal, area, and volume of the box.

area

area: number

center

center: Vector

diagonal

diagonal: Vector

volume

volume: number

Implementation of

ISolid.boxProperties


brepEdges()

brepEdges(): object

Retrieves the B-rep edges of the solid.

Returns

object

An object containing the edges and face edges of the solid.

edges

edges: Curve

faceEdges

faceEdges: Curve[]

Implementation of

ISolid.brepEdges


centerOfMAss()

centerOfMAss(): Vector

Calculates the center of mass for the solid.

Returns

Vector

The center of mass as a Vector.

Implementation of

ISolid.centerOfMAss


changePlane()

changePlane(source, target): Geometry

Changes the plane of the geometric shape.

Parameters

source: Plane

The source plane.

target: Plane

The target plane.

Returns

Geometry

The geometry with the changed plane.

Implementation of

ISolid.changePlane

Inherited from

Geometry.changePlane


closestPoint()

closestPoint(point): object

Finds the closest point on the solid to the given point.

Parameters

point: Vector

The point to find the closest point to.

Returns

object

An object containing the nearest point and an array of points on the solid, if there are multiple closest points.

nearest

nearest: Vector

pointsArr

pointsArr: Vector[]

Implementation of

ISolid.closestPoint


contours()

contours(plane, distance): Curve[]

Calculates the contours of a solid object based on the given plane and distance.

Parameters

plane: Plane

The plane to calculate the contours on.

distance: number

The distance between each contour.

Returns

Curve[]

An array of Curve objects representing the contours of the solid.


deconstructSolid()

deconstructSolid(): object

Deconstructs the solid into its constituent parts.

Returns

object

An object containing the faces, edges, and vertices of the solid.

edges

edges: Curve[]

faces

faces: Surface[]

vertices

vertices: Vector[]

Implementation of

ISolid.deconstructSolid


delete()

delete(): void

Deletes the geometric shape.

Returns

void

Inherited from

Geometry.delete


difference()

difference(geometries): Solid

Performs a difference operation on the given solids and returns a new Solid.

Parameters

geometries: Geometry[]

An array of Solid objects to perform the difference operation with.

Returns

Solid

A new Solid resulting from the difference operation.

Implementation of

ISolid.difference


dump()

dump(): string

Returns a string representation of the Solid object.

Returns

string

The string representation of the Solid object.

Implementation of

ISolid.dump


extremes()

extremes(plane): object

Calculates the extremes of a solid in relation to a given plane.

Parameters

plane: Plane

The plane to calculate the extremes from.

Returns

object

An object containing the highest and lowest points on the solid in relation to the plane.

highest

highest: Vector

lowest

lowest: Vector

Implementation of

ISolid.extremes


fillet()

fillet(radius): Solid

Applies a fillet operation to the solid.

Parameters

radius: number

The radius of the fillet.

Returns

Solid

A new Solid object with the fillet applied.

Implementation of

ISolid.fillet


flip()

flip(): Solid

Flips the orientation of the solid.

Returns

Solid

A new Solid object with the flipped orientation.

Implementation of

ISolid.flip


getEdges()

getEdges(): TopoDS_Edge[]

Retrieves an array of TopoDS_Edge objects representing the edges of the Solid.

Returns

TopoDS_Edge[]

An array of TopoDS_Edge objects.

Implementation of

ISolid.getEdges


getFaces()

getFaces(): TopoDS_Face[]

Retrieves the faces of the solid.

Returns

TopoDS_Face[]

An array of TopoDS_Face objects representing the faces of the solid.

Implementation of

ISolid.getFaces


getShape()

getShape(): TopoDS_Shape

Gets a copy of the geometric shape.

Returns

TopoDS_Shape

The copied shape.

Implementation of

ISolid.getShape

Inherited from

Geometry.getShape


getWires()

getWires(): TopoDS_Wire[]

Retrieves an array of TopoDS_Wire objects representing the wires of the Solid.

Returns

TopoDS_Wire[]

An array of TopoDS_Wire objects.

Implementation of

ISolid.getWires


intersection()

intersection(geometries): Solid[]

Calculates the intersection of the given solids with the current Solid.

Parameters

geometries: Geometry[]

An array of Solid objects to intersect with the current Solid.

Returns

Solid[]

An array of Solid objects representing the intersection solids.

Implementation of

ISolid.intersection


isEquivalentCurve()

isEquivalentCurve(curve1, curve2): boolean

Checks if two curves are equivalent.

Parameters

curve1: Curve

The first curve to compare.

curve2: Curve

The second curve to compare.

Returns

boolean

True if the curves are equivalent, false otherwise.

Implementation of

ISolid.isEquivalentCurve


isoCurve()

isoCurve(point): object

Calculates the iso curve for a given point on the face.

Parameters

point: Vector

The point on the face.

Returns

object

An object containing the u and v iso curves. If the surface has only one face and one edge, the u and v curves will be lines. If the surface has multiple faces or edges, an error will be thrown.

u

u: Curve

v

v: Curve

Implementation of

ISolid.isoCurve


mirrorByCurve()

mirrorByCurve(curve): Solid

Mirrors the solid by a given curve.

Parameters

curve: Curve

The curve to mirror the solid by.

Returns

Solid

The mirrored solid.

Implementation of

ISolid.mirrorByCurve


offset()

offset(offsetSize, side, offsetType): Solid

Offsets the solid by the specified size and parameters.

Parameters

offsetSize: number

The size of the offset.

side: boolean

A boolean value indicating whether the offset is on the side.

The type of offset. Defaults to OffsetType.Arc.

Returns

Solid

A new Solid object representing the offset solid.

Implementation of

ISolid.offset


render()

render(linDeflection): object

Renders the solid and returns the triangle, position, normal, and UV buffers.

Parameters

linDeflection: number = 1

The linear deflection value for meshing the solid. Default is 1.

Returns

object

An object containing the triangle, position, normal, and UV buffers.

normal

normal: number[]

position

position: number[]

triangles

triangles: number[]

uv

uv: number[]

Implementation of

ISolid.render


setPlane()

setPlane(plane?): Solid

Sets the plane for the geometric shape.

Parameters

plane?: Plane

The plane to set.

Returns

Solid

The updated geometry.

Implementation of

ISolid.setPlane

Inherited from

Geometry.setPlane


splitSolid()

splitSolid(cutter): Solid[]

Splits the solid by a given geometry or plane.

Parameters

cutter: Plane | Geometry

The geometry or plane used to split the solid.

Returns

Solid[]

An array of Solid objects resulting from the split.

Throws

Error if conversion from line to Solid fails.

Implementation of

ISolid.splitSolid


splitSolidMultiple()

splitSolidMultiple(cutters): Solid[]

Splits the solid into multiple solids using the provided cutters.

Parameters

cutters: any[]

An array of objects representing the cutters.

Returns

Solid[]

An array of Solid objects resulting from the split operation.

Throws

Error if conversion from Line to Solid fails.

Implementation of

ISolid.splitSolidMultiple


union()

union(geometries): Solid

Performs a union operation on the given solids and returns a new Solid.

Parameters

geometries: Geometry[]

An array of Solid objects to be union.

Returns

Solid

A new Solid object representing the union of the solids.

Implementation of

ISolid.union


volume()

volume(): number

Calculates the volume of the solid.

Returns

number

The volume of the solid.

Implementation of

ISolid.volume