Class represents a Surface.
Implements
Extends
Implements
Surface
Constructors
new Surface()
new Surface(
shape
):Surface
Creates an instance of Geometry.
Parameters
• shape: TopoDS_Shape
The geometric shape.
Returns
Inherited from
Accessors
edges
get
edges():TopoDS_Edge
[]
Retrieves the edges of the surface.
Returns
TopoDS_Edge
[]
An array of TopoDS_Edge objects representing the edges of the surface.
Implementation of
ISurface.edges
faces
get
faces():TopoDS_Face
[]
Retrieves the faces of the surface.
Returns
TopoDS_Face
[]
An array of TopoDS_Face objects representing the faces of the surface.
Implementation of
ISurface.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
ISurface.shape
Inherited from
type
get
type():Type
Gets the type of the surface.
Returns
Type
The type of the surface.
Implementation of
ISurface.type
wires
get
wires():TopoDS_Wire
[]
Retrieves the wires from the surface.
Returns
TopoDS_Wire
[]
An array of TopoDS_Wire objects representing the wires of the surface.
Implementation of
ISurface.wires
Methods
area()
area():
number
Calculates the area of the surface.
Returns
number
The area of the surface.
Implementation of
ISurface.area
bBox()
bBox():
object
Calculates the bounding box of the surface.
Returns
object
An object containing the width, length, height, area, center, and bounding box of the surface.
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
ISurface.bBox
brepEdges()
brepEdges():
object
Retrieves the edges of the surface.
Returns
object
An object containing the edges and face edges of the surface.
edges
edges:
Curve
faceEdges
faceEdges:
Curve
[]
Implementation of
ISurface.brepEdges
cap()
cap():
Solid
Cap all planar holes in a Solid.
Returns
A new Solid object representing the caped solid.
Implementation of
ISurface.cap
centerOfMAss()
centerOfMAss():
Vector
Calculates the center of mass for the surface.
Returns
The center of mass as a Vector.
Implementation of
ISurface.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
The geometry with the changed plane.
Implementation of
ISurface.changePlane
Inherited from
closestPoint()
closestPoint(
point
):object
Finds the closest point on the surface to the given point.
Parameters
• point: Vector
The point to find the closest point to.
Returns
object
An object containing the nearest point on the surface and an array of all points on the surface that are equally close to the given point.
nearest
nearest:
Vector
pointsArr
pointsArr:
Vector
[]
Implementation of
ISurface.closestPoint
contours()
contours(
plane
,distance
):Curve
[]
Generates contours on a surface based on the given plane and distance.
Parameters
• plane: Plane
The plane used for generating contours.
• distance: number
The distance between each contour.
Returns
Curve
[]
An array of Curve objects representing the generated contours.
delete()
delete():
void
Deletes the geometric shape.
Returns
void
Inherited from
diamondPanel()
diamondPanel(
uCount
,vCount
):object
Generates diamond panels on the surface.
Parameters
• uCount: number
The number of divisions in the u-direction.
• vCount: number
The number of divisions in the v-direction.
Returns
object
void
angleTrianglesCurves
angleTrianglesCurves:
Curve
[]
centers
centers:
Vector
[]
diamondsCurves
diamondsCurves:
Curve
[]
diamondsSurfaces
diamondsSurfaces:
Surface
[]
trianglesCurves
trianglesCurves:
Curve
[]
Throws
Error if there is an error converting to surface.
Implementation of
ISurface.diamondPanel
difference()
difference(...
geometries
):Surface
Performs a difference operation between the current surface and the provided geometries.
Parameters
• ...geometries: Geometry
[]
The geometries to subtract from the current surface.
Returns
A new Surface object representing the result of the difference operation.
Implementation of
ISurface.difference
divideSurface()
divideSurface(
uCount
,vCount
,forPanels
):object
Generate a grid of uv points on a surface.
Parameters
• uCount: number
The number of divisions in the U direction.
• vCount: number
The number of divisions in the V direction.
• forPanels: boolean
= false
Indicates whether the divisions are for panels.
Returns
object
An object containing the divided points and UV coordinates.
points
points:
Vector
[]
uv
uv:
Vector
[]
Throws
Error if there are multiple faces in the surface.
Implementation of
ISurface.divideSurface
dump()
dump():
string
Returns a string representation of the Surface object.
Returns
string
The string representation of the Surface object.
Implementation of
ISurface.dump
extremes()
extremes(
plane
):object
Calculates the extremes of a surface with respect to a given plane.
Parameters
• plane: Plane
The plane to calculate the extremes with respect to.
Returns
object
An object containing the highest and lowest points on the surface.
highest
highest:
Vector
lowest
lowest:
Vector
Implementation of
ISurface.extremes
extrude()
extrude(
direction
):Solid
Extrudes the surface in the specified direction.
Parameters
• direction: Vector
The direction vector to extrude the surface.
Returns
A new Solid object representing the extruded shape.
Implementation of
ISurface.extrude
faceNormals()
faceNormals():
object
Calculates the face normals of the surface.
Returns
object
An object containing the centers and normals of each face.
centers
centers:
Vector
[]
normals
normals:
Vector
[]
Implementation of
ISurface.faceNormals
fillet()
fillet(
radius
):Surface
Applies a fillet operation to the surface.
Parameters
• radius: number
The radius of the fillet.
Returns
A new Surface object with the fillet applied.
Implementation of
ISurface.fillet
flip()
flip():
Surface
Flips the surface.
Returns
The flipped surface.
Implementation of
ISurface.flip
getEdges()
getEdges():
TopoDS_Edge
[]
Retrieves the edges of the surface.
Returns
TopoDS_Edge
[]
An array of TopoDS_Edge objects representing the edge of the surface.
Implementation of
ISurface.getEdges
getFaces()
getFaces():
TopoDS_Face
[]
Retrieves the faces of the surface.
Returns
TopoDS_Face
[]
An array of TopoDS_Face objects representing the faces of the surface.
Implementation of
ISurface.getFaces
getShape()
getShape():
TopoDS_Shape
Gets a copy of the geometric shape.
Returns
TopoDS_Shape
The copied shape.
Implementation of
ISurface.getShape
Inherited from
getWires()
getWires():
TopoDS_Wire
[]
Retrieves the wires of the surface.
Returns
TopoDS_Wire
[]
An array of TopoDS_Wire objects representing the wires of the surface.
Implementation of
ISurface.getWires
hexagonPanel()
hexagonPanel(
uCount
,VCount
):object
Generates a hexagonal panel on the surface.
Parameters
• uCount: number
The number of divisions along the U direction.
• VCount: number
The number of divisions along the V direction.
Returns
object
An object containing the centers, curves, of the hexagonal panel.
crv
crv:
Curve
[]
pnt
pnt:
Vector
[]
Throws
Error if there are more than one face in the surface.
Implementation of
ISurface.hexagonPanel
intersection()
intersection(...
geometries
):Surface
[]
Computes the intersection of the current surface with the given geometries.
Parameters
• ...geometries: Geometry
[]
The geometries to intersect with.
Returns
Surface
[]
An array of Surface objects representing the intersection parts.
Implementation of
ISurface.intersection
isPlanar()
isPlanar():
object
|object
Checks if the surface is planar.
Returns
object
| object
An object with the following properties:
- isPlaner: A boolean indicating if the surface is planar.
- plane: An object representing the plane if the surface is planar.
- distance: The distance of the surface from the plane if the surface is planar.
Implementation of
ISurface.isPlanar
isoCurve()
isoCurve(
point
):object
Generates an isoCurve on the surface based on the given point.
Parameters
• point: Vector
The point on the surface to generate the isoCurve from.
Returns
object
An object containing the u and v isoCurves on the surface. If the surface has only one edge, the u and v isoCurves will be lines. If the surface has multiple edges, the u and v isoCurves will be instances of the Curve class.
u
u:
Curve
v
v:
Curve
Throws
Error if the surface has more than one face.
Implementation of
ISurface.isoCurve
makeThickSolid()
makeThickSolid(
num
):Solid
Makes the surface thick and returns a solid.
Parameters
• num: number
The thickness value.
Returns
A Solid object representing the thickened surface.
Implementation of
ISurface.makeThickSolid
mirrorByCurve()
mirrorByCurve(
curve
):Surface
Mirrors the surface by a given curve.
Parameters
• curve: Curve
The curve used for mirroring the surface.
Returns
A new Surface object representing the mirrored surface.
Implementation of
ISurface.mirrorByCurve
mirrorCurveBySurface()
mirrorCurveBySurface(
crv
):Curve
Mirrors a curve by a surface.
Parameters
• crv: Curve
The curve to be mirrored.
Returns
The mirrored curve.
Implementation of
ISurface.mirrorCurveBySurface
mirrorPntBySurface()
mirrorPntBySurface(
pnt
):Vector
Mirrors a point by the surface.
Parameters
• pnt: Vector
The point to be mirrored.
Returns
The mirrored point.
Implementation of
ISurface.mirrorPntBySurface
offset()
offset(
offsetSize
,offsetType
):Surface
Applies an offset to the surface.
Parameters
• offsetSize: number
The size of the offset.
The type of offset to apply. Defaults to OffsetType.Intersection.
Returns
A new Surface object with the offset applied.
Implementation of
ISurface.offset
quadPanel()
quadPanel(
uCount
,vCount
):object
Generates a quad panel on the surface.
Parameters
• uCount: number
The number of divisions in the u-direction.
• vCount: number
The number of divisions in the v-direction.
Returns
object
An object containing the centers and curves of the quad panel.
centers
centers:
Vector
[]
crv
crv:
Curve
[]
Throws
Error if there are more than one face in the surface.
Implementation of
ISurface.quadPanel
render()
render(
linDeflection
):object
Renders the surface and returns the triangle, position, normal, and uv buffers.
Parameters
• linDeflection: number
= 1
The linear deflection value for meshing the surface. 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
ISurface.render
setPlane()
setPlane(
plane
?):Surface
Sets the plane for the geometric shape.
Parameters
• plane?: Plane
The plane to set.
Returns
The updated geometry.
Implementation of
ISurface.setPlane
Inherited from
surfaceJoin()
surfaceJoin(
tolerance
, ...surfaces
):Surface
Joins multiple surfaces together into a single surface.
Parameters
• tolerance: number
= 0.001
The tolerance value for sewing the surfaces. Default is 0.001.
• ...surfaces: Surface
[]
The surfaces to be joined together.
Returns
A new Surface object representing the joined surface.
trianglePanelA()
trianglePanelA(
uCount
,vCount
):object
Calculates the triangle panelA for a given number of uCount and vCount.
Parameters
• uCount: number
The number of u divisions.
• vCount: number
The number of v divisions.
Returns
object
An object containing the centers and curves of the triangle panel.
centers
centers:
Vector
[]
crv
crv:
Curve
[]
Throws
Error if there are more than one face in the surface.
Implementation of
ISurface.trianglePanelA
trianglePanelC()
trianglePanelC(
uCount
,vCount
):object
Generates a triangular panelC for a surface.
Parameters
• uCount: number
The number of divisions along the U direction.
• vCount: number
The number of divisions along the V direction.
Returns
object
An object containing the midpoints, curves, and centers of the triangular panel.
centers
centers:
Vector
[]
crv
crv:
Curve
[]
mid
mid:
Vector
[] =midPointsArr
Throws
Error if there are multiple faces or an error occurs during conversion.
Implementation of
ISurface.trianglePanelC
union()
union(...
geometries
):Surface
Performs a union operation on the given geometries and returns a new Surface.
Parameters
• ...geometries: Geometry
[]
The geometries to be union.
Returns
A new Surface representing the union of the geometries.
Implementation of
ISurface.union