Skip to content

BSpline3D

Canonical path: NemAll_Python_Geometry.BSpline3D

Bases: PolyPoints3D

class for 3D (non uniform, rational) B-spline geometry

Methods:

Attributes:

Degree property writable

Degree: int

Gets spline degree

IsPeriodic property writable

IsPeriodic: bool

Returns whether the spline is periodic

Returns only given flag which was originally set

Knots property writable

Get knot vector

Weights property writable

Weights: VecDoubleList

Get control points weights

Clear

Clear()

Clear data, getting invalid state

Create staticmethod

Create(curve_object: object) -> BSpline3D

Create BSpline from ICurve3D

Parameters:

  • curve_object (object) –

    Input curve

Returns:

CreateArc3D staticmethod

CreateArc3D(arc: Arc3D) -> BSpline3D

Create BSpline form Arc3D

Parameters:

  • arc (Arc3D) –

    Input arc

Returns:

CreateBSpline staticmethod

CreateBSpline(points: Point3DList, degree: int, isPeriodic: bool) -> BSpline3D

Create BSpline from control points

Parameters:

  • points (Point3DList) –

    Control points

  • degree (int) –

    Degree of BSpline

  • isPeriodic (bool) –

    true if BSpline should be smoothly closed

Returns:

CreateBSpline3DFrom2DCurves staticmethod

CreateBSpline3DFrom2DCurves(
    directionCurve_object: object,
    elevationCurve_object: object,
    startHeight: float,
    chainPoints: Point3DList,
) -> tuple[eGeometryErrorCode, BSpline3D]

Creates BSpline3D from direction 2D curve and elevation 2D curve

Parameters:

  • directionCurve_object (object) –

    direction curve ( for X,Y coordinates)

  • elevationCurve_object (object) –

    elevation curve (for Z coordinates)

  • startHeight (float) –

    Z coordinate of new curve start point

  • chainPoints (Point3DList) –

    list of chain points to match resulting curve

Returns:

CreateBSpline3DFromAxisAndGradient staticmethod

CreateBSpline3DFromAxisAndGradient(
    directionCurve_object: object,
    elevationCurve_object: object,
    startHeight: float,
    chainPoints: Point3DList,
) -> tuple[eGeometryErrorCode, BSpline3D]

Create BSpline3D curve from axis and gradient (all placed in XY plane)

Parameters:

  • directionCurve_object (object) –

    direction/axis curve

  • elevationCurve_object (object) –

    elevation/gradient curve

  • startHeight (float) –

    Z coordinate of new curve start point

  • chainPoints (Point3DList) –

    list of chain points to match resulting curve

Returns:

CreateBSplineInterpolated staticmethod

CreateBSplineInterpolated(
    points: Point3DList, degree: int, isPeriodic: bool
) -> BSpline3D

Create BSpline from interpolated points

Parameters:

  • points (Point3DList) –

    Interpolated points

  • degree (int) –

    Degree of BSpline

  • isPeriodic (bool) –

    true if BSpline should be smoothly closed

Returns:

CreateBSplineJoined staticmethod

CreateBSplineJoined(curves_object: list) -> BSpline3D

Create BSpline by joining curves. Curves should meet by end points.

Parameters:

  • curves_object (list) –

    Source curves

Returns:

  • BSpline3D

    BSpline object (empty, if joining failed)

CreateLine3D staticmethod

CreateLine3D(line: Line3D) -> BSpline3D

Create BSpline3D from Line3D

Parameters:

  • line (Line3D) –

    Input line.

Returns:

CreatePolyline3D staticmethod

CreatePolyline3D(polyline3d: Polyline3D) -> BSpline3D

Create a BSpline out of a Polyline3D object

Parameters:

  • polyline3d (Polyline3D) –

    Polyline3D that will be used for conversion

Returns:

  • BSpline3D

    An instance of the created BSpline3D

CreateSpline staticmethod

CreateSpline(spline: Spline3D) -> BSpline3D

Create BSpline from Spline3D

Parameters:

Returns:

EvaluateEndPoint

EvaluateEndPoint() -> tuple[eGeometryErrorCode, Point3D]

Evaluate end point of bspline

Returns:

EvaluateEndRelPoint

EvaluateEndRelPoint() -> tuple[eGeometryErrorCode, Point3D]

Evaluate relative end (last) point of bspline

Returns:

EvaluatePoint

EvaluatePoint(param: float) -> tuple[eGeometryErrorCode, Point3D]

Evaluate point of b-spline

Parameters:

  • param (float) –

    parameter to evaluate point on b-spline

