Surface

Model ElementSurface defines a parametric surface element in 3D space.

Class Name

Surface

Description

A parametric surface is defined in terms of two free parameters: u and v. This means that the 3 coordinates (x,y,z) of any point P on the surface is a function of the two free parameters u and v. Surface has three methods.

Attribute Summary

Name Property Modifiable by command? Designable?
id Int ()   No
label Str () Yes
uclosed Bool (False) Yes
vclosed Bool (False) Yes
minpar Double ([-1, -1], count=2) Yes
maxpar Double ([ 1, 1], count=2) Yes
function Function ("SURSUB")  
routine Routine ()  

Usage

#1: Defined in a compiled user-written subroutine
Surface (function=userString, routine=string, optional_attributes)

#2: Defined in a Python script
Surface (function=userString, routine=functionPointer, optional_attributes)

Attributes

Defined 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.dll::mySurface"
  • "/staff/Altair/ engine.dll is the DLL.
  • "mySurface" is the function within this DLL that performs the calculations
The attribute routine is optional. When not specified, routine defaults to SURSUB.
Defined in a Python function
function
String
The list of parameters that are passed from the data file to the user defined Python function.
The function attribute is mandatory.
routine
Pointer to a callable function in Python.
An example is: routine=mySurface"
  • mySurface 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 SURSUB.
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.
uclosed
Boolean
If the surface is closed in the u parametric space, select True. If the surface is open in the u parametric space, select False.
The uclosed attribute is optional. When not specified, it defaults to False.
vclosed
Boolean
If the surface is closed in the u parametric space, select True. If the surface is open in the v parametric space, select False.
The vclosed attribute is optional. When not specified, it defaults to False
minpar
List of two Doubles.
Specifies the list of minimum value of u and v.
The minpar attribute is optional. When not specified, it defaults to [-1,-1].
Note: When specified, minpar < maxpar.
maxpar
List of two Doubles.
Specifies the list of maximum value of u and v.
The maxpar attribute is optional. When not specified, it defaults to [+1,+1]
Note: When specified, minpar < maxpar.

Example

Define a cylindrical surface in a user-subroutine.
#Define the surface in the function cylindricalSurface ()
from math importsin, cos, pi
def cylindricalSurface (id, par, npar, u, v, iord, iflag):

  values = []
  r      = par [0]

  if iord ==0:
    values.append (r * cos (u))   #  x
    values.append (r * sin (u))   #  y
    values.append (v)             #  z

  elifiord ==1:
   values.append (-r * sin (u))   # dx / du
   values.append ( r * cos (u))   # dy / du
   values.append (0.0)            # dz / du
   values.append (0.0)            # dx / dv
   values.append (0.0)# dy / dv
   values.append (1.0)# dz / dv

  elifiord ==2:
   values.append (-r * cos (u))   # d2x / du du
   values.append (-r * sin (u))   # d2y / du du
   values.append (0.0)            # d2z / du du
   values.append (0.0)            # d2x / du dv
   values.append (0.0)            # d2y / du dv
   values.append (0.0)            # d2z / du dv
   values.append (0.0)            # d2x / dv dv
   values.append (0.0)            # d2y / dv dv
   values.append (0.0)            # d2z / dv dv

  elif iord == 3:
   values.append ( r * sin (u))   # d3x / du du du
   values.append (-r * cos (u))   # d3y / du du du
   values.append (0.0)            # d3z / du du du
   values.append (0.0)            # d3x / du du dv
   values.append (0.0)            # d3y / du du dv
   values.append (0.0)            # d3z / du du dv
   values.append (0.0)            # d3x / du dv dv
   values.append (0.0)            # d3y / du dv dv
   values.append (0.0)            # d3z / du dv dv
   values.append (0.0)            # d3x / dv dv dv
   values.append (0.0)            # d3y / dv dv dv
   values.append (0.0)            # d3z / dv dv dv
  
  # Return the computed values
  return values

# Define the Surface and refer to the user-subroutine cylindricalSurface ()
mysurface = Surface (function="user (10)", routine=cylindricalSurface, uclosed=True, vclosed=False, minpar=[0, -150], maxpar=[2*pi, 150])

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 Surface, see Reference: Parametric Surface.