Skip to content

B Spline3D

Class full path: NemAll_Python_Geometry.BSpline3D

Bases: PolyPoints3D

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

Attributes

Degree: int property writable

Gets spline degree

IsPeriodic: bool property writable

Returns whether the spline is periodic

Returns only given flag which was originally set

Knots: NemAll_Python_Utility.VecDoubleList property writable

Get knot vector

Weights: NemAll_Python_Utility.VecDoubleList property writable

Get control points weights

Functions

Clear()

Clear data, getting invalid state

Create(curve_object) staticmethod

Create BSpline from ICurve3D

Parameters:

Name Type Description Default
curve_object object

Input curve

required

Returns:

Type Description
BSpline3D

Created BSpline3D.

CreateArc3D(arc) staticmethod

Create BSpline form Arc3D

Parameters:

Name Type Description Default
arc Arc3D

Input arc

required

Returns:

Type Description
BSpline3D

Created Bspline3D

CreateBSpline(points, degree, isPeriodic) staticmethod

Create BSpline from control points

Parameters:

Name Type Description Default
points Point3DList

Control points

required
degree int

Degree of BSpline

required
isPeriodic bool

true if BSpline should be smoothly closed

required

Returns:

Type Description
BSpline3D

BSpline object

CreateBSpline3DFrom2DCurves(directionCurve_object, elevationCurve_object, startHeight, chainPoints) staticmethod

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

Parameters:

Name Type Description Default
directionCurve_object object

direction curve ( for X,Y coordinates)

required
elevationCurve_object object

elevation curve (for Z coordinates)

required
startHeight float

Z coordinate of new curve start point

required
chainPoints Point3DList

list of chain points to match resulting curve

required

Returns:

Type Description
eGeometryErrorCode

tuple(eOK if successful,

BSpline3D

created BSpline3D)

CreateBSpline3DFromAxisAndGradient(directionCurve_object, elevationCurve_object, startHeight, chainPoints) staticmethod

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

Parameters:

Name Type Description Default
directionCurve_object object

direction/axis curve

required
elevationCurve_object object

elevation/gradient curve

required
startHeight float

Z coordinate of new curve start point

required
chainPoints Point3DList

list of chain points to match resulting curve

required

Returns:

Type Description
eGeometryErrorCode

tuple(error code,

BSpline3D

result BSpline3D curve)

CreateBSplineInterpolated(points, degree, isPeriodic) staticmethod

Create BSpline from interpolated points

Parameters:

Name Type Description Default
points Point3DList

Interpolated points

required
degree int

Degree of BSpline

required
isPeriodic bool

true if BSpline should be smoothly closed

required

Returns:

Type Description
BSpline3D

BSpline object

CreateBSplineJoined(curves_object) staticmethod

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

Parameters:

Name Type Description Default
curves_object list

Source curves

required

Returns:

Type Description
BSpline3D

BSpline object (empty, if joining failed)

CreateLine3D(line) staticmethod

Create BSpline3D from Line3D

Parameters:

Name Type Description Default
line Line3D

Input line.

required

Returns:

Type Description
BSpline3D

Created BSpline3D.

CreatePolyline3D(polyline3d) staticmethod

Create a BSpline out of a Polyline3D object

Parameters:

Name Type Description Default
polyline3d Polyline3D

Polyline3D that will be used for conversion

required

Returns:

Type Description
BSpline3D

An instance of the created BSpline3D

CreateSpline(spline) staticmethod

Create BSpline from Spline3D

Parameters:

Name Type Description Default
spline Spline3D

Spline

required

Returns:

Type Description
BSpline3D

Created BSpline3D.

EvaluateEndPoint()

Evaluate end point of bspline

Returns:

Type Description
tuple[eGeometryErrorCode, Point3D]

evaluated end point

EvaluateEndRelPoint()

Evaluate relative end (last) point of bspline

Returns:

Type Description
tuple[eGeometryErrorCode, Point3D]

evaluated relative end point

EvaluatePoint(param)

Evaluate point of b-spline

Parameters:

Name Type Description Default
param float

parameter to evaluate point on b-spline

required

