OCCNurbsSurface

class compas_occ.geometry.OCCNurbsSurface(*args, **kwargs)[source]

Bases: compas_occ.geometry.surfaces.surface.OCCSurface, compas.geometry.surfaces.nurbs.NurbsSurface

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

Parameters

name (str, optional) – The name of the curve

Attributes
  • points (list[list[Point]], read-only) – The control points of the surface.

  • weights (list[list[float]], read-only) – The weights of the control points of the surface.

  • u_knots (list[float], read-only) – The knots of the surface in the U direction, without multiplicities.

  • v_knots (list[float], read-only) – The knots of the surface in the V direction, without multiplicities.

  • u_mults (list[int], read-only) – The multiplicities of the knots of the surface in the U direction.

  • v_mults (list[int], read-only) – The multiplicities of the knots of the surface in the V direction.

Other Attributes

occ_surface (Geom_BSplineSurface) – The underlying OCC surface.

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,
    u_knots=[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],
    v_knots=[0.0, 1/9, 2/9, 3/9, 4/9, 5/9, 6/9, 7/9, 8/9, 1.0],
    u_mults=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
    v_mults=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
    u_degree=3,
    v_degree=3,
)

Methods

copy

Make an independent copy of the current surface.

from_data

Construct a BSpline surface from its data representation.

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_parameters

Construct a NURBS surface from explicit parameters.

from_points

Construct a NURBS surface from control points.

from_step

Load a NURBS surface from a STP file.

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.

curvature_at

Compute the curvature at a point on the surface.

frame_at

Compute the local frame at a point on the curve.

from_face

Construct surface from an existing OCC TopoDS_Face.

from_json

Construct an object from serialized data contained in a JSON file.

from_jsonstring

Construct an object from serialized data contained in 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 NUBRS surface from an existing OCC BSplineSurface.

intersections_with_line

Compute the intersections with a line.

obb

Compute the oriented bounding box of the surface.

point_at

Compute a point on the surface.

sha256

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

to_data

Convert an object to its native data representation.

to_json

Serialize the data representation of an object to a JSON file.

to_jsonstring

Serialize the data representation of an object to a JSON string.

to_mesh

Convert the surface to a quad mesh.

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.

transform

Transform this surface.

transformed

Returns a transformed copy of this geometry.

u_isocurve

Compute the isoparametric curve at parameter u.

u_space

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

v_isocurve

Compute the isoparametric curve at parameter v.

v_space

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

validate_data

Validate the object's data against its data schema.

validate_json

Validate the object's data against its json schema.

xyz

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