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
#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
- matrix
- Reference to an existing matrix object.
- xyz
- Nodes
- function
- String
- routine
- String
- minpar
- Double
- maxpar
- Double
- function
- String
- routine
- Callable function in Python or string.
- script
- Specifies the path and name of the user-written script that contains the function specified by routine.
- minpar
- Double
- maxpar
- Double
- id
- Integer
- label
- String
- closed
- String
- curve_points
- Boolean
Example
x = a * (t - sin(t))
y = a * (1-cos(t))
- 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)
- 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
- See Properties for an explanation about what properties are, why they are used, and how you can extend these.
- For a more detailed explanation about Curve, see Reference: ParamCurve.