Curve

Model ElementCurve defines a parametric curve in 3D space.

Class Name

Curve

Description

A parametric curve has one free parameter, u, and three associated functions f(u), g(u) and h(u). For every value, u=u*, f(u*), g(u*), and h(u*) represent the coordinates of a point in space. As u is swept from its minimum to maximum value, a curve in 3D space is generated. For additional information on the definition of Curve, please see the Description and the Comments section of Reference_ParamCurve.

Attribute Summary

Name Property Modifiable by command? Designable?
id Int ()    
label Str ()    
matrix Reference ("Matrix") Yes FD Only
xyx Nodes (None, count=0)    
curve_points Bool () Yes  
closed Bool (False) Yes  
minpar Double (-1.0)    
maxpar Double (1.0)    
function Function ("CURSUB")   FD Only
routine Routine () or Str ()   FD Only
script Script ()    

Usage

Curves are available in the following forms:
#1: Curve data provided in a Matrix
Curve(matrix=objMatrix, optional_attributes)

#2. Curve data provided as xyz points
Curve(xyz=xyz_points, optional_attributes)

#3. Curve specified in a compiled user-written subroutine
Curve(function=userString, routine=string, optional_attributes)

#4. Curve specified in a Python function
Curve(function=userString, routine=functionPointer, curve_points=boolean, optional_attributes)

Attributes

Curve data provided in a Matrix.
matrix
Reference to an existing matrix object.
Specifies the Matrix that contains the curve data. The matrix should contain only the x-, y-, and z- data for the individual curve points. For example: [x1,y1,z1,x2,y2,z2,…].
Note: For a closed curve, the first and last data points must be the same.
Curve data provided as xyz points.
xyz
Nodes
List of [x,y,z] points used by the curve. For example: [[x1,y1,z1],[x2,y2,z2],…]
Note: For a closed curve, the first and last data points must be the same.
Curve specified in a compiled user-written subroutine.
function
String
The list of parameters that are passed from the data file to the user-defined subroutine.
routine
String
Specifies an alternative name for the user subroutine. The name consists of two pieces of information, separated by "::". The first is the pathname to the shared library containing the function that computes the response of the user-defined Surface. The second is the name of the function in the shared library that does the computation.
An example is: routine="/staff/Altair/engine.dll::myCurve"
  • "/staff/Altair/engine.dll is the DLL.
  • "myCurve" is the function within this DLL that performs the calculations.
The attribute routine is optional.
When not specified, routine defaults to CURSUB.
minpar
Double
Specifies the minimum value of the curve parameter.
The minpar attribute is optional. When not specified, it defaults to -1.
Note: When specified, minpar < maxpar.
maxpar
Double
Specifies the maximum value of the curve parameter.
The maxpar attribute is optional. When not specified, it defaults +1.
Note: When specified, minpar < maxpar.
Curve specified in a Python function.
function
String
The list of parameters that are passed from the data file to the user-defined function.
routine
Callable function in Python or string.
An example is: routine=myCurve or routine=”myCurve”.
  • If script is not used, then myCurve is a Python function or method defined within the namespace.
  • If script is used, then “myCurve” is a string that names the function in an external written script.
The attribute routine is optional.
When not specified, routine defaults to CURSUB.
script
Specifies the path and name of the user-written script that contains the function specified by routine.
The attribute script is optional.
When not specified, MotionSolve looks for a function within the namespace.
minpar
Double
Specifies the minimum value of the curve parameter.
The minpar attribute is optional. When not specified, it defaults to -1.
Note: When specified, minpar < maxpar.
maxpar
Double
Specifies the maximum value of the curve parameter.
The maxpar attribute is optional. When not specified, it defaults +1.
Note: When specified, minpar < maxpar.
Optional attributes: Available to all description methods.
id
Integer
Specifies the element identification number. This number must be unique among all the Surface objects in the model.
This attribute is optional. MotionSolve automatically creates an ID when one is not specified.
Range of values: id > 0
label
String
Specifies the name of the Surface object.
This attribute is optional. When not specified, MotionSolve will create a label for you.
closed
String
Select from "OPEN" or "CLOSED".
Note: For a closed curve, the first and last data points must be the same.
The type attribute is mandatory.
curve_points
Boolean
Select from TRUE or FALSE.
  • TRUE means that the curve passes through the points.
  • FALSE means that the curve (B-spline) stays close to the points, but does not pass through them in general.
When not specified, curve_points defaults to False.

Example

A cycloid is defined in parametric space as:
x = a * (t - sin(t))
y = a * (1-cos(t))
"t" is the independent parameter. The cycloid is shown in the image below.


Figure 1. A parametrically defined cycloid curve
  1. Define a parametric curve using a matrix.
    The statement defining the cycloid described above has the following curve attributes:
    • The Curve is open
    • The independent parameter t starts at zero
    • The independent parameter t ends at 5
    • The curve points are specified in the Matrix object mat23
    The corresponding MotionSolve Python specification is:
    # Note, since curve_points=True, MINPAR=-1 and MAXPAR=+1. 
    # This range in u will accommodate all the data provided in the matrix.
    curve1 = Curve (type="OPEN", curve_points=True, matrix=mat23)
  2. Define a parametric curve in a python function.
    This example shows how to specify exactly the same for implementation in a user-defined subroutine written in Python:
    # The cycloid function saved in file: cycloid.py
    from msolve import sin, cos
    def cycloid (id, par, npar, t, iord, iflag):
       a = par[0]  
       if iord == 0:
          x = a * (t - sin(t))
          y = a * (1 - cos(t))
          z = 0.0
       elif iord == 1:
          x = a * (1 - cos(t))
          y = a * sin(t)
          z = 0.0
       else:
          x = a * sin(t)
          y = a * cos(t)
          z = 0.0
       
       return [x, y, z]
    The corresponding MotionSolve Python specification is:
    curve2 = Curve(function="USER(1)", routine=cycloid, type="OPEN", minpar=0, maxpar=6)

Comments

  1. See Properties for an explanation about what properties are, why they are used, and how you can extend these.
  2. For a more detailed explanation about Curve, see Reference: ParamCurve.