alias_api.AlCurve
- class alias_api.AlCurve
Bases:
AlObjectInterface to Alias nurbs curves geometry.
AlCurve is the interface to the geometric data of Alias’ NURBS curve objects. To create a curve, first instantiate and create an AlCurve and then instantiate and create an AlCurveNode. You can’t do much with an AlCurve that doesn’t have an AlCurveNode.
For more information on how to create the curve geometry, see the description for the create() method.
A curve form can be one of three types: periodic, closed or open. If a curve is “Periodic”, is t itangent continuous at all points on the curve and its endpoints are coincident. If a curve is “Closed”, it is not periodic but its endpoints are coincident. If the curve is neither closed nor periodic, it is considered to be “Open”.
There are two ways to delete an AlCurve. If the AlCurve destructor is called, the attached AlCurveNode is deleted. If the AlCurveNode destructor is called, the attached AlCurve is deleted.
You should always create a curve node for a curve. If you create a curve with no curve node, the curve is not added to the universe. If you should lose the pointer to the curve, it will become lost memory.
There is one limitation to this class: you cannot add or remove individual curve control points (except by changing multiplicity).
Curves are made of curve control points (or CV’s) which you can traverse as a list by using AlCurve.first_cv() plus the AlCurveCV methods. You can also pack the curve information into an array using methods in this class.
What is multiplicity?
An AlCurveCV object can actually represent multiple CV’s, depending on the AlCurveCV’s multiplicity and periodicity. Notice that in this class there are two sets of methods - some “incl_multiples” and some not (namely “number_of_cvs”, “cvs_world_position”, “cvs_unaffected_position”, etc). The set of methods without multiplicity lets you get all curve CV’s where a curve CV can have multiplicity of 1, 2 or 3. The set of methods “incl_multiples” lets you get ALL curve CV’s including multiples due to a multiplicity > 1 and due to periodicity.
Example 1:
If you create a curve in the interactive Alias package with 4 CV’s and change the multiplicity of the second CV to 2 (using the “multiplicity” menu item in the Curve Tools menu), then:
number_of_cvs() will return 4.
cvs_world_position must be passed a 4x4 CVs matrix, and a multiplicity vector of length 4.
cvs_unaffected_position() must be passed the same as item 2.
set_cvs_unaffected_position() must be passed the same as item 2.
number_of_cvs_incl_multiples() will return 5.
cvs_world_position_incl_multiples() must be passed a 5x4 CVs matrix. You will notice that the 2nd and 3rd points in this matrix are the same.
cvs_unaffected_position_incl_multiples() must be passed the same as item 6. You will notice that the 2nd and 3rd points in this matrix are the same.
set_cvs_unaffected_position_incl_multiples() must be passed the same as item 6. The matrix you pass in should have the 2nd and 3rd points the same. What really happens in this method is that the 3rd point is given the same value as the 2nd point. (What you give as the 3rd point is ignored).
Example 2:
If you create a curve in the interactive Alias package with 4 CV’s and “close” the curve (using the “close” menu item in the Object Tools menu), you create a periodic curve. Then:
number_of_cvs() will return 4.
cvs_world_position must be passed a 4x4 CVs matrix, and a multiplicity vector of length 4.
cvs_unaffected_position() must be passed the same as item 2.
set_cvs_unaffected_position() must be passed the same as item 2.
number_of_cvs_incl_multiples() will return 7.
cvs_world_position_incl_multiples() must be passed a 7x4 CVs matrix. You will notice that in this matrix the 5th, 6th and 7th points are the same as the 1st, 2nd and 3rd points respectively.
cvs_unaffected_position_incl_multiples() must be passed the same as item 6. You will notice that in this matrix the 5th, 6th and 7th points are the same as the 1st, 2nd and 3rd points respectively.
set_cvs_unaffected_position_incl_multiples() must be passed the same as item 6. The matrix you pass in should have the 5th, 6th and 7th points the same as the 1st, 2nd and 3rd points respectively. What really happens in this method is that the 5th, 6th and 7th points are assigned the same values as the 1st, 2nd and 3rd points respectively. (What you give for the 5th, 6th and 7th points are ignored).
- adjust_end_span(self: alias_api.AlCurve, new_knot_span: SupportsFloat) int
Change the knot spacing of the last span of the curve leaving the remainder of the curve unchanged. The end point of the last span is preserved.
- Parameters
new_knot_span (float) – The knot spacing for the end span.
- Returns
The status code result of the operation: InvalidObject - the curve is an invalid object Success - the method worked Failure - the curve did not have at least one span, failed to adjust
the end span
- Return type
int(AlStatusCode)
- append(self: alias_api.AlCurve, pos: Annotated[collections.abc.Sequence[SupportsFloat], 'FixedSize(4)'], type: alias_api.AlPointType) int
Append a CV or an edit point to the curve.
- Parameters
pos (List[float] (length 4)) – position in world space of new point
type (AlPointType (CV or EditPoint)) – The type of point to append.
- Returns
The status code result of the operation: Success - new point was successfully appended InvalidObject - the given object is not valid InvalidArgument - a None argument was supplied Failure - an error occurred
- Return type
int(AlStatusCode)
- apply_iterator_to_cvs(self: alias_api.AlCurve, iter: AlIterator) tuple[int, int]
Apply the given iterator to all the CVs in this class. See the documentation for AlIterator.
- Parameters
iter (AlIterator) – the iterator to apply to each CV
- Returns
A tuple containing: (1) The status code result of the operation:
Success - the iterator exited normally Failure - the iterator exited abnormally sInvalidArgument - the iterator ‘iter’ was None InvalidObject - the curve was not valid
The last return code from the iterator
- Return type
int(AlStatusCode)
- copy_wrapper(self: alias_api.AlCurve) alias_api.AlObject
Return an exact duplicate of this AlCurve object.
- create(*args, **kwargs)
Overloaded function.
create(self: alias_api.AlCurve, deg: typing.SupportsInt, form: alias_api.AlCurveFormType, num_knots: typing.SupportsInt, knot_vector: collections.abc.Sequence[typing.SupportsFloat], num_control_pts: typing.SupportsInt, control_point: collections.abc.Sequence[typing.Annotated[collections.abc.Sequence[typing.SupportsFloat], “FixedSize(4)”]], multiplicity: collections.abc.Sequence[typing.SupportsInt]) -> int
This method is used to create the geometric data that represents this curve.
Alias curves are represented by an array of knots and an array of control points (for a detailed understanding of nurbs curves see “An Introduction to Splines for use in Computer Graphics and Geometric Modeling” by Bartels, Beatty and Barsky. aka The Killer B’s.). The number of spans in a curve is determined by the degree of the curve and the number of control points, namely there are ‘num_control_pts’ - ‘deg’ spans. Knot values are associated with the ends of each span. Therefore, ‘num_knots’ must be equal to ‘number of spans + 1’.
The expert will notice that ‘num_knots’ = ‘number of spans + 1’ does not give us enough knots to specify all the basis functions properly. (The correct number of knots required, according to the Killer B’s are numSpans + 2*degree + 1). However since Alias piles knots up at the extreme ends of an open nurbs curve (in order to force the curve to touch each end control point) this method does not require that the user specify the redundant knot values. For example, if the knot vector for a three span open curve contained the knot values [0 1 2 3], the real knot vector would be [0 0 0 0 1 2 3 3 3 3]. In the case of a periodic curve the values of the knots can be determined implicitly from the knots values provided and again don’t need to be provided explicitly. For example, if the knot vector for a four span periodic curve contained the knot values [-1 1 2 5 10], the real knot vector would be [-10 -9 -6 -1 1 2 5 10 12 13 16].
If this object was previously referencing some other curve, and this call succeeds, this object will reference the new curve.
For more information on multiplicity, see the Class Description.
When you create a curve, you must ensure the following
Open and closed curves must have at least one span.
Periodic curves require that there be at least 3 spans.
‘num_knots’ must be equal to ‘number of spans + 1’
The knot values must be a non-decreasing sequence of values.
- The first and last span must not be vacuous. That is
knot_vector[0] < knot_vector[1] and knot_vector[num_knots-2] < knot_vector[num_knots-1]
Any knot multiplicity must not exceed the degree of the curve.
- Periodic curves also require that the number of spans be greater than
or equal to the degree of the curve.
- For open/closed curves the number of control points is
the number of spans + degree. (ex. one span requires four control points)
- For periodic curves the number of control points is the same as
the number of spans. It isn’t necessary to specify any of the overlapping control points.
- All multiplictiy values must be 1, 2 or 3. The first and last
multiplicity values must be 1.
- param deg
The degree of the curve.
- type deg
int
- param form
Open, Closed or Periodic.
- type form
curveFormType (Open, Closed or Periodic).
- param num_knots
The number of knots in the knot_vector.
- type num_knots
int
- param knot_vector
The sequence of knot values. Must be of length num_knots.
- type knot_vector
List
- param num_control_pts
The number of points in control_point.
- type num_control_pts
int
- param control_point
The array of control points. Must have size of num_control_pts * 4.
- type control_point
List[List[float]]
- param multiplicity
The multiplicity values. Must be of length num_control_pts. Assumed to be an array of 1’s if None.
- type multiplicity
int
- return
The status code result of the operation: Success - All ok. InsufficientMemory - Ran out of memory. InvalidArgument - a None argument was supplied. Failure - did not work.
- rtype
int
create(self: alias_api.AlCurve, deg: typing.SupportsInt, form: alias_api.AlCurveFormType, knot_vector: collections.abc.Sequence[typing.SupportsFloat], num_control_pts: typing.SupportsInt, control_points: collections.abc.Sequence[typing.Annotated[collections.abc.Sequence[typing.SupportsFloat], “FixedSize(4)”]]) -> int
This method is used to create the geometric data that represents this curve according to the standard Killer B’re representation.
This method shall be documented by noting its differences from the other create method.
This method assumes that the size of the number of knots passed in the knot vector is always num_control_pts - deg + 1 (or numSpans + 2*deg + 1, if you prefer, where numSpans = num_control_pts - deg). That is, the redundant end knots must be specified.
This method assumes that: If this object was previously referencing some other curve, and this call succeeds, this object will reference the new curve.
For more information on multiplicity, see the Class Description.
- When you create a curve, you must ensure the following
Open and closed curves must have at least one span.
Periodic curves require that there be at least 3 spans.
the number of knot values must be equal to ‘num_control_pts - deg + 1’
The knot values must be a non-decreasing sequence of values.
Any knot multiplicity must not exceed the degree of the curve.
- Periodic curves also require that the number of spans be greater than
or equal to the degree of the curve.
- For open/closed/periodic curves the number of control points is
the number of spans + degree. (ex. one span requires four control points).
- For periodic curves it is necessary to specify the overlapping
control points.
:param deg - The degree of the curve. :type deg: int :param form: The curve form type. :type form: curveFormType (Open, Closed or Periodic) :param knot_vector: The sequence of knot values. Must be of length
num_control_pts + deg + 1.
- type knot_vector
List[float] (len=num_control_pts - deg + 1)
- param num_control_pts
The number of points in control_point.
- type num_control_pts
int
- param control_point
The array of control points. Must have size of num_control_pts * 4.
- type control_point
List[List[float]]
- return
The status code result of the operation: Success - All ok. sInsufficientMemory - Ran out of memory. sInvalidArgument - a None argument was supplied. Failure - did not work.
- rtype
int(AlStatusCode)
- create_arc(*args, **kwargs)
Overloaded function.
create_arc(self: alias_api.AlCurve, start: typing.Annotated[collections.abc.Sequence[typing.SupportsFloat], “FixedSize(3)”], end: typing.Annotated[collections.abc.Sequence[typing.SupportsFloat], “FixedSize(3)”], other: typing.Annotated[collections.abc.Sequence[typing.SupportsFloat], “FixedSize(3)”], circle: typing.SupportsInt) -> int
This method is used to create a circular arc using attributes.
This method is simpler than the previous create method, requiring only to specify three points on the curve and whether the curve should be closed to form a circle. To modify the curve you should retrieve its attributes with the firstAttribute() method and use the appropriate AlAttribute methods to modify it. Modifying the CVs directly will cause the attributes to be deleted.
- param start
the coordinates for the start of the curve.
- type start
List[float] (len=3)
- param end
the coordinates for the end of the curve.
- type end
List[float] (len=3)
- param other
an additional point defining the arc.
- type other
List[float] (len=3)
- param circle
if True then a circle will be generated.
- type circle
bool
- return
The status code result of the operation: Success - All ok. Failure - Failed to create the curve. sInsufficientMemory - Ran out of memory. sAlreadyCreated - the AlCurve has already been created sInvalidArgument - a None argument was supplied
- rtype
int(AlStatusCode)
create_arc(self: alias_api.AlCurve, C: typing.Annotated[collections.abc.Sequence[typing.SupportsFloat], “FixedSize(3)”], N: typing.Annotated[collections.abc.Sequence[typing.SupportsFloat], “FixedSize(3)”], P: typing.Annotated[collections.abc.Sequence[typing.SupportsFloat], “FixedSize(3)”], r: typing.SupportsFloat, a0: typing.SupportsFloat, a1: typing.SupportsFloat, dim: typing.SupportsInt, make_cubic: typing.SupportsInt) -> int
Create a circular arc between two angles.
If dim = 2, N is ignored. Point P with zero angle must not be at C. Returns None if arc has no length 3D:
a0 < a1 and a1-a0 <= 2*PI. Returns a full circle if a1-a0 > 2*PI. To build a carc in the other direction, reverse N.
- 2D:
|a1-a0| <= 2*PI. If a0 < a1 arc is counter clockwise else arc is clockwise. Returns a full circle if |a1-a0| > 2*PI.
- param C
center
- type C
List[float]
- param N
normal to plane of arc (if 3D)
- type N
List[float]
- param P
point with zero angle
- type P
List[float]
- param r
radius
- type r
float
- param a0
inital angles (in radians)
- type a0
float
- param a1
final angles (in radians)
- type a1
float
- param dim
dimension 2 or 3
- type dim
int
- param make_cubic
if true, raise degree to 3
- type make_cubic
bool
- return
The status code result of the operation: InvalidArgument - a bad argument was supplied Failure - Failed to create the curve. Success - All ok.
- rtype
int(AlStatusCode)
- create_conic(self: alias_api.AlCurve, c_a: SupportsFloat, c_b: SupportsFloat, c_c: SupportsFloat, c_d: SupportsFloat, c_e: SupportsFloat, c_f: SupportsFloat, start: Annotated[collections.abc.Sequence[SupportsFloat], 'FixedSize(3)'], end: Annotated[collections.abc.Sequence[SupportsFloat], 'FixedSize(3)']) int
This method is used to create a conic arc using attributes. This method is simpler than the previous create method, requiring users only to specify the coefficients of the conic and the beginning and end of the curve. The start and end points must lie on the conic.
The conic is described by the equation
A * X^2 + B * X * Y + C * Y^2 + D * X + E * Y + F = 0
The conic will be created in the XY plane.
It is not possible to modify a conic curve through its attributes.
- Parameters
c_f (c_a through) – coefficient of the conic.
start (List[float] (len=3)) – the coordinates for the start of the curve.
end (List[float] (len=3)) – the coordinates for the end of the curve.
- Returns
The status code result of the operation: Success - All ok. Failure - Failed to create the curve. sInsufficientMemory - Ran out of memory. sInvalidArgument - a None argument was supplied sAlreadyCreated - the AlCurve has already been created
- Return type
int(AlStatusCode)
- create_ellipse(self: alias_api.AlCurve, center: Annotated[collections.abc.Sequence[SupportsFloat], 'FixedSize(3)'], major_axis: Annotated[collections.abc.Sequence[SupportsFloat], 'FixedSize(3)'], minor_axis: Annotated[collections.abc.Sequence[SupportsFloat], 'FixedSize(3)'], start: Annotated[collections.abc.Sequence[SupportsFloat], 'FixedSize(3)'], end: Annotated[collections.abc.Sequence[SupportsFloat], 'FixedSize(3)']) int
This method is used to create an elliptical arc using attributes. This method is simpler than the previous create method, requiring users only to specify the center, major axis, and minor axis of the ellipse and the beginning and end of the curve. The start and end points must lie on the ellipse and be specified in a counterclockwise order to indicate the arc. The axes must be perpendicular to each other.
When creating an elliptical arc, the axes MUST be specified in the XY plane.
It is not possible to modify an elliptical curve through its attributes.
It is not possible to create a closed curve with this method, hence it will always fail for AlFace’s.
- Parameters
center (List[float] (len=3)) – the center of the ellipse.
major_axis (List[float] (len=3)) – the focus of the ellipse.
minor_axis (List[float] (len=3)) – the focus of the ellipse.
start (List[float] (len=3)) – the coordinates for the start of the curve.
end (List[float] (len=3)) – the coordinates for the end of the curve.
- Returns
The status code result of the operation: Success - All ok. Failure - Failed to create the curve. sInsufficientMemory - Ran out of memory. sInvalidArgument - a None argument was supplied. sAlreadyCreated - the AlCurve has already been created
- Return type
int(AlStatusCode)
- create_hyperbola(self: alias_api.AlCurve, center: Annotated[collections.abc.Sequence[SupportsFloat], 'FixedSize(3)'], major_axis: Annotated[collections.abc.Sequence[SupportsFloat], 'FixedSize(3)'], minor_axis: Annotated[collections.abc.Sequence[SupportsFloat], 'FixedSize(3)'], start: Annotated[collections.abc.Sequence[SupportsFloat], 'FixedSize(3)'], end: Annotated[collections.abc.Sequence[SupportsFloat], 'FixedSize(3)']) int
This method is used to create a hyperbolic arc using attributes. This method is simpler than the previous create method, requiring users only to specify the center, major axis, and minor axis of the hyperbola and the beginning and end of the curve. The start and end points must lie on the ellipse and be specified in a counterclockwise order to indicate the arc. The axes must be perpendicular to each other.
The hyperbola will be created in the XY plane.
It is not possible to modify a hyperbolic curve through its attributes.
- Parameters
center (List[float] (len=3)) – the center of the hyperbola.
major_axis (List[float] (len=3)) – the focus of the hyperbola.
minor_axis (List[float] (len=3)) – the focus of the hyperbola.
start (List[float] (len=3)) – the coordinates for the start of the curve.
end (List[float] (len=3)) – the coordinates for the end of the curve.
Return code: :return: The status code result of the operation:
Success - All ok. Failure - Failed to create the curve. sInsufficientMemory - Ran out of memory. sInvalidArgument - a None argument was supplied. sAlreadyCreated - the AlCurve has already been created
- Return type
int(AlStatusCode)
- create_line(self: alias_api.AlCurve, start: Annotated[collections.abc.Sequence[SupportsFloat], 'FixedSize(3)'], end: Annotated[collections.abc.Sequence[SupportsFloat], 'FixedSize(3)']) int
This method is used to create straight lines using attributes.
This method is simpler than the previous create method, requiring only to specify the beginning and end of the curve. To modify the curve you should retrieve its attributes with the firstAttribute() method and use the appropriate AlAttribute methods to modify it. Modifying the CVs directly will cause the attributes to be deleted.
- Parameters
start (List[float] (len=3)) – the coordinates for the start of the curve.
end (List[float] (len=3)) – the coordinates for the end of the curve.
- Returns
The status code result of the operation: Success - All ok. Failure - Failed to create the curve. sInvalidArgument - start or end was None sInsufficientMemory - Ran out of memory.
- Return type
int(AlStatusCode)
- create_parabola(self: alias_api.AlCurve, vertex: Annotated[collections.abc.Sequence[SupportsFloat], 'FixedSize(3)'], focus: Annotated[collections.abc.Sequence[SupportsFloat], 'FixedSize(3)'], start: Annotated[collections.abc.Sequence[SupportsFloat], 'FixedSize(3)'], end: Annotated[collections.abc.Sequence[SupportsFloat], 'FixedSize(3)']) int
This method is used to create a parabolic arc using attributes. This method is simpler than the previous create method, requiring users only to specify the vertex and focus of the parabola and the beginning and end of the curve. The start and end points must lie on the parabola.
The parabola will be created in the XY plane.
It is not possible to modify a parabolic curve through its attributes.
- Parameters
vertex (List[float] (len=3)) – the vertex of the parabola.
focus (List[float] (len=3)) – the focus of the parabola.
start (List[float] (len=3)) – the coordinates for the start of the curve.
end (List[float] (len=3)) – the coordinates for the end of the curve.
Return code: :return: The status code result of the operation:
Success - All ok. Failure - Failed to create the curve. sInsufficientMemory - Ran out of memory. sInvalidArgument - a None argument was supplied sAlreadyCreated - the AlCurve has already been created
- Return type
int(AlStatusCode)
- create_point(self: alias_api.AlCurve, pt: Annotated[collections.abc.Sequence[SupportsFloat], 'FixedSize(3)']) int
Create a “degenerate curve” with a single CV. The coordinates for this CV are provided by the argument pt[]. The created “curve” will be:
rational open degree 1 span 0 dimension 3 knots {0.0} cvs {pt[0], pt[1], pt[2], 1.0}
- Parameters
pt (List[float] (len=3)) – position of the point
- Returns
The status code result of the operation: Success - the method succeeded Failure - Failed to create the point. sInvalidArgument - a None argument was supplied. sAlreadyCreated - the AlCurve has already been created
- Return type
int(AlStatusCode)
- curve_node(self: alias_api.AlCurve) AlCurveNode
Returns the curve node associated with this curve.
Returns None if there is not attached curve node.
- cvs_affected_position(self: alias_api.AlCurve, tm: alias_api.AlTM) tuple[int, list, list[int]]
Returns the CV’s in the given CV array and the multiplicity of each CV in the multiplicity vector. The first dimension of the CV array must be number_of_cvs(). The length of the multiplicity vector must also be number_of_cvs(). The multiplicity vector returned by this function is the same as the one returned by CVsUnaffectedPosition().
- Parameters
tm (ALTM) – the transformation matrix built by tranversing the dag.
- Returns
A tuple containing: (1) The status code result of the operation:
Success - the curve CVs positions were returned InvalidObject - the curve was not valid Failure - an error occurred sInvalidArgument - a None argument was supplied
The CV positions
The multiplicity of each CV
- Return type
int(AlStatusCode)
- cvs_affected_position_incl_multiples(self: alias_api.AlCurve, cv_list: collections.abc.Sequence[Annotated[collections.abc.Sequence[SupportsFloat], 'FixedSize(4)']]) tuple[int, list[Annotated[list[float], 'FixedSize(4)']], alias_api.AlTM]
Returns the world positions of all CV’s in this curve, including multiples. The first dimension of the given CVList must be of length number_of_cvs_incl_multiples().
Note that the positions returned are [ x y z w ] and not [ w*x w*y w*z w ].
- Parameters
cv_list (List[List[float]]) – the world positions of all CV’s
- Returns
A tuple containing: (1) The status code result of the operation:
Success - the CVs positions were returned InvalidObject - the curve was not valid sInvalidArgument - a None argument was supplied
The world positions of all CV’s
The AlTM transformation matrix built by traversing the dag
- Return type
int(AlStatusCode)
- cvs_unaffected_position(self: alias_api.AlCurve) tuple[int, list, list[int]]
Returns the CV’s in the given CV array and the multiplicity of each CV in the multiplicity vector. The first dimension of the CV array must be number_of_cvs(). The length of the multiplicity vector must also be number_of_cvs(). The multiplicity vector returned by this function is the same as the one returned by CVsWorldPosition().
- Parameters
cv_list (List[List[float]]) – returned CV positions
:param multiplicity - the multiplicity of each CV :type multiplicity: int
- Returns
A tuple containing: (1) The status code result of the operation:
Success - the curve CVs positions were returned InvalidObject - the curve was not valid sInvalidArgument - a None argument was supplied Failure - an error occurred
The CV positions
The multiplicity of each CV
- Return type
int(AlStatusCode)
- cvs_unaffected_position_incl_multiples(self: alias_api.AlCurve, cv_list: collections.abc.Sequence[Annotated[collections.abc.Sequence[SupportsFloat], 'FixedSize(4)']]) tuple[int, list[Annotated[list[float], 'FixedSize(4)']]]
Returns the unaffected positions of all CVs in this curve, including multiples. The first dimension of the given CVList must be of length number_of_cvs_incl_multiples().
- Parameters
cv_list (List[List[float]]) – returned unaffected positions of all CVs
- Returns
A tuple containing: (1) The status code result of the operation:
Success - the CVs positions were returned InvalidObject - the curve was not valid sInvalidArgument - a None argument was supplied Failure - an error occurred
The unaffected positions of all CVs
- Return type
int(AlStatusCode)
- cvs_world_position(self: alias_api.AlCurve) tuple[int, list, list[int]]
Returns the CV’s in the given CV array and the multiplicity of each CV in the multiplicity vector. The first dimension of the CV array must be number_of_cvs(). The length of the multiplicity vector must also be number_of_cvs(). The multiplicity vector returned by this function is the same as the one returned by CVsUnaffectedPosition().
- Returns
A tuple containing: (1) The status code result of the operation:
Success - the curve CVs positions were returned InvalidObject - the curve was not valid Failure - an error occurred sInvalidArgument - a None argument was supplied
The CV positions List[List[float[4]]]
The multiplicity of each CV List[int]
- Return type
int(AlStatusCode)
- cvs_world_position_incl_multiples(self: alias_api.AlCurve, cv_list: collections.abc.Sequence[Annotated[collections.abc.Sequence[SupportsFloat], 'FixedSize(4)']]) tuple[int, list[Annotated[list[float], 'FixedSize(4)']]]
Returns the world positions of all CV’s in this curve, including multiples. The first dimension of the given CVList must be of length number_of_cvs_incl_multiples().
Note that the positions returned are [ x y z w ] and not [ w*x w*y w*z w ].
- Parameters
cv_list (List[List[float]]) – the world positions of all CV’s
- Returns
A tuple containing: (1) The status code result of the operation:
Success - the CVs positions were returned InvalidObject - the curve was not valid sInvalidArgument - a None argument was supplied Failure - an error occurred
The world positions of all CV’s
- Return type
int(AlStatusCode)
- degree(self: alias_api.AlCurve) int
Returns the degree of the curve.
-1 is returned if the curve is not valid.
- delete_object(self: alias_api.AlCurve) int
Delete the AlCurve from the Alias Universe and return the status of the performed operation.
- do_updates(self: alias_api.AlCurve, new_state: SupportsInt) int
The do_upate flag is used to notify the system that you are finished performing. If this flag is true, then it is equivalent to sending out a ‘geometry modified’ message to the rest of the system. When the system receives the update message, then operations such as construction history etc are performed.
This feature is important when using construction history plugins. Construction history plugins should always set the do_upate flag to False when performing updates (otherwise an infinite update loop will result, usually ending in a core dump). The update can be explicitly forced using the AlDagNode.send_geometry_modified_message() method.
This flag DOES NOT UPDATE THE SCREEN. Use the AlUniverse::redrawScreen to perform the screen refresh.
If the previous state of the flag was False and the new state is True, then an update will be performed now and on each subsequent dag modification.
- Returns
The status code result of the operation: Success - the new state was set InvalidObject - this DagNode is invalid.
- Return type
int(AlStatusCode)
- eval(*args, **kwargs)
Overloaded function.
eval(self: alias_api.AlCurve, t: typing.SupportsFloat, world_coordinates: typing.SupportsInt) -> tuple[int, typing.Annotated[list[float], “FixedSize(3)”], typing.Annotated[list[float], “FixedSize(3)”]]
Determines the 3D coordinate and the derivative of the parameter value on the curve.
- param t
parameter position on the curve
- type t
float
- param worldCoordinates
the evaluation is performed in world coordinates
- type worldCoordinates
bool
- return
A tuple containing: (1) The status code result of the operation:
Success - the coordinate was successfully determined Failure - the evaluation failed InvalidObject - the curve was invalid
The 3D coordinate of the point at the given parameter - List[float]
The derivative of the parameter value on the curve - float
- rtype
int(AlStatusCode)
eval(self: alias_api.AlCurve, dist: typing.SupportsFloat, world_coordinates: bool, tolerance: typing.SupportsFloat) -> tuple[int, typing.Annotated[list[float], “FixedSize(3)”], typing.Annotated[list[float], “FixedSize(3)”]]
Determines the 3D coordinate of the point at a given distance from start of the curve. Error tolerance must be greater than zero.
- param dist
arc length position on the curve
- type dist
float
:param worldCoordinates - the evaluation is performed in world coordinates :type worldCoordinates: bool :param tolerance - the error tolerance :type tolerance: float
- return
A tuple containing: (1) The status code result of the operation:
Success - the coordinate was successfully determined Failure - the evaluation failed InvalidObject - the curve was invalid sInvalidArgument - tolerance was non-positive
The 3D coordinate of the point at the given distance
The parameter value at the given distance
- rtype
int(AlStatusCode)
- extend_curve(self: alias_api.AlCurve, knot: SupportsFloat, new_pos: Annotated[collections.abc.Sequence[SupportsFloat], 'FixedSize(4)']) int
Extend the curve by one span. The existing spans remain unchanged. The new span has C(k-1) and interpolates the given point. This curve must have at least 1 span and at least 4 CVs.
- Parameters
knot (float) – the knot spacing for the new span.
new_pos (List[float] (length 4)) – the position of the new CV.
- Returns
The status code result of the operation: InvalidObject - the curve was an invalid object Success - extending the spline worked Failure - curve had less than 1 span, curve had less than 4 CVs,
or could not extend spline because of an internal error
- Return type
int(AlStatusCode)
- first_attribute(self: alias_api.AlCurve) alias_api.AlAttributes
Returns the first attribute on this curve if any, otherwise None is returned. Note that if CV positions are modified through any of the AlCurve, AlCurveCV, AlCluster, AlSet, etc. then the attributes are removed from the curve.
- first_cv(self: alias_api.AlCurve) AlCurveCV
Returns a pointer to the first CV in the curve.
- form(self: alias_api.AlCurve) alias_api.AlCurveFormType
When a curve is periodic it means that its endpoints are coincident and that the curve is tangent continuous at the point where its endpoints touch. “Periodic” is returned in this case. “Closed” is returned if the curve is not periodic, but if its endpoints are coincident. If a curve is neither “Periodic” nor “Closed” then “Open” is returned.
(Note: If you use the “close” menu item in the interactive Alias package, you actually make a curve periodic.)
- get_cv(self: alias_api.AlCurve, index: SupportsInt) AlCurveCV
Returns a pointer to the CV of the given index. Returns None if the CV could not be found or the index was negative. The index of the first CV is 0.
- increment_degree(self: alias_api.AlCurve) int
Increment the degree of a curve without changing its shape. The curve must have at least 1 span.
- Returns
The status code result of the operation: InvalidObject - curve is not a valid object Success - raising the degree of the curve worked Failure - number of spans less than 1 or internal failure
- Return type
int(AlStatusCode)
- insert(self: alias_api.AlCurve, param: SupportsFloat) int
Insert an edit point into the curve.
- Parameters
param (float) – parametric value of the new edit point on the curve
- Returns
The status code result of the operation: Success - edit point was successfully inserted InvalidObject - the given object is not valid InvalidArgument - param is out of bounds Failure - an error occurred
- Return type
int(AlStatusCode)
- is_display_mode_set(self: alias_api.AlCurve, mode: alias_api.AlDisplayModeType) int
Returns True if the specified display mode is toggled on for the curve. Returns False otherwise.
- The only valid AlDisplayModeTypes for an AlCurve are
DisplayGeomHull DisplayGeomEditPoints DisplayGeomKeyPoints DisplayGeomCVs
- Parameters
mode (AlDisplayModeType) – display mode of interest.
- Returns
False is returned if the curve is not Valid.
- Return type
bool
- knot_vector(self: alias_api.AlCurve) list[float]
Returns the knot vector in the given vector. This vector must be of length numberOfKnots(). For more information as to what these values mean, see the description for the create() method.
:param knot_vector - returned knot vector :type knot_vector: List
- Returns
The status code result of the operation: Success - the knot vector was returned InvalidObject - the curve was not valid InvalidArgument - a None argument was supplied
- Return type
int(AlStatusCode)
- length(self: alias_api.AlCurve, world_coordinates: bool = 1, tolerance: SupportsFloat = 0.001) tuple[int, float]
Determines the length of the curve in either local coordinates or world space coordinates.
- Parameters
worldCoordinates (bool) – if the calculation is to be done in world space
:param tolerance - the error tolerance :type tolerance: float
- Returns
A tuple containing: (1) The status code result of the operation:
Success - the length was successfully determined Failure - the evaluation failed InvalidObject - the curve was invalid sInvalidArgument - tolerance was zero or negative
The length of the curve
- Return type
int(AlStatusCode)
- normal(self: alias_api.AlCurve) tuple[int, Annotated[list[float], 'FixedSize(3)']]
Test if bspline is planar and return normal. Find the first three points that are not collinear, construct a normal and test if the bspline lies in the plane. If the bspline is planar and closed the normal is returned with a clockwise orientation looking down on the plane, and the normal pointing towards you. If the bspline is a line or all the points are collinear, a unique normal can not be defined.
- Returns
A tuple containing: (1) The status code result of the operation:
Success - found normal to curve Failure - normal could not be found, either
the spline is a point, linear or not planar
the normal vector
- Return type
int(AlStatusCode)
- number_of_cvs(self: alias_api.AlCurve) int
Returns the number of CVs.
-1 is returned if the curve is not valid.
- number_of_cvs_incl_multiples(self: alias_api.AlCurve) int
Returns the number of CV’s including multiples. For more information as to what this value means, see the class documentation. -1 is returned if the curve is not valid.
- number_of_knots(self: alias_api.AlCurve) int
Returns the number of knots in this curve. For more information as to what this number means, see the description for the create() method. -1 is returned if the curve is not valid.
- number_of_spans(self: alias_api.AlCurve) int
Returns the number of spans in the curve.
-1 is returned if the curve is not valid.
- periodic_to_non_periodic(self: alias_api.AlCurve) int
If a curve is periodic, convert it to non-periodic curve (closed curve) by making it have multiple end knots.
This method modifies the curve. It will not succeed for an AlCurve that exists in the AlUniverse; that is, it must not have a parent AlCurveNode.
- Returns
The status code result of the operation: InvalidObject - the curve was invalid. Failure - the method didn’t succeed Success - the curve was converted to non-periodic one.
- Return type
int(AlStatusCode)
- real_knot_vector(self: alias_api.AlCurve) list[float]
Returns real_number_of_knots() in ‘knot_vector’ for the curve.
- Parameters
knot_vector (List) – array to place the knot vector into
- Returns
The status code result of the operation: Success - successfully copied the curve’s knot vector into knot_vector sInvalidArgument - knot_vector was None InvalidObject - the curve was invalid Failure - an error occurred
- Return type
int(AlStatusCode)
- real_number_of_knots(self: alias_api.AlCurve) int
Returns the actual number of knots on the curve. That is number_of_spans() + 2*degree() - 1. (Note that two additional knots are required to define a NURBS curve, but they have no effect on the curve so are not included in this count.) This method returns -1 if the curve is not valid.
- replace(*args, **kwargs)
Overloaded function.
replace(self: alias_api.AlCurve, deg: typing.SupportsInt, form: alias_api.AlCurveFormType, num_knots: typing.SupportsInt, knot_vector: collections.abc.Sequence[typing.SupportsFloat], num_control_pts: typing.SupportsInt, control_point: collections.abc.Sequence[typing.Annotated[collections.abc.Sequence[typing.SupportsFloat], “FixedSize(4)”]], multiplicity: collections.abc.Sequence[typing.SupportsInt]) -> int
This method is used to replace the data that represents the curve.
It basically duplicates the ::create routine and recreates the curve and then replaces the current curve with the new one.
See create() for more details.
- param deg
The degree of the curve.
- type deg
int
- param form
The curve form type.
- type form
curveFormType (Open, Closed or Periodic)
- param num_knots
The number of knots in the knot_vector.
- param knot_vector
The sequence of knot values. Must be of length num_knots.
- type knot_vector
List
- param num_control_pts
The number of points in control_point.
- type num_control_pts
int
- :param control_point - The array of control points. Must have size
of num_control_pts * 4.
- type control_point
List[List[float]]
- :param multiplicity - The multiplicity values. Must be of length
num_control_pts. Assumed to be an array of 1’s if None.
- type multiplicity
int
- return
The status code result of the operation:
Success - All ok. sInsufficientMemory - Ran out of memory. sInvalidArgument - a None argument was supplied. Failure - did not work.
replace(self: alias_api.AlCurve, deg: typing.SupportsInt, form: alias_api.AlCurveFormType, knot_vector: collections.abc.Sequence[typing.SupportsFloat], num_control_pts: typing.SupportsInt, control_point: collections.abc.Sequence[typing.Annotated[collections.abc.Sequence[typing.SupportsFloat], “FixedSize(4)”]]) -> int
This method is used to replace the data that represents the curve.
It basically duplicates the ::create routine and recreates the curve and then replaces the current curve with the new one.
See create() for more details.
- param deg
The degree of the curve.
- type deg
int
- param form
The curve form type.
- type form
curveFormType (Open, Closed or Periodic)
- param knot_vector
The sequence of knot values. Must be of length num_control_pts + deg + 1.
- type knot_vector
List
- param num_control_pts
The number of points in control_point.
- type num_control_pts
int
- :param control_point - The array of control points. Must have size
of num_control_pts * 4.
- type control_point
List[List[float]]
- return
The status code result of the operation: Success - All ok. sInsufficientMemory - Ran out of memory. sInvalidArgument - a None argument was supplied. Failure - did not work.
- rtype
int(AlStatusCode)
- reverse_curve(self: alias_api.AlCurve) int
Reverses the parameterization of the curve.
- Returns
The status code result of the operation: InvalidObject - curve was not a valid object Success - the curve reversal worked Failure - the curve reversal failed for internal reasons
- Return type
int(AlStatusCode)
- set_cvs_unaffected_position(self: alias_api.AlCurve, cv_list: collections.abc.Sequence[Annotated[collections.abc.Sequence[SupportsFloat], 'FixedSize(4)']]) int
Sets the CV’s of this curve to the values in the given CV array. The first dimension of the CV array must be number_of_cvs().
- Parameters
cv_list (List[List[float[4]]]) – CV positions
- Returns
The status code result of the operation: Success - the curve CVs positions were set InvalidObject - the curve was not valid sInvalidArgument - a None argument was supplied Failure - an error occurred
- Return type
int(AlStatusCode)
- set_cvs_unaffected_position_incl_multiples(self: alias_api.AlCurve, cv_list: collections.abc.Sequence[Annotated[collections.abc.Sequence[SupportsFloat], 'FixedSize(4)']]) int
Sets the unaffected positions of all CVs in this curve, including multiples. The first dimension of the given CVList must be of length number_of_cvs_incl_multiples().
You cannot give multiples different values. For example, if you have an open curve where numOfCVs() is 6 and and numOfCVsInclMultiples() is 7 because the 2nd point has a multiplicity of 2, then the 2nd and 3rd quadruple in your CVList should be the same. What really happens is that the 3rd point is given the same value as the 2nd point. (What you give as the 3rd point is ignored). For more information see the examples in the class description.
- Parameters
cv_list (List[List[float]]) – the unaffected positions of all CVs
- Returns
The status code result of the operation: Success - the CVs positions were set InvalidObject - the curve was not valid sInvalidArgument - a None argument was supplied Failure - an error occurred
- Return type
int(AlStatusCode)
- set_display_mode(self: alias_api.AlCurve, mode: alias_api.AlDisplayModeType, on: SupportsInt) int
For the given display mode, if the flag on_or_off is True then the display mode for the surface is set, otherwise it is unset.
- The only valid AlDisplayModeTypes for an AlCurve are
DisplayGeomHull DisplayGeomEditPoints DisplayGeomKeyPoints DisplayGeomCVs
- Parameters
mode (AlDisplayMode) – display mode of interest.
on_or_off (bool) – True if this surface will have the display mode set, else False.
- Returns
The status code result of the operation: Return values: Success - if this operation was successful. InvalidObject - the curve was invalid sInvalidArgument - invalid display type.
- Return type
int(AlStatusCode)
- set_knot_vector(self: alias_api.AlCurve, knot_vector: collections.abc.Sequence[SupportsFloat]) int
Sets the knot vector to be the given vector. This vector must be of length numberOfKnots(). For more information as to what these values mean, see the description for the create() method.
:param knot_vector - the knot vector to be the given vector :type knot_vector: List
- Returns
The status code result of the operation: Success - the knot vector was set InvalidObject - the curve was not valid sInvalidArgument - a None argument was supplied or the knots were
not in increasing order
- Return type
int(AlStatusCode)
- set_real_knot_vector(self: alias_api.AlCurve, knot_vector: collections.abc.Sequence[SupportsFloat]) int
Sets the knots for this curve. The parameter ‘knot_vector’ must be of ‘real_number_of_knots()’.
- Parameters
knot_vector (List) – array of knots. The length of the array should be equal to ‘real_number_of_knots()’
- Returns
The status code result of the operation: Success - the knots were successfully set. sInvalidArgument - knot_vector was None InvalidObject - the curve is invalid Failure - an error occurred
- Return type
int(AlStatusCode)
- trim_curve(self: alias_api.AlCurve, min_point: SupportsFloat, max_point: SupportsFloat) int
Trim the curve at the parameters specified. param0 and param1 are the min and max points. This routine fails if param0 and param1 are the same or if param0 is greater than param1.
- Parameters
min_point (float) – the minimum position along the curve where the curve is to be trimmed
max_point (float) – the maxiumum position along the curve where the curve is to be trimmed
- Returns
The status code result of the operation InvalidObject - curve was not a valid object Success - method worked Failure - failed to trim spline, min_point equals max_point or
min_point > max_point or other internal failure
- Return type
int
- type(self: alias_api.AlCurve) alias_api.AlObjectType
Return the AlCurve type identifier.