Tutorial User Guide > Function Definitions Text File > Function Definitions File Example
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">   
Function Definitions File Example
The easiest way to learn the format of the Function Definitions file is to look at some examples. Following are entries taken from the automotive brake lever demonstration problem. A few entries are shown followed by explanations.
# PCL Function call definitions for the UI Module "Inputs Box".
# This definitions file is written for the example automotive 
# park brake lever case.
#
# open up a new database with an MSC/NASTRAN preference
# Modeling tolerance is set to 0.005
 *INPUTID = new_db_open_nastranpref
 *CLASS = AANAV
 *FUNCTION = openup_nastrandb
 *DBOX = STRING,Type: file name, 1
 *STATUSCHECK
 *DYNAMIC = AANAV.fil_wid
 *LOAD ITEM
#
Comment lines in the file are designated by a # character in column 1. The platform software will accept a STRING user input value from a single displayed databox and then construct and issue the following PCL call: AANAV.openup_nastrandb( inputstring ). The value of inputstring is passed to the function through the databox. Note that the *INPUTID index and the *FUNCTION name can be different. This allows the same function to be called in different ways with different defaults, etc.
The databox is displayed with a title reading: "Type: file name". The databox accepts a single STRING type input. Note that Multi-byte foreign language font characters are allowed only in the display labels listed for the input widgets.
When the function (openup_nastrandb in this example) is executed, a status check is made. The default success status is 0. The *STATUSCHECK flag signals the platform software to use the <dialog> tag attributes: quedlg, errordlg, or <returnerror> to display the next <dialog> after this function executes and control is returned to the drive page.
The *DYNAMIC flag signals the platform software to call the function AANAV.fil_wid() to return a default value to display in the databox widget. This feature allows the dynamic computation of default widget values. The author must write the 'fil_wid' function to provide the default values in a single string array, with one string for each widget. A blank entry in the array will indicate that the default value given in the *.def file for that widget should be used. The *DYNAMIC functionality will support all widget types.
The *LOAD ITEM line signals the end of this PCL call specification. It is a keyword used to indicate the end of the function call listing under a particular *INPUTID reference listing.
 
************************************************************************
This is an example case requiring use of the file widget.
#
# Read in a UG CAD file by the Direct Parasolids option
  *INPUTID = ugimport_method1
  *CLASS = AANAV
  *FUNCTION = ugimport_direct1
  *FILE=*.prt,File Filter Specification,Directories,Files,Selected File,Filter
  *STATUSCHECK
  *LOAD ITEM
#
************************************************************************
In this example, the databox widget accepts a single REAL value. The label which appears above the widget is "Type: Thickness". The fixed default value is 3.
#
# Read in a part thickness value input by the user. 
# Store it as a user response variable.
  *INPUTID = readthickness
  *CLASS = AANAV
  *FUNCTION = readthickness
  *DBOX =REAL,Type: Thickness,1,3.
  *STATUSCHECK
  *LOAD ITEM
#
************************************************************************
Two select databoxes are displayed for this function. Each one will accept a surface edge pick.
#
# Receive definitions of 2 particular brake lever edges and then
# perform automated 2D shell meshing and properties assignment.
  *INPUTID = lever_automesh
  *CLASS = AANAV
  *FUNCTION = lever_automesh
  *SDBOX =EDGE,1) Pick: Edge (Strut)
  *SDBOX =EDGE,2) Pick: Edge (Cable)
  *STATUSCHECK
  *LOAD ITEM
#
************************************************************************
In this example, one select databox for a node and three databoxes for REAL values are displayed. The three databoxes will have default values displayed. For novice users it is better to display separate boxes for the separate components rather than accept an input like -2200.,0.,0. in one single box.
#
# Apply a point load simulating the park brake lever cable attachment.
  *INPUTID = lever_cable_load
  *CLASS = AANAV
  *FUNCTION = lever_cable_load
  *SDBOX =NODE,Pick: Node Point to Load
  *DBOX =REAL,Type in: X Force,1,-2200.
  *DBOX =REAL,Type in: Y Force,1,0.
  *DBOX =REAL,Type in: Z Force,1,0.
  *STATUSCHECK
  *LOAD ITEM
************************************************************************