Returns:

Type Description
eGeometryErrorCode

tuple(error code of evaluation,

Point3D

resulting point, if succeeded)

EvaluatePointsWithTangents(parameters)

Evaluate points and tangents of b-spline

Parameters:

Name Type Description Default
parameters VecDoubleList

parameters to evaluate points and tangents on b-spline

required

Returns:

Type Description
tuple[Point3D, Vector3D]

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

EvaluateStartPoint()

Evaluate start point of bspline

Returns:

Type Description
tuple[eGeometryErrorCode, Point3D]

evaluated start point

EvaluateStartRelPoint()

Evaluate relative start point of bspline

Returns:

Type Description
tuple[eGeometryErrorCode, Point3D]

evaluated relative start point

Get()

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

GetDegree()

Gets spline degree

Returns:

Type Description
int

spline degree

GetInterpolatedPoints()

Function returns interpolated points of b-spline

Returns:

Type Description
Point3DList

list of interpolated points

GetInterpolatedPointsParameters()

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

Returns:

Type Description
VecDoubleList

list of parameters of interpolated points

GetInterval()

Function returns the interval of bspline

Returns:

Type Description
bool

tuple(true if success,

float

start of curve interval,

float

end of curve interval)

GetKnotMultiplicities()

Get knot vector and knot multiplicities

Returns:

Type Description
VecDoubleList

tuple(knot vector with unique values,

VecSizeTList

knot multiplicities)

GetKnots()

Get knot vector

Returns:

Type Description
VecDoubleList

knot vector

GetParametersForDistances(distances)

Find parameters for distances on b-spline

Parameters:

Name Type Description Default
distances VecDoubleList

list of distances to calculate parameters for

required

Returns:

Type Description
VecDoubleList

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

GetWeights()

Get control points weights

Returns:

Type Description
VecDoubleList

weights vector

IsClosed()

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

Returns:

Type Description
bool

closed spline true/false

IsEndClamped()

Function returns whether the bspline is clamped at the end

Returns:

Type Description
bool

true if clamped on end

IsLine()

Check if bspline is line

Returns:

Type Description
bool

Returns true if it is line

IsPeriodicClosed()

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

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

Returns:

Type Description
bool

bool true = periodic or closed

IsRational()

Check if the spline is rational

Returns:

Type Description
bool

bool true = rational

IsStartClamped()

Function returns whether the bspline is clamped at the start

Returns:

Type Description
bool

true if clamped on start

IsValid()

Check spline validity

Returns:

Type Description
bool

bool valid = true

Reverse()

Reverse of current spline

Method reverse Spline using reverse from PolyPoints and swapping tangents.

Set(points, weights, knots, degree, isPeriodic=False)

Get/Set functions

Parameters:

Name Type Description Default
points Point3DList
required
weights VecDoubleList
required
knots VecDoubleList
required
degree int
required
isPeriodic bool
False

SetDegree(degree)

Set spline degree

Parameters:

Name Type Description Default
degree int

desired degree

required

SetKnots(knots)

Set knot vector

Parameters:

Name Type Description Default
knots VecDoubleList

knot vector to set

required

SetPeriodic(periodic)

Set periodic flag

Parameters:

Name Type Description Default
periodic bool

value of periodic flag

required

SetWeights(weights)

Set weights for control points

Parameters:

Name Type Description Default
weights VecDoubleList

weights vector to set

required

__eq__(bspline)

Comparison of bsplines without tolerance.

Be careful, this method work without tolerance!

Parameters:

Name Type Description Default
bspline BSpline3D

Compared bspline.

required

Returns:

Type Description
object

True when bsplines are equal, otherwise false.

__init__ overload

__init__()

Initialize

__init__(points, weights, knots, degree, isPeriodic)

Default constructor. Creates invalid spline.

Parameters:

Name Type Description Default
points Point3DList
required
weights VecDoubleList
required
knots VecDoubleList
required
degree int
required
isPeriodic bool
required
__init__(spline)

Copy constructor.

Parameters:

Name Type Description Default
spline BSpline3D

Spline which will be copied.

required

__repr__()

Convert to string