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
- function
- String
- routine
- String
- function
- String
- routine
- Pointer to a callable function in Python.
- id
- Integer
- label
- String
- uclosed
- Boolean
- vclosed
- Boolean
- minpar
- List of two Doubles.
- maxpar
- List of two Doubles.
Example
#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
- 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 Surface, see Reference: Parametric Surface.