Skip to content

OCCNurbsCurve ¤

OCCNurbsCurve(native_curve: Geom_BSplineCurve, name: str | None = None)

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

Parameters:

  • name (str | None, default: None ) –

    The name of the curve.

Attributes:

  • continuity (int) –

    The degree of continuity of the curve.

  • degree (int) –

    The degree of the curve.

  • is_rational (bool) –

    Flag indicating that the curve is rational.

  • knots (list[float]) –

    The knots of the curve, without multiplicities.

  • knotsequence (list[float]) –

    The full vector of knots of the curve.

  • multiplicities (list[int]) –

    The multiplicities of the knots of the curve.

  • order (int) –

    The order of the curve (= degree + 1).

  • points (list[Point]) –

    The control points of the curve.

  • weights (list[float]) –

    The weights of the control points 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)

Functions¤

copy ¤

copy() -> OCCNurbsCurve

Make an independent copy of the current curve.

Returns:

from_arc classmethod ¤

from_arc(arc: Arc, degree: int, pointcount: int | None = None) -> OCCNurbsCurve

Construct a NURBS curve from an arc.

Parameters:

  • arc (Arc) –

    The arc geometry.

  • degree (int) –

    The degree of the resulting NURBS curve.

  • pointcount (int | None, default: None ) –

    The number of control points in the resulting NURBS curve.

Returns:

from_circle classmethod ¤

from_circle(circle: Circle) -> OCCNurbsCurve

Construct a NURBS curve from a circle.

Parameters:

  • circle (Circle) –

    The circle geometry.

Returns:

from_ellipse classmethod ¤

from_ellipse(ellipse: Ellipse) -> OCCNurbsCurve

Construct a NURBS curve from an ellipse.

Parameters:

  • ellipse (Ellipse) –

    The ellipse geometry.

Returns:

from_interpolation classmethod ¤

from_interpolation(points: list[Point], precision: float = 0.001) -> OCCNurbsCurve

Construct a NURBS curve by interpolating a set of points.

Parameters:

  • points (list[Point]) –

    The control points of the curve.

  • precision (float, default: 0.001 ) –

    The precision of the interpolation.

Returns:

from_line classmethod ¤

from_line(line: Line) -> OCCNurbsCurve

Construct a NURBS curve from a line.

Parameters:

  • line (Line) –

    The line geometry.

Returns:

from_native classmethod ¤

from_native(native_curve: Geom_BSplineCurve) -> OCCNurbsCurve

Construct a NURBS curve from an existing OCC BSplineCurve.

Parameters:

  • native_curve (Geom_BSplineCurve) –

Returns:

from_parameters classmethod ¤

from_parameters(
    points: list[Point],
    weights: list[float],
    knots: list[float],
    multiplicities: list[int],
    degree: int,
    is_periodic: bool = False,
) -> OCCNurbsCurve

Construct a NURBS curve from explicit curve parameters.

Parameters:

  • points (list[Point]) –

    The control points.

  • weights (list[float]) –

    The weights of the control points.

  • knots (list[float]) –

    The knots of the curve, without multiplicities.

  • multiplicities (list[int]) –

    The multiplicities of the knots.

  • degree (int) –

    The degree of the curve.

  • is_periodic (bool, default: False ) –

    Flag indicating that the curve is periodic.

Returns:

from_points classmethod ¤

from_points(points: list[Point], degree: int = 3) -> OCCNurbsCurve

Construct a NURBS curve from control points.

Parameters:

  • points (list[Point]) –

    The control points of the curve.

  • degree (int, default: 3 ) –

    The degree of the curve.

Returns:

join ¤

join(curve: OCCNurbsCurve, precision: float = 0.0001) -> None

Modifies this curve by joining it with another curve.

Parameters:

  • curve (OCCNurbsCurve) –

    The curve to join.

  • precision (float, default: 0.0001 ) –

    Tolerance for continuity and multiplicity.

Returns:

  • None

joined ¤

joined(curve: OCCNurbsCurve, precision: float = 0.0001) -> OCCNurbsCurve | None

Returns a new curve that is the result of joining this curve with another.

Parameters:

  • curve (OCCNurbsCurve) –

    The curve to join.

  • precision (float, default: 0.0001 ) –

    Tolerance for continuity and multiplicity.

Returns:

segment ¤

segment(u: float, v: float, precision: float = 0.001) -> None

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

Parameters:

  • u (float) –

    Start parameter of the segment.

  • v (float) –

    End parameter of the segment.

  • precision (float, default: 0.001 ) –

    The precision for the segmentation.

Returns:

  • None

segmented ¤

segmented(u: float, v: float, precision: float = 0.001) -> OCCNurbsCurve

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

Parameters:

  • u (float) –

    Start parameter of the segment.

  • v (float) –

    End parameter of the segment.

  • precision (float, default: 0.001 ) –

    The precision for the segmentation.

Returns: