Class: Surface
Class represents a Surface.
Method: type
Gets the type of the surface.
Returns
The type of the surface.
Example
const instance = new Surface();
instance.type();
Method: faces
Retrieves the faces of the surface.
Returns
An array of TopoDS_Face objects representing the faces of the surface.
Example
const instance = new Surface();
instance.faces();
Method: wires
Retrieves the wires from the surface.
Returns
An array of TopoDS_Wire objects representing the wires of the surface.
Example
const instance = new Surface();
instance.wires();
Method: edges
Retrieves the edges of the surface.
Returns
An array of TopoDS_Edge objects representing the edges of the surface.
Example
const instance = new Surface();
instance.edges();
Method: getWires
Retrieves the wires of the surface.
Returns
An array of TopoDS_Wire objects representing the wires of the surface.
Example
const instance = new Surface();
instance.getWires();
Method: getFaces
Retrieves the faces of the surface.
Returns
An array of TopoDS_Face objects representing the faces of the surface.
Example
const instance = new Surface();
instance.getFaces();
Method: getEdges
Retrieves the edges of the surface.
Returns
An array of TopoDS_Edge objects representing the edge of the surface.
Example
const instance = new Surface();
instance.getEdges();
Method: flip
Flips the surface.
Returns
The flipped surface.
Example
const instance = new Surface();
instance.flip();
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
const direction = new Vector(1, 1, 1);
const instance = new Surface();
instance.extrude(direction);
Method: surfaceJoin
Joins multiple surfaces together into a single surface.
Returns
A new Surface object representing the joined surface.
Example
const instance = new Surface();
instance.surfaceJoin();
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
const point = new Vector(1, 1, 1);
const instance = new Surface();
instance.closestPoint(point);
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
const radius = 10;
const instance = new Surface();
instance.fillet(radius);
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
const point = new Vector(1, 1, 1);
const instance = new Surface();
instance.isoCurve(point);
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
const uCount = 0.5;
const vCount = 0.5;
const instance = new Surface();
instance.quadPanel(uCount, vCount);
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
const uCount = 0.5;
const vCount = 0.5;
const instance = new Surface();
instance.trianglePanelA(uCount, vCount);
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
const uCount = 0.5;
const vCount = 0.5;
const instance = new Surface();
instance.trianglePanelC(uCount, vCount);
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
const uCount = 0.5;
const VCount = 0.5;
const instance = new Surface();
instance.hexagonPanel(uCount, VCount);
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
const uCount = 0.5;
const vCount = 0.5;
const instance = new Surface();
instance.diamondPanel(uCount, vCount);
Method: brepEdges
Retrieves the edges of the surface.
Returns
An object containing the edges and face edges of the surface.
Example
const instance = new Surface();
instance.brepEdges();
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
const instance = new Surface();
instance.union();
Method: intersection
Computes the intersection of the current surface with the given geometries.
Returns
An array of Surface objects representing the intersection parts.
Example
const instance = new Surface();
instance.intersection();
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
const surface = /* specify a surface */;
const instance = new Surface();
instance.intersectSurfacesOrSolidsCurves(surface);
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
const surface = /* specify a surface */;
const instance = new Surface();
instance.intersectSurfacesOrSolidsPoints(surface);
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
const geometries = /* specify a geometries */;
const instance = new Surface();
instance.difference(geometries);
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
const linDeflection = 0.5;
const angDeflection = 0.5;
const instance = new Surface();
instance.render(linDeflection, angDeflection);
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
const instance = new Surface();
instance.bBox();
Method: area
Calculates the area of the surface.
Returns
The area of the surface.
Example
const instance = new Surface();
instance.area();
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
const offsetSize = 0.5;
const offsetType = /* specify a offsetType */;
const instance = new Surface();
instance.offset(offsetSize, offsetType);
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
const num = 0.5;
const instance = new Surface();
instance.makeThickSolid(num);
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
const uCount = 0.5;
const vCount = 0.5;
const instance = new Surface();
instance.divideSurface(uCount, vCount);
Method: mirrorPntBySurface
Mirrors a point by the surface.
Parameters
pnt(IVector): The point to be mirrored.
Returns
The mirrored point.
Example
const pnt = new Vector(1, 1, 1);
const instance = new Surface();
instance.mirrorPntBySurface(pnt);
Method: mirrorCurveBySurface
Mirrors a curve by a surface.
Parameters
crv(ICurve): The curve to be mirrored.
Returns
The mirrored curve.
Example
const crv = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
const instance = new Surface();
instance.mirrorCurveBySurface(crv);
Method: mirrorByCurve
Mirrors the surface by a given curve.
Returns
A new Surface object representing the mirrored surface.
Example
const instance = new Surface();
instance.mirrorByCurve();
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
const plane = /* specify a plane */;
const instance = new Surface();
instance.extremes(plane);
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
const plane = /* specify a plane */;
const distance = 0.5;
const instance = new Surface();
instance.contours(plane, distance);
Method: faceNormals
Calculates the face normals of the surface.
Returns
An object containing the centers and normals of each face.
Example
const instance = new Surface();
instance.faceNormals();
Method: centerOfMass
Calculates the center of mass for the surface.
Returns
The center of mass as a Vector.
Example
const instance = new Surface();
instance.centerOfMass();
Method: isPlanar
Checks if the surface is planar.
Returns
An object with the following properties:
Example
const instance = new Surface();
instance.isPlanar();
Method: cap
Cap all planar holes in a Solid.
Returns
A new Solid object representing the caped solid.
Example
const instance = new Surface();
instance.cap();
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
const plane = /* specify a plane */;
const instance = new Surface();
instance.solidPlane(plane);
Method: surfaceSplit
Splits a Surface using provided curves.
Parameters
curves(ICurve[]): The curves to split the surface.
Returns
An array of split surfaces.
Example
const curves = /* specify a curves */;
const instance = new Surface();
instance.surfaceSplit(curves);
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
const targetSurfaces = /* specify a targetSurfaces */;
const forward = /* specify a forward */;
const instance = new Surface();
instance.geometryReorient(targetSurfaces, forward);
Method: dump
Returns a string representation of the Surface object.
Returns
The string representation of the Surface object.
Example
const instance = new Surface();
instance.dump();