HyperWorks Solvers

Curve

Curve

Previous topic Next topic No expanding text in this topic  

Curve

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

Model Element

Class Name

Curve

Description

Curve defines a parametric curve in 3D space.  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?

id    

Int ()

 

label

Str ()

 

matrix    

Reference ("Matrix")

curve_points

Bool ()

closed    

Bool ()

minpar    

Double (-1.0)

 

maxpar    

Double (1.0)

 

routine

Routine ()

 

script

Script ()

 

function  

Function ("CURSUB")

 

Usage

Curves are available in three different forms.

#1: Curve data provided in a Matrix

Curve (matrix=objMatrix, type=string, curve_points=Boolean, optional_attributes)

 

#2. Curve specified in a compiled user-written subroutine

Curve (function=userString, routine=string, type=string, optional_attributes)

 

#3. Curve specified in a Python function

Curve (function=userString, routine=functionPointer, type=string, curve_points=boolean, optional_attributes)

Attribute Description

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.

Note     For a closed curve, the first and last data points must be the same.

The matrix attribute is mandatory.

type

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.

The curve_points attribute is mandatory.

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.

The function attribute is mandatory

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.dllmyCurve

”/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.

The attribute routine is optional.

type

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.

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 subroutine.

The function attribute is mandatory

routine

Pointer to a callable function in Python.

An example is: routine=myCurve

myCurve is a Python function or method that can be called from wherever the model resides.

The attribute routine is optional.

When not specified, routine defaults to CURSUB.

type

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.

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 will automatically create 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.

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 the Comments in the XML syntax section

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.

curve_api_cycloid

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)