OCCNurbsCurve

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

Bases: compas_occ.geometry.curves.curve.OCCCurve, compas.geometry.curves.nurbs.NurbsCurve

Class representing a NURBS curve based on the BSplineCurve of the OCC geometry kernel.

Parameters

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

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

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

  • knots (list[float], read-only) – The knots of the curve, without multiplicities.

  • knotsequence (list[float], read-only) – The full vector of knots of the curve.

  • multiplicities (list[int], read-only) – The multiplicities of the knots of the curve.

  • is_rational (bool, read-only) – Flag indicating that the curve is rational.

Other Attributes
  • occ_curve (Geom_BSplineCurve) – The underlying OCC curve.

  • occ_shape (TopoDS_Shape, read-only) – The underlying OCC curve embedded in an edge and converted to a shape.

  • occ_edge (TopoDS_Edge, read-only) – The underlying OCC curve embedded in an edge.

  • occ_points (TColgp_Array1OfPnt, read-only) – The control points of the curve.

  • occ_weights (TColStd_Array1OfReal, read-only) – The weights of the control points of the curve.

  • occ_knots (TColStd_Array1OfReal, read-only) – The knots of the curve, without multiplicities.

  • occ_knotsequence (TColStd_Array1OfReal, read-only) – The full vector of knots of the curve.

  • occ_multiplicities (TColStd_Array1OfInteger, read-only) – The multiplicities of the knots of the curve.

Examples

Curve from points…

>>> from compas.geometry import Point
>>> from compas_occ.geometry import OCCNurbsCurve
>>> points = [Point(0, 0, 0), Point(3, 6, 0), Point(6, -3, 3), Point(10, 0, 0)]
>>> curve = OCCNurbsCurve.from_points(points)

Curve from parameters…

>>> from compas.geometry import Point
>>> from compas_occ.geometry import OCCNurbsCurve
>>> points = [Point(0, 0, 0), Point(3, 6, 0), Point(6, -3, 3), Point(10, 0, 0)]
>>> curve = OCCNurbsCurve.from_parameters(
...     points=points,
...     weights=[1.0, 1.0, 1.0, 1.0],
...     knots=[0.0, 1.0],
...     multiplicities=[4, 4],
...     degree=3)

Methods

closest_parameters_curve

Computes the curve parameters where the curve is the closest to another given curve.

closest_point

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

closest_points_curve

Computes the points on curves where the curve is the closest to another given curve.

from_arc

Construct a NURBS curve from an arc.

from_circle

Construct a NURBS curve from a circle.

from_edge

Construct a NURBS curve from an existing OCC TopoDS_Edge.

from_ellipse

Construct a NURBS curve from an ellipse.

from_interpolation

Construct a NURBS curve by interpolating a set of points.

from_line

Construct a NURBS curve from a line.

from_parameters

Construct a NURBS curve from explicit curve parameters.

from_points

Construct a NURBS curve from control points.

from_step

Load a NURBS curve from an STP file.

segment

Modifies this curve by segmenting it between the parameters u and v.

segmented

Returns a copy of this curve by segmenting it between the parameters u and v.

to_line

Convert the geometry to a line.

to_polyline

Convert the geometry to a polyline.

to_step

Write the curve geometry to a STP file.

Inherited Methods

aabb

Compute the axis aligned bounding box of the curve.

copy

Make an independent copy of the current curve.

curvature_at

Compute the curvature vector at a curve parameter.

divide_by_count

Divide the curve into a specific number of equal length segments.

divide_by_length

Divide the curve into segments of specified length.

fair

frame_at

Compute the local frame at a curve parameter.

from_data

Construct a NURBS curve from its data representation.

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_occ

Construct a NURBS curve from an existing OCC BSplineCurve.

length

Compute the length of the curve.

locus

Compute the locus of all points on the curve.

point_at

Compute the point at a curve parameter.

reverse

Reverse the parametrisation of the curve.

space

Compute evenly spaced parameters over the curve domain.

tangent_at

Compute the tangent vector at a curve parameter.

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.

transform

Transform this curve.

transformed

Transform a copy of the curve.

validate_data

Validate the object's data against its data schema (self.DATASCHEMA).

validate_json

Validate the object's data against its json schema (self.JSONSCHEMA).

xyz

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