Returns:

EvaluatePointsWithTangents

EvaluatePointsWithTangents(
    parameters: VecDoubleList,
) -> tuple[Point3D, Vector3D]

Evaluate points and tangents of b-spline

Parameters:

  • parameters (VecDoubleList) –

    parameters to evaluate points and tangents on b-spline

Returns:

  • tuple[Point3D, Vector3D]

    vector of resulting points and tangents, if calculation failed for any parameter, empty vector is returned

EvaluateStartPoint

EvaluateStartPoint() -> tuple[eGeometryErrorCode, Point3D]

Evaluate start point of bspline

Returns:

EvaluateStartRelPoint

EvaluateStartRelPoint() -> tuple[eGeometryErrorCode, Point3D]

Evaluate relative start point of bspline

Returns:

Get

Return type: tuple(Point3DList, VecDoubleList, VecDoubleList, int, bool)

GetDegree

GetDegree() -> int

Gets spline degree

Returns:

  • int

    spline degree

GetInterpolatedPoints

GetInterpolatedPoints() -> Point3DList

Function returns interpolated points of b-spline

Returns:

GetInterpolatedPointsParameters

GetInterpolatedPointsParameters() -> VecDoubleList

Function returns list of parameters for interpolated points of b-spline

Returns:

GetInterval

GetInterval() -> tuple[bool, float, float]

Function returns the interval of bspline

Returns:

  • tuple[bool, float, float]

    tuple(true if success, start of curve interval, end of curve interval)

GetKnotMultiplicities

GetKnotMultiplicities() -> tuple[VecDoubleList, VecSizeTList]

Get knot vector and knot multiplicities

Returns:

GetKnots

GetKnots() -> VecDoubleList

Get knot vector

Returns:

GetParametersForDistances

GetParametersForDistances(distances: VecDoubleList) -> VecDoubleList

Find parameters for distances on b-spline

Parameters:

  • distances (VecDoubleList) –

    list of distances to calculate parameters for

Returns:

  • VecDoubleList

    list of parameters, if calculation failed for any distance, empty vector is returned

GetWeights

GetWeights() -> VecDoubleList

Get control points weights

Returns:

IsClosed

IsClosed() -> bool

Check if spline is closed ( first/last points are equal )

Returns:

  • bool

    closed spline true/false

IsEndClamped

IsEndClamped() -> bool

Function returns whether the bspline is clamped at the end

Returns:

  • bool

    true if clamped on end

IsLine

IsLine() -> bool

Check if bspline is line

Returns:

  • bool

    Returns true if it is line

IsPeriodicClosed

IsPeriodicClosed() -> bool

Returns whether the spline is periodic or closed in 1st degree

BSpline with degree == 1 cannot be periodic, wherefore returns true if closed.

Returns:

  • bool

    bool true = periodic or closed

IsRational

IsRational() -> bool

Check if the spline is rational

Returns:

  • bool

    bool true = rational

IsStartClamped

IsStartClamped() -> bool

Function returns whether the bspline is clamped at the start

Returns:

  • bool

    true if clamped on start

IsValid

IsValid() -> bool

Check spline validity

Returns:

  • bool

    bool valid = true

Reverse

Reverse()

Reverse of current spline

Method reverse Spline using reverse from PolyPoints and swapping tangents.

Set

Set(
    points: Point3DList,
    weights: VecDoubleList,
    knots: VecDoubleList,
    degree: int,
    isPeriodic: bool = False,
)

Get/Set functions

SetDegree

SetDegree(degree: int)

Set spline degree

Parameters:

  • degree (int) –

    desired degree

SetKnots

SetKnots(knots: VecDoubleList)

Set knot vector

Parameters:

SetPeriodic

SetPeriodic(periodic: bool)

Set periodic flag

Parameters:

  • periodic (bool) –

    value of periodic flag

SetWeights

SetWeights(weights: VecDoubleList)

Set weights for control points

Parameters:

__eq__

__eq__(bspline: BSpline3D) -> object

Comparison of bsplines without tolerance.

Be careful, this method work without tolerance!

Parameters:

Returns:

  • object

    True when bsplines are equal, otherwise false.

__init__ overloaded

__init__()

Initialize

__init__(
    points: Point3DList,
    weights: VecDoubleList,
    knots: VecDoubleList,
    degree: int,
    isPeriodic: bool,
)

Default constructor. Creates invalid spline.

__init__(spline: BSpline3D)

Copy constructor.

Parameters:

  • spline (BSpline3D) –

    Spline which will be copied.

__repr__

__repr__() -> str

Convert to string