Model.linecreatenurbs#
- Model.linecreatenurbs(degree, dimension, knot_count, pole_count, ratnl, double_array)#
Creates a generic NURBS type line using input parameters.
- Parameters:
degree (int) – Polynomial degree of the created line.
dimension (int) –
Dimension of created line. Valid values are:
2 - Planar line
3 - 3-Dimensional line
knot_count (int) – Number of knot values. See note below.
pole_count (int) – Number of NURBS control points/poles.
ratnl (int) –
Parameter that specifies whether weights are used in addition to control points. Valid values are:
0 - Use weights
1 - Do not use weights
double_array (hwDoubleList) – The list that contains the value of the knots, control points and weights (if
ratnl=1).
Note
To reduce input, the usual NURBS convention that for the curve with polynomial degree first and last degree+1 knots must have the same value is enforced internally. Input for this function should only contain one value. For all internal knot values, multiplicity should still be provided explicitly. All knot values must be provided in non-decreasing order.
Values in
double_arrayshould be arranged as follows:First
knot_countentries - knot values.Next
pole_count\(\times\) (x, y, z) values of control points for 3-dimensional line, or (u, v) values for planar line.If
ratnl\(\ne\) 0, then nextpole_countentries are NURBS weights values.
Examples#
Create a planar line segment connect points ( u0,v0)=(0,0 ) ( knot=0 ) and ( u1,v1)=(1,1 ) ( knot=1 )#import hm import hm.entities as ent model = hm.Model() ''' bspline_parameters = [knots, control_points, weights (if rational)] ''' param_list = [0, 1, 0, 0, 1, 1] model.linecreatenurbs( degree=1, dimension=2, knot_count=2, pole_count=2, ratnl=0, double_array=param_list )
Create a 90 degree arc start at ( 0,0 ) and end at ( 2.0 )#import hm import hm.entities as ent import math model = hm.Model() param_list = [0, 1, 0, 0, 1, 1, 2, 0, 1, math.sqrt(2) / 2, 1] model.linecreatenurbs( degree=2, dimension=2, knot_count=2, pole_count=3, ratnl=1, double_array=param_list )
Create a 180 degree arc#import hm import hm.entities as ent import math model = hm.Model() param_list = [0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 3, -1, 2, -2, 1, math.sqrt(2)/2, 1, math.sqrt(2)/2, 1] model.linecreatenurbs( degree=2, dimension=2, knot_count=4, pole_count=5, ratnl=1, double_array=param_list )