Class: Surface
A Surface represents 2D geometry embedded in 3D space -- think of it as a sheet of paper that can be flat, curved, or folded into complex shapes. Surfaces are the middle layer between curves (1D) and solids (3D). They define faces, skins, and shells that can be analyzed, paneled, rendered, or extruded into solid bodies.
When to use Surface
Use Surface when you need to:
- Inspect or modify an existing surface (area, bounding box, normals, edges, faces)
- Build up solids by extruding a surface in a direction or thickening it
- Perform boolean operations (union, intersection, difference) between surfaces
- Panelize a surface into quads, triangles, hexagons, or diamonds for fabrication
- Mirror, offset, fillet, or split surfaces for design refinement
- Generate contours or iso-curves for analysis and visualization
To create surfaces from scratch, see the companion class SurfaceBuilder.
Quick start
Key methods
| Method | Description |
|---|---|
area() | Calculate the surface area |
bBox() | Get width, length, height, center, and bounding box |
extrude(direction) | Extrude into a solid along a direction vector |
offset(size, type?) | Create an offset copy of the surface |
fillet(radius) | Apply fillet rounding to edges |
flip() | Reverse the surface normal |
union() | Boolean union with other surfaces |
intersection() | Boolean intersection with other surfaces |
difference(geometries) | Boolean subtraction of other geometries |
quadPanel(u, v) | Divide into a grid of quad panels |
trianglePanelA(u, v) | Divide into triangular panels |
hexagonPanel(u, v) | Divide into hexagonal panels |
divideSurface(u, v) | Generate a grid of UV points on the surface |
contours(plane, distance) | Generate contour curves at a given spacing |
isoCurve(point) | Get U and V iso-curves through a point |
surfaceSplit(curves) | Split the surface using curves |
render(linDefl?, angDefl?) | Mesh the surface for visualization |
makeThickSolid(thickness) | Thicken into a solid with given wall thickness |
Method: type
Gets the type of the surface.
Returns
The type of the surface.
Example
Method: faces
Retrieves the faces of the surface.
Returns
An array of TopoDS_Face objects representing the faces of the surface.
Example
Method: wires
Retrieves the wires from the surface.
Returns
An array of TopoDS_Wire objects representing the wires of the surface.
Example
Method: edges
Retrieves the edges of the surface.
Returns
An array of TopoDS_Edge objects representing the edges of the surface.
Example
Method: getWires
Retrieves the wires of the surface.
Returns
An array of TopoDS_Wire objects representing the wires of the surface.
Example
Method: getFaces
Retrieves the faces of the surface.
Returns
An array of TopoDS_Face objects representing the faces of the surface.
Example
Method: getEdges
Retrieves the edges of the surface.
Returns
An array of TopoDS_Edge objects representing the edge of the surface.
Example
Method: flip
Flips the surface.
Returns
The flipped surface.
Example
Method: extrude
Extrudes the surface in the specified direction.
Parameters
direction(IVector): The direction vector to extrude the surface.
Returns
A new Solid object representing the extruded shape.
Example
Method: surfaceJoin
Joins multiple surfaces together into a single surface.
Returns
A new Surface object representing the joined surface.
Example
Method: closestPoint
Finds the closest point on the surface to the given point.
Parameters
point(IVector): The point to find the closest point to.
Returns
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.
Example
Method: fillet
Applies a fillet operation to the surface.
Parameters
radius(number): The radius of the fillet.
Returns
A new Surface object with the fillet applied.
Example
Method: isoCurve
Generates an isoCurve on the surface based on the given point.
Parameters
point(IVector): The point on the surface to generate the isoCurve from.
Returns
An object containing the u and v isoCurves on the surface.
Example
Method: quadPanel
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
An object containing the centers and curves of the quad panel.
Example
Method: trianglePanelA
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
An object containing the centers and curves of the triangle panel.
Example
Method: trianglePanelC
Generates a triangular panelC for a surface.
Parameters
uCount(number): No descriptionvCount(number): No description
Returns
An object containing the midpoints, curves, and centers of the triangular panel.
Example
Method: hexagonPanel
Generates a hexagonal panel on the surface.
Parameters
uCount(number): No descriptionVCount(number): No description
Returns
An object containing the centers, curves, of the hexagonal panel.
Example
Method: diamondPanel
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
void
Example
Method: brepEdges
Retrieves the edges of the surface.
Returns
An object containing the edges and face edges of the surface.
Example
Method: union
Performs a union operation on the given geometries and returns a new Surface.
Returns
A new Surface representing the union of the geometries.
Example
Method: intersection
Computes the intersection of the current surface with the given geometries.
Returns
An array of Surface objects representing the intersection parts.
Example
Method: intersectSurfacesOrSolidsCurves
Calculates the intersection of the given surfaces.
Parameters
surface(ISurface): An array of Surface objects to intersect with each other.
Returns
An array of Curves representing the intersection surfaces.
Example
Method: intersectSurfacesOrSolidsPoints
Calculates the intersection of the given surfaces.
Parameters
surface(ISurface): An array of Surface objects to intersect with each other.
Returns
An array of Points representing the intersection surfaces.
Example
Method: difference
Performs a difference operation between the current surface and the provided geometries.
Parameters
geometries(IGeometry[]): The geometries to subtract from the current surface.
Returns
A new Surface object representing the result of the difference operation.
Example
Method: render
Renders the surface and returns the triangle, position, normal, and uv buffers.
Parameters
linDeflection(number): The linear deflection value for meshing the surface. Default is 1.angDeflection(number): The angular deflection value for meshing the surface. Default is 1.
Returns
An object containing the triangle, position, normal, and uv buffers.
Example
Method: bBox
Calculates the bounding box of the surface.
Returns
An object containing the width, length, height, area, center, and bounding box of the surface.
Example
Method: area
Calculates the area of the surface.
Returns
The area of the surface.
Example
Method: offset
Applies an offset to the surface.
Parameters
offsetSize(number): The size of the offset.offsetType(OffsetType = OffsetType.Intersection): The type of offset to apply. Defaults to OffsetType.Intersection.
Returns
A new Surface object with the offset applied.
Example
Method: makeThickSolid
Makes the surface thick and returns a solid.
Parameters
num(number): The thickness value.
Returns
A Solid object representing the thickened surface.
Example
Method: divideSurface
Generate a grid of uv points on a surface.
Parameters
uCount(number): No descriptionvCount(number): No description
Returns
An object containing the divided points and UV coordinates.
Example
Method: mirrorPntBySurface
Mirrors a point by the surface.
Parameters
pnt(IVector): The point to be mirrored.
Returns
The mirrored point.
Example
Method: mirrorCurveBySurface
Mirrors a curve by a surface.
Parameters
crv(ICurve): The curve to be mirrored.
Returns
The mirrored curve.
Example
Method: mirrorByCurve
Mirrors the surface by a given curve.
Returns
A new Surface object representing the mirrored surface.
Example
Method: extremes
Calculates the extremes of a surface with respect to a given plane.
Parameters
plane(IPlane): The plane to calculate the extremes with respect to.
Returns
An object containing the highest and lowest points on the surface.
Example
Method: contours
Generates contours on a surface based on the given plane and distance.
Parameters
plane(IPlane): The plane used for generating contours.distance(number): The distance between each contour.
Returns
An array of Curve objects representing the generated contours.
Example
Method: faceNormals
Calculates the face normals of the surface.
Returns
An object containing the centers and normals of each face.
Example
Method: centerOfMass
Calculates the center of mass for the surface.
Returns
The center of mass as a Vector.
Example
Method: isPlanar
Checks if the surface is planar.
Returns
An object with the following properties:
Example
Method: cap
Cap all planar holes in a Solid.
Returns
A new Solid object representing the caped solid.
Example
Method: solidPlane
Gets the intersection curves between a Solid and a Plane.
Parameters
plane(IPlane): The plane to intersect with the solid.
Returns
An array of intersection curves.
Example
Method: surfaceSplit
Splits a Surface using provided curves.
Parameters
curves(ICurve[]): The curves to split the surface.
Returns
An array of split surfaces.
Example
Method: geometryReorient
Reorients surfaces based on a specified direction.
Parameters
targetSurfaces(ISurface[]): The surfaces to reorient.forward(boolean): A Boolean indicating the desired orientation: true for forward, false for reverse.
Returns
An array of reoriented surfaces.
Example
Method: dump
Returns a string representation of the Surface object.
Returns
The string representation of the Surface object.