OCCNurbsSurface

class compas_occ.geometry.OCCNurbsSurface(*args, **kwargs)

Bases: OCCSurface, NurbsSurface

Class representing a NURBS surface based on the BSplineSurface of the OCC geometry kernel.

Parameters:
namestr, optional

The name of the curve

Examples

Construct a surface from points…

from compas.geometry import Point
from compas_occ.geometry import OCCNurbsSurface

points = [
    [Point(0, 0, 0), Point(1, 0, 0), Point(2, 0, 0), Point(3, 0, 0)],
    [Point(0, 1, 0), Point(1, 1, 2), Point(2, 1, 2), Point(3, 1, 0)],
    [Point(0, 2, 0), Point(1, 2, 2), Point(2, 2, 2), Point(3, 2, 0)],
    [Point(0, 3, 0), Point(1, 3, 0), Point(2, 3, 0), Point(3, 3, 0)],
]

surface = OCCNurbsSurface.from_points(points=points)

Construct a surface from points…

from compas.geometry import Point
from compas_occ.geometry import OCCNurbsSurface

points = [
    [Point(0, 0, 0), Point(1, 0, +0), Point(2, 0, +0), Point(3, 0, +0), Point(4, 0, +0), Point(5, 0, 0)],
    [Point(0, 1, 0), Point(1, 1, -1), Point(2, 1, -1), Point(3, 1, -1), Point(4, 1, -1), Point(5, 1, 0)],
    [Point(0, 2, 0), Point(1, 2, -1), Point(2, 2, +2), Point(3, 2, +2), Point(4, 2, -1), Point(5, 2, 0)],
    [Point(0, 3, 0), Point(1, 3, -1), Point(2, 3, +2), Point(3, 3, +2), Point(4, 3, -1), Point(5, 3, 0)],
    [Point(0, 4, 0), Point(1, 4, -1), Point(2, 4, -1), Point(3, 4, -1), Point(4, 4, -1), Point(5, 4, 0)],
    [Point(0, 5, 0), Point(1, 5, +0), Point(2, 5, +0), Point(3, 5, +0), Point(4, 5, +0), Point(5, 5, 0)],
]

weights = [
    [1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
    [1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
    [1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
    [1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
    [1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
    [1.0, 1.0, 1.0, 1.0, 1.0, 1.0],
]

surface = OCCNurbsSurface.from_parameters(
    points=points,
    weights=weights,
    knots_u=[1.0, 1 + 1 / 9, 1 + 2 / 9, 1 + 3 / 9, 1 + 4 / 9, 1 + 5 / 9, 1 + 6 / 9, 1 + 7 / 9, 1 + 8 / 9, 2.0],
    knots_v=[0.0, 1 / 9, 2 / 9, 3 / 9, 4 / 9, 5 / 9, 6 / 9, 7 / 9, 8 / 9, 1.0],
    mults_u=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
    mults_v=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
    degree_u=3,
    degree_v=3,
)
Attributes:
pointslist[list[Point]], read-only

The control points of the surface.

weightslist[list[float]], read-only

The weights of the control points of the surface.

knots_ulist[float], read-only

The knots of the surface in the U direction, without multiplicities.

knots_vlist[float], read-only

The knots of the surface in the V direction, without multiplicities.

mults_ulist[int], read-only

The multiplicities of the knots of the surface in the U direction.

mults_vlist[int], read-only

The multiplicities of the knots of the surface in the V direction.

Methods

copy

Make an independent copy of the current surface.

from_extrusion

Construct a NURBS surface from an extrusion of a basis curve.

from_fill

Construct a NURBS surface from the infill between two, three or four contiguous NURBS curves.

from_interpolation

Construct a NURBS surface by approximating or interpolating a 2D collection of points.

from_native

Construct a NURBS surface from an existing OCC Surface.

from_parameters

Construct a NURBS surface from explicit parameters.

from_plane

Construct a NURBS surface from a plane.

from_points

Construct a NURBS surface from control points.

Inherited Methods

ToString

Converts the instance to a string.

aabb

Compute the axis aligned bounding box of the surface.

boundary

Compute the boundary curves of the surface.

closest_point

Compute the closest point on the curve to a given point.

compute_aabb

Compute the axis-aligned bounding box of the geometry.

compute_obb

Compute the oriented bounding box of the geometry.

curvature_at

Compute the curvature at a point on the surface.

frame_at

Compute the local frame at a point on the curve.

from_cylinder

Construct a surface from a cylinder.

from_face

Construct a surface from an existing OCC TopoDS_Face.

from_frame

Construct a surface from a frame.

from_json

Construct an object of this type from a JSON file.

from_jsonstring

Construct an object of this type from a JSON string.

from_meshgrid

Construct a NURBS surface from a mesh grid.

from_obj

Load a surface from an OBJ file.

from_occ

Construct a surface from an existing OCC Surface.

from_sphere

Construct a surface from a sphere.

from_step

Load a NURBS surface from a STP file.

from_torus

Construct a surface from a torus.

gaussian_curvature_at

Compute the Gaussian curvature at a point on the surface.

intersections_with_curve

Compute the intersections with a curve.

intersections_with_line

Compute the intersections with a line.

intersections_with_plane

Compute the intersections with a plane.

isocurve_u

Compute the isoparametric curve at parameter u.

isocurve_v

Compute the isoparametric curve at parameter v.

mean_curvature_at

Compute the mean curvature at a point on the surface.

normal_at

Compute a normal at a point on the surface.

obb

Compute the oriented bounding box of the surface.

point_at

Compute a point on the surface.

pointgrid

Compute point locations corresponding to evenly spaced parameters over the surface domain.

rotate

Rotate the geometry.

rotated

Returns a rotated copy of this geometry.

scale

Scale the geometry.

scaled

Returns a scaled copy of this geometry.

sha256

Compute a hash of the data for comparison during version control using the sha256 algorithm.

space_u

Compute evenly spaced parameters over the surface domain in the U direction.

space_v

Compute evenly spaced parameters over the surface domain in the V direction.

to_brep

Convert the surface to a BREP representation.

to_json

Convert an object to its native data representation and save it to a JSON file.

to_jsonstring

Convert an object to its native data representation and save it to a JSON string.

to_mesh

Convert the surface to a mesh.

to_polyhedron

Convert the surface to a polyhedron.

to_quads

Convert the surface to a list of quads.

to_step

Write the surface geometry to a STP file.

to_tesselation

Convert the surface to a triangle mesh.

to_triangles

Convert the surface to a list of triangles.

to_vertices_and_faces

Convert the surface to a list of vertices and faces.

transform

Transform this surface.

transformed

Returns a transformed copy of this geometry.

translate

Translate the geometry.

translated

Returns a translated copy of this geometry.

validate_data

Validate the data against the object's data schema.