Professional Documents
Culture Documents
FUNCTION init()
WIDGET id
INTEGER i, status
REAL
REAL
REAL
STRING version[3]
STRING method_opt[NAME_LENGTH], method[NAME_LENGTH]
form_width = FORM_WID_SML
frame_width = form_width - FORM_L_MARGIN - FORM_R_MARGIN
f_width = frame_width - FRAME_L_MARGIN - @
FRAME_R_MARGIN - FRAME_2EDGE
half_space = INTER_WIDGET_SPACE/2.0
settings.pcl
p3prolog.pcl
p3midilog.pcl
p3epilog.pcl
.Patran.EventMaps
In a Nutshell...................................................................................................................................6
What is PCL?........................................................................................................................................................ 6
What can PCL be used for?................................................................................................................................ 7
How does PCL work?.......................................................................................................................................... 8
All you really need to know is on this page!...................................................................................................... 9
Documentation......................................................................................................................................................................9
PCL Expressions........................................................................................................................25
Expressions, Comments, Syntax Tips............................................................................................................. 25
Identifiers.....................................................................................................................................27
Naming Conventions......................................................................................................................................... 27
Variable / Function Scope................................................................................................................................. 28
01/22/17
2/252
For Loop............................................................................................................................................................. 41
While Loop.......................................................................................................................................................... 41
Repeat Loop....................................................................................................................................................... 42
BREAK................................................................................................................................................................ 43
CONTINUE.......................................................................................................................................................... 44
Exercise 6: p3epilog.pcl.............................................................................................................62
Debugging...................................................................................................................................63
Debugging Compile Errors............................................................................................................................... 63
Debugging Runtime Errors............................................................................................................................... 64
init() Function.........................................................................................................................................................77
The display() Function...............................................................................................................................................78
The
Widget Callbacks............................................................................................................................................... 81
What Are They?..................................................................................................................................................................81
What Are They Used For?..................................................................................................................................................82
MSC.Patran PCL Workshop Notes
01/22/17
3/252
Exercise 9: Callbacks.................................................................................................................95
Handling Errors and Messaging...............................................................................................97
Errors from Built-In Functions.......................................................................................................................... 97
Custom Error Messages.................................................................................................................................... 98
Using User Messages Database..........................................................................................................................................98
Without a Messages Database............................................................................................................................................99
Taking Advantage of the UNDO Feature........................................................................................................ 101
Select Mechanism.....................................................................................................................102
Select Mechanism GUI Mechanics................................................................................................................. 102
Select Databoxes, Select Frames, and Select Menus........................................................................................................102
GUI PCL Example............................................................................................................................................................104
List Processor.................................................................................................................................................. 105
List Processor Mechanics.................................................................................................................................................105
All You Really Need to Know..........................................................................................................................................106
Special Widgets.........................................................................................................................117
File Widget........................................................................................................................................................ 117
Spreadsheet Widget......................................................................................................................................... 120
Event Manager..........................................................................................................................124
MSC.Patran PCL Workshop Notes
01/22/17
4/252
General............................................................................................................................................................. 124
Functions.......................................................................................................................................................... 125
Example............................................................................................................................................................ 125
Primitive Graphics....................................................................................................................126
Graphic Objects............................................................................................................................................... 126
Graphic Segments........................................................................................................................................... 127
Example............................................................................................................................................................ 128
Another Example............................................................................................................................................. 129
Appendix B................................................................................................................................163
Strings & String Functions.............................................................................................................................. 163
Declaration....................................................................................................................................................... 164
Initialization...................................................................................................................................................... 164
String Comparisons......................................................................................................................................... 164
Functions.......................................................................................................................................................... 165
Appendix C................................................................................................................................173
Noteworthy Functions..................................................................................................................................... 173
sys_move_raw()........................................................................................................................................... 174
mth_array_search()...................................................................................................................................... 175
mth_sort()...................................................................................................................................................... 176
mth_sort_row()............................................................................................................................................. 177
mth_sort_column()....................................................................................................................................... 177
MSC.Patran PCL Workshop Notes
01/22/17
5/252
fem_geom_edge_length()............................................................................................................................ 178
fem_geom_face_area()................................................................................................................................. 178
fem_geom_elem_volume().......................................................................................................................... 178
fem_geom_elem_location()......................................................................................................................... 179
Appendix D................................................................................................................................180
Form Spacing Parameters (appforms.p)........................................................................................................ 180
*
SPACING.................................................................................................................................................. 181
Appendix E................................................................................................................................206
MSC.Patran Architecture................................................................................................................................. 206
Appendix F................................................................................................................................208
Shareware Compiling Functions.................................................................................................................... 208
Appendix G................................................................................................................................211
Parametric Patran............................................................................................................................................ 211
Appendix H................................................................................................................................217
Additional List Processor Notes..................................................................................................................... 217
List Processor Mechanics.................................................................................................................................................218
List Processor Functions...................................................................................................................................................219
List Processor Sublist Functions.......................................................................................................................................220
List Processor Attribute Functions...................................................................................................................................221
Miscellaneous List Processor Functions...........................................................................................................................222
List Processor Examples...................................................................................................................................................223
Easy to Use List Processor Functions...............................................................................................................................227
Appendix I..................................................................................................................................228
Key Mapping..................................................................................................................................................... 228
Appendix J.................................................................................................................................231
Widget Classification....................................................................................................................................... 231
Appendix K................................................................................................................................234
User Defined AOM............................................................................................................................................ 234
01/22/17
6/252
In a Nutshell
What is PCL?
01/22/17
7/252
In a Nutshell
01/22/17
8/252
In a Nutshell
You
MSC.Patran
PCL
C, C++
Fortran
Other
01/22/17
9/252
In a Nutshell
Programming Task
Documentation
Comments
Basic programming
List processor
Graphics
Database functions
Architecture
01/22/17
10/252
01/22/17
11/252
Entering Data
01/22/17
12/252
Session Files
01/22/17
13/252
Rebuilding Models
A.
B.
1.,
sgm_edit_surface_add_h_edit_ids )
$# 1 Surface Edited: Surface 1
$# Session file patran.ses.01 stopped recording at 16-Aug-01 14:34:52
A. Create/Surface/XYZ
B. Edit/Surface/Add Hole
01/22/17
14/252
4.,
sgm_edit_surface_add_h_edit_ids )
$# 1 Surface Edited: Surface 1
$# Session file patran.ses.01 stopped recording at 16-Aug-01 14:34:52
01/22/17
15/252
01/22/17
16/252
01/22/17
17/252
01/22/17
18/252
01/22/17
19/252
asm_create_patch_xy_created_ids )
$# 1 Patch created: Patch 1
STRING sgm_edit_surface_add_h_edit_ids[VIRTUAL]
sgm_edit_surface_add_hole( 1, `radius` , TRUE, "", "[5 5 0]", @
"", "Surface 1", sgm_edit_surface_add_h_edit_ids )
$# 1 Surface Edited: Surface 1
$# Session file patran.ses.01 stopped recording at 16-Aug-01 14:34:52
01/22/17
20/252
, @
/* x location */
FORM_X_LOC, @
/* y location */
FORM_Y_LOC, @
...
END FUNCTION /* init */
FUNCTION display()
ui_form_display(plate_hole)
END FUNCTION /* display
Hitting the*/Apply button executes the function: apply_button_cb()
FUNCTION apply_button_cb()
GLOBAL REAL radius
ui_wid_get(radius_dbox, VALUE, radius)
sf_play(plate_hole.ses)
END FUNCTION /* apply_button_cb */
END CLASS /* plate_hole */
01/22/17
21/252
2) Steps:
a) Create variables using MSC.Patrans command line
b) Create/Surface/XYZ (use variables length and width)
c) Edit/Surface/Add Hole (use x_center, y_center, and diameter)
01/22/17
22/252
Exercise 1
Below is an image showing an MSC.Patran form allowing the
interactive creation of the model for this exercise.
01/22/17
23/252
multiplication
string concatenation
//
logical or
||
logical equal
==
!=
i, j, status, NodeIds(1000)
flag
xyz(1000, 3), pressure(100), time
my_group[32], all_groups[32](100)
addition
node_ids(VIRTUAL)
groups[32](VIRTUAL), MyString[VIRTUAL]
01/22/17
24/252
01/22/17
25/252
PCL Expressions
Expressions, Comments, Syntax Tips
01/22/17
26/252
PCL Expressions
01/22/17
27/252
Identifiers
Naming Conventions
Valid identifiers
current_group
CurrentGroup
MyString
Invalid identifiers
a_very_very_very_very_very_very_very_very_long_name
95abc
list
01/22/17
28/252
Identifiers
01/22/17
29/252
01/22/17
30/252
FUNCTION a_very_simple_function()
/* This is a simple function that writes:
$# My favorite number is 29
in the MSC.Patran history window using 3 different
write or print statements.
*/
/* This is a comment. */
This is also a comment.
Comments (Who we
kidding? We all know
that everyone loathes
commenting their
code!)
Variable declaration
INTEGER MyFavoriteNumber
Variable initialization
MyFavoriteNumber = 29
ui_writec(My favorite number is %d \n, MyFavoriteNumber)
ui_writef(A21,1X,I3, My favorite number is, MyFavoriteNumber)
ui_write(My favorite number is //STR_FROM_INTEGER(MyFavoriteNumber))
END FUNCTION /* a_very_simple_function */
Statements or
expressions
Function terminator
01/22/17
31/252
Calling statement
another_simple_function(29)
FUNCTION another_simple_function(MyFavoriteNumber)
INTEGER MyFavoriteNumber
INTEGER MyLeastFavoriteNumber
MyLeastFavoriteNumber = 13
ui_write(My favorite number is //str_from_integer(MyFavoriteNumber))
ui_write(My least favorite number is // @
str_from_integer(MyLeastFavoriteNumber))
END FUNCTION /* another_simple_function */
Sample output
01/22/17
32/252
01/22/17
33/252
01/22/17
34/252
PCL Operators
Operators
+
Comments
**
Exponentiation
//
String concatenation
<
>
||
&&
+=
-=
<=
>=
==
!=
Relational operators
Logical or, logical and
Examples
Dist = mth_sqrt((x2-x1)**2 + (y2-y1)**2 + (z2-z1)**2)
MyString3 = MyString2//hijk
IF (a == b) THEN c = d
IF (a == b && a == c) THEN ui_write(Equilibrium)
x += 1
(this is equivalent to x = x + 1)
String comparisons
TEST
01/22/17
35/252
REAL
Single precision floating value between 1.0E-30 and
1.0E+30 (positive or negative)
REAL x, y, z, force, pressure
01/22/17
36/252
Variable Scope
GLOBAL
LOCAL
STATIC
CLASSWIDE
GLOBAL REAL a, b, c
FUNCTION FindElvis()
GLOBAL REAL
b
STATIC INTEGER c
FUNCTION WheresWaldo(x)
GLOBAL REAL a
REAL
c, d, e
INTEGER
x
CLASS training
CLASSWIDE REAL d, e
FUNCTION MyFunc(q, r)
INTEGER
f
GLOBAL REAL a, b, c
REAL
q, r
FUNCTION init()
INTEGER c, f, g
01/22/17
37/252
1
4
2
5
3
6
Array dimensions are inherited from the argument list, i.e., PCL
passes by reference
FUNCTION MyFunc()
STRING MyString[32](32)
YourFunc(MyString)
END FUNCTION
FUNCTION YourFunc(MyVal)
STRING MyVal[]()
END FUNCTION
Declaration Examples
REAL
STRING
INTEGER
LOGICAL
displacements(6, 200)
group_names[32](20)
ids(0:2, 0:4, 0:10)
exists(12)
01/22/17
38/252
Virtual arrays
01/22/17
39/252
i, j, status
num_nodes, node_ids()
num_db_nodes, db_node_ids(VIRTUAL)
found_node
01/22/17
40/252
Virtual strings
01/22/17
41/252
Syntax
FOR (var=numeric_expr TO
statements
END FOR
numeric_expr
[BY
Example
numeric_expr])
[label]
AvgTemp = 0.0
FOR (i = 1 TO NumNodes)
AvgTemp += NodalTemp(i)
END FOR
AvgTemp = AvgTemp/NumNodes
While Loop
Syntax
WHILE (logical_expression) [label]
statements
END WHILE
Example
AvgTemp = 0.0
i = 1
WHILE (i <= NumNodes)
AvgTemp += NodalTemp(i)
i += 1
END WHILE
AvgTemp = AvgTemp/NumNodes
01/22/17
42/252
Repeat Loop
This is similar to a WHILE Loop except that it will always be
executed at least once. Only use REPEAT loops if you want to
ALWAYS execute the loop at least once, otherwise us a WHILE
loop.
Syntax
REPEAT [label]
statements
UNTIL (logical_expression)
Example
AvgTemp = 0.0
i = 1
REPEAT
AvgTemp += NodalTemp(i)
i += 1
UNTIL (i > NumNodes)
AvgTemp = AvgTemp/NumNodes
01/22/17
43/252
BREAK
The BREAK statement is used to exit a loop prior to its normal
termination. It can be used in any of the loop statements.
Syntax
BREAK [label]
(status
(status
(status
(status
!=
!=
!=
!=
0)
0)
0)
0)
THEN
THEN
THEN
THEN
BREAK MainLoop
BREAK AnotherLoop
BREAK
BREAK InnerLoop
END WHILE
statements
END WHILE
statements
END WHILE
statements
01/22/17
44/252
CONTINUE
The CONTINUE statement is used to skip to the end of the loop
Syntax
CONTINUE [label]
01/22/17
45/252
x-coordinate
y-coordinate
z-coordinate
Declare variables
b)
c)
Allocate arrays
d)
e)
f)
Open file
g)
h)
Close file
i)
01/22/17
46/252
Writing Files
Extra credit: Include a header line at the top of the file that
includes the filename and the total number of nodes
written to the file.
01/22/17
47/252
2) Use the data in the file to create nodes with the following builtin function from the PCL Reference Manual:
fem_create_nodes_1(RefCIDList, AnalysisCIDList, GeomFlag, @
NodeIDList, XYZList, NodesCreatedList)
01/22/17
48/252
Syntax
IF (logical_expression) THEN
statements
ELSE IF (logical_expression) THEN
statements
ELSE
statements
END IF
Example
IF (MyKeyWord == CBAR || MyKeyWord == CBEAM) THEN
statements
ELSE IF (MyKeyWord == CTRIA || MyKeyWord == CQUAD) THEN
statements
ELSE IF (MyKeyWord == GRID) THEN
statements
ELSE
statements
END IF
01/22/17
49/252
SWITCH Statement
This is often used in place of an IF statement when many
comparisons will be made.
Syntax
SWITCH (expression) [label]
CASE (expression1, expression2, )
statements
CASE (expression3, expression 4, )
statements
DEFAULT
statements
END SWITCH
Example
SWITCH (EntityType)
CASE (CBAR, CBEAM)
statements
CASE (CTRIA, CQUAD)
statements
CASE (GRID)
statements
DEFAULT
statements
END SWITCH
01/22/17
50/252
calling_function()
$#NumIn = 5.0
$#NumOut = 8.14
$#Var2 = 8.14
Calling statement
Sample output
01/22/17
51/252
REAL MyVal
REAL a(3) = [1.0, 1.0, 2.0]
REAL b(3)
Variable declaration
and initialization
b(1) = 2.0
b(2) = 2.0
b(3) = 1.0
MyVal = DotProduct(a, b)
ui_write(Dot product = //STR_FROM_REAL(MyVal))
END FUNCTION /* calling_subroutine2 */
All variables must be declared, including
function arguments. Note the use of dummy
parentheses to indicate that the argument is
an array. The array dimensions within the
function DotProduct is inherited (3 in this
case) from the array dimensions within the
calling function (calling_subroutine2 in
this case).
FUNCTION DotProduct(a, b)
REAL a(), b()
REAL val
Calling statement
calling_subroutine2()
$#Dot product = 6.0
Sample output
01/22/17
52/252
FUNCTION calling_subroutine3()
INTEGER status
REAL NumIn, NumOut
status = MySqrt(NumIn, NumOut)
IF (status == 0) THEN
ui_write(The square root of //STR_FROM_REAL(NumIn)// is //@
STR_FROM_REAL(NumOut))
ELSE
ui_write(STR_FROM_REAL(NumIn)// does not have a square root!)
END IF
RETURN status
END FUNCTION /* calling_subroutine3 */
01/22/17
53/252
Day 2
01/22/17
54/252
Example usage
!!INPUT was typed at the command line
The file (test.pcl) contained a FUNCTION statement. Therefore, MSC.Patran compiled the statements
between the FUNCTION statement and the END FUNCTION statement.
$# Compiling: test
$# Compiled: test
01/22/17
55/252
Typically, the filename will have a .pcl extension and the PCL
library file will have a .plb extension. If you do not specify a
library file, MSC.Patran will compile the filename into a library
file with the same name as the input file and a .plb extension.
Example usage
01/22/17
56/252
Example usage
01/22/17
57/252
!!PATH /abc
/def
!!PATH
/hij
!!PATH /klm
In this example, /klm would be searched for files first, /abc next,
/def next, and /hij last.
01/22/17
58/252
01/22/17
59/252
01/22/17
60/252
Must use the !!TRACE LINES directive to see the line numbers
as the PCL function executes.
!!DEBUG [ON, OFF]
01/22/17
61/252
Start Up Files
Once the PCL functions have been compiled, it is best to use
MSC.Patran startup files (p3prolog.pcl, p3midilog.pcl,
p3epilog.pcl) to automatically link your library each time you
start MSC.Patran.!
The contents of these files are usually very simple and often
just contain a few !!PATH and !!LIB directives.
$ Sample p3epilog.pcl file
!!PATH /msc/patran_common
!!PATH ~/patran_pcl, ~/patran_pcl/plb, ~/patran_pcl/icons
!!LIB MyFunctions.plb
!!LIB YourFunctions.plb
01/22/17
62/252
Exercise 6: p3epilog.pcl
Compile all of the previous 3 PCL functions:
a) Exercise 2: Hello World
b) Exercise 4: Writing Files
c) Exercise 5: Reading Files
into a PCL library called pat304.plb. Create a p3epilog.pcl or
p3patran.pcl file in you home directory to automatically link this
PCL library with the MSC.Patran session.
1) The p3epilog.pcl (or p3patran.pcl) file should be in either your
home directory/folder or the current directory/folder.
2) The pat304.plb file can be in any directory/folder. If it is not in
your current or home directory/folder, you will need to include
the path in your p3epilog.pcl/p3patran.pcl file as either:
a)!!lib /some/other/location/pat304.plb
b) !!path /some/other/location
!!lib pat304.plb
3) Be sure to compile all subsequent PCL functions into this
library as well.
01/22/17
63/252
Debugging
Debugging Compile Errors
Compiling: msc_explore_xyplot_tic_mark.display
Type of ERROR
Compiled: msc_explore_xyplot_tic_mark.display
Compiling: msc_explore_xyplot_tic_mark.refresh
Location of ERROR
***Error: (PCL) Undeclared variable: SVALUE
***
File: msc_explore_xyplot_tic_mark.pcl, Line: 204
***
Line is "
svalue = FALSE"
Offending line
***Error: Compilation aborted
Compiling: msc_explore_xyplot_tic_mark.refresh_ps
Compiled: msc_explore_xyplot_tic_mark.refresh_ps
===(PCL) Variable is declared but is not used: REALTICS
Compiling: msc_explore_xyplot_tic_mark.colorbox_select
Note: For these types of errors, the actual problem may be well above
the called out line number.
01/22/17
64/252
Debugging
$# INTEGER j = 9
$# INTEGER a(3) = [1, 2, 3]
01/22/17
65/252
Debugging
Call traceback...
Function UI_ITEM_DELETEALL
Function MSC_EXPLORE.REFRESH, Line Number 294
Function MSC_EXPLORE.DISPLAY, Line Number 269
Function UI_EXEC_FUNCTION
Function MSC_EXPLORE_XYPLOT_DISP_GRAPH.LEGEND_CB, Line Number 694
This can be used to find the line where the error occurred, but
there is no information about what the error is. In this example,
the error occurred with the built in function UI_ITEM_DELETEALL
on line 294 in function MSC_EXPLORE.REFRESH().
The line starts with a single ! and any variable between the
` marks are evaluated.
01/22/17
66/252
My_function(radius, sind(90))
REAL radius
radius = 2.5
My_function(radius, sind(90))
MSC.Patran PCL Workshop Notes
01/22/17
67/252
01/22/17
68/252
FUNCTION max_pressure(x,y,z,t)
REAL x,y,z,t
REAL pressure
Pressure = x y*2 + z**3 - .1783
Pressure = t * pressure
RETURN pressure
END FUNCTION
01/22/17
69/252
01/22/17
70/252
Application
asm_ or sgm_
Geometry
fem_ or mesh_
Finite Elements
loadsbcs_
Loads/BCs
res_
Results
insight_
Insight
xy_
XY Plot
list_
Tools/List
ga_
pref_
Preferences
mat_ material_
Materials
fields_
Fields
loadcase_
Loadcases
elementprops_
Element Properties
01/22/17
71/252
Operations
db_
file_
fio_, io_,
virtual_,
record,
text_,
stream_
gm_
str_
mth_
math functions
sys_
lp_, app_,
fem_u_
ui_
Note: Not all categories are covered here and some functions do
not follow the conventions.
Which function do I
use?
Aaaarrgghhhh!
Relief is in sight!
01/22/17
72/252
01/22/17
73/252
Declare variables
b)
c)
d)
e)
Use the element topology codes to get the element shape codes
f)
g)
LOOP: If an elements shape code matches the selected shape code then add it
to the group
01/22/17
74/252
01/22/17
75/252
Only one class should be defined per file and the file name
should match the class name.
01/22/17
76/252
PCL Widgets
Based on Motif Xlib and Xtlib intrinsics (UNIX) and Windows GUI (NT).
Menu Label:
Menu item
Menu Label:
Menu item
Databox Label
Button 1
Button 2
01/22/17
77/252
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
01/22/17
78/252
Once the display() function is called it will display the form and
all widgets that are currently visible.
It is also used to hide and display widgets that are not always
visible:
IF (flag_advanced == TRUE) THEN
ui_wid_set(frame_advanced, DISPLAY, TRUE)
END IF
01/22/17
79/252
01/22/17
80/252
Widget Heirarchy
"",
FORM_X_LOC,
FORM_Y_LOC,
"UL",
FORM_WID_SML,
FORM_HGT_QTR,
"Form Label",
"")
my_button = ui_button_create(
/* parent
*/ main_form,
/* callback
*/ "my_button_cb",
/* x position */ FORM_L_MARGIN,
/* y position */ y_location,
@
@
@
@
@
@
@
@
@
@
@
@
)
All widgets could be children of the form, but widgets can also
be children of other widgets.
my_frame
= ui_frame_create(
/* parent
*/
/* callback
*/
/* x position */
/* y position */
/* width
*/
@
main_form,
@
,
@
x_loc,
@
y_loc,
@
FORM_WID_SML, )
inner_button = ui_button_create(
/* parent
*/ my_frame,
/* callback
*/ "inner_button_cb",
/* x position */ FRAME_L_MARGIN,
/* y position */ y_loc,
/* width
*/ BUTTON_WID_FULL,
/* height
*/ BUTTON_HGT,
)
@
@
@
@
@
@
01/22/17
81/252
Widget Callbacks
What Are They?
@
@
@
@
@
@
01/22/17
82/252
Callbacks are NOT required and most of the time they are not
used. When no immediate action is required, put an empty
string () for the callback name.
01/22/17
83/252
Data Type
button
No arguments passed
buttonicon
No arguments passed
cascadeitem
colorbar
form
frame
graph
item
itemicon
label
labelicon
colormenu
databox
file
Widget
Integer
Integer
Widget
Integer
Integer
String[]
String[]
String[]
listbox
Integer
String[]()
menu
menubar
String[]
modalform
optionmenu
scrollframe
String[]
selectdatabox
String[]
selectframe
separator
slidebar
spreadsheet
switch
Real
String[]
String[]
Integer
Integer
Integer
Integer
String[]
String[]
ON or OFF
Does not register events
Logical
Logical
text
toggle
toggleicon
01/22/17
85/252
Widget Placement
FORM_T_MARGIN
FRAME_LABEL_HGT
FRAME_1EDGE
FRAME_T_MARGIN
OPT_MENU_HGT
INTER_WIDGET_SPACE
OPT_MENU_HGT
FORM LABEL
Frame Label
Menu Label:
Menu item
Menu Label:
Menu item
FRAME_B_MARGIN
FRAME_1EDGE
INTER_WIDGET_SPACE
DBOX_HGT_LABOVE
Databox Label
INTER_WIDGET_SPACE
BUTTON_HGT
FORM_B_MARGIN
Button 1
FORM_L_MARGIN
Button 2
FORM_R_MARGIN
01/22/17
86/252
my_frame,
"",
FORM_L_MARGIN,
y_loc,)
@
@
@
@
@
@
@
@
@
@
01/22/17
87/252
Widget Variables
@
main_form,
@
,
@
x_loc,
@
y_loc,
@
"FORM_WID_SML, )
@
@
@
@
@
@
01/22/17
88/252
01/22/17
89/252
Modifying Widgets
01/22/17
90/252
Usually widget data is retrieved after the user hits the Apply
button on the form. The Apply button references a callback
function, typically called apply_cb(), that contains the
ui_wid_get() function calls. Once the data is gathered, action
can be taken to reflect the user input, such as, updating the
element display to reflect the new shrink factor.
01/22/17
91/252
END FUNCTION
01/22/17
92/252
y_loc
main_form = ui_form_create(
/* callback
*/
/* x position */
/* y position */
/* relative to */
/* width
*/
/* height
*/
/* label
*/
/* unused
*/
@
@
@
@
@
@
@
@
"",
FORM_X_LOC,
FORM_Y_LOC,
"UL",
FORM_WID_SML,
0,
"Form Label",
"")
y_loc = FORM_T_MARGIN
my_dbox = ui_databox_create(
/* parent
/* callback
/* x position
/* y position
/* label length
/* box length
/* label
/* value
/* label above
/* datatype
/* number of values
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
*/
main_form,
"",
FORM_L_MARGIN,
y_loc,
0,
DBOX_WID_SINGLE,
"Enter a Value",
"",
TRUE,
"REAL",
1)
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
01/22/17
93/252
@
@
@
@
@
@
@
@
@
FUNCTION cancel_btn_cb()
ui_form_hide("first_class")
END FUNCTION /* cancel_btn_cb */
END CLASS /* first_class */
01/22/17
94/252
01/22/17
95/252
Day 3
Only PCL programs that build forms need these constants and
therefore need to run this program.
01/22/17
96/252
Make Files
Make files will automatically run cpp and then compile the PCL
into a library.
01/22/17
97/252
01/22/17
98/252
Exercise 9: Callbacks
Write a PCL function that creates a form with 3 toggles and 2
databoxes that accept football scores. Hitting the Apply button
writes the scores to the session file.
1) Only 1 toggle should be selected at a time. That is, selecting
one toggle should deselect any other toggle that is selected.
2) The toggles should be in a frame.
3) Selecting a particular toggle should update the team names
(labels) on the databoxes.
4) Built-in functions:
ui_form_create(callback, x_loc, y_loc, position, width, height, label, iconname)
ui_frame_create(parent, callback, x_loc, y_loc, width, height, label)
ui_toggle_create(parent, callback, x_loc, y_loc, label)
ui_databox_create(parent, callback, x_loc, y_loc, label_length, box_length, @
label, value, label_above, datatype, num_vals)
ui_button_create(parent, callback, x_loc, y_loc, width, height, label, flag, @
highlight)
ui_separator_create(parent, callback, x_loc, y_loc, width, horizontal_flag)
ui_wid_set(widget, parameter, value)
01/22/17
99/252
Exercise 9
FORM_X_LOC, FORM_Y_LOC
01/22/17
100/252
0, 0.,"")
RETURN -1
END IF
01/22/17
101/252
Message
Error reported in application Tools.write_nodes by application FEM_TOOLS3
OK
01/22/17
102/252
status = db_count_elems(num_elms)
IF (status != 0) THEN
msg_to_form(status, 4, appcode(status), 0, 0., )
RETURN -1
END IF
IF (num_elems == 0) THEN
user_message(Warn, 0, My PCL, No elements in the database!)
RETURN 0
END IF
Message
Warning reported in application My PCL
01/22/17
103/252
IF (file_exists(fname, )) THEN
status = user_message(C_YN, 0, PCL: Field Tool, @
Selected file already exists! Overwrite?)
IF (status != 1) THEN RETURN -1
file_delete(fname)
END IF
01/22/17
104/252
VALUE, node_list)
ui_wid_get(force_dbox,
VALUE, force_val)
ui_wid_get(lbc_name_dbox, VALUE, lbc_name)
uil_db_commit(Create force at nodes)
status = CreateForceAtNodes(lbc_name, force_val, node_list)
IF (status != 0) THEN
uil_db_undo()
END IF
END FUNCTION
01/22/17
105/252
Select Mechanism
PCL offers a set of widgets and functions to enable the selection of
entities from the Viewport. These tools are typically referred to
collectively as the MSC.Patran Select Mechanism. The Select
Mechanism includes the use of Select Frame, Select Databox widgets,
and MSC.Patrans List processor PCL calls.
01/22/17
106/252
Select Mechanism
b)
01/22/17
107/252
Select Mechanism
GUI PCL Example
sframe_id = ui_selectframe_create
/* parent
*/
/* callback
*/
/* Left_margin
*/
/* Y Location
*/
/* col_width
*/
/* height
*/
/* Label
*/
/* recycle
*/
(
@
form_id,
@
"apply_cb",
@
FORM_L_MARGIN,
@
yloc,
@
SFRAME_WID_SINGLE,
@
SFRAME_1SDB_HGT_LABOVE,@
Auto Execute,
@
TRUE )
@
@
@
@
@
@
@
@
@
@
@
Select Frame
Select Databox
01/22/17
108/252
Select Mechanism
List Processor
List Processor Mechanics
01/22/17
109/252
Select Mechanism
01/22/17
110/252
Select Mechanism
Usage: fem_u_count_id_list()
num_ids = fem_u_count_id_list(sublist_type, picklist, @
do_message, status)
INPUT:
sublist_type
picklist
do_message
status
INTEGER
STRING
LOGICAL
INTEGER
OUTPUT:
num_ids
INTEGER
Usage: fem_u_get_id_list()
fem_u_get_id_list(sublist_type, picklist, num_ids, @
do_message, ids)
Argument definitions are similar to above
01/22/17
111/252
Select Mechanism
Example
FUNCTION apply_cb()
INTEGER status
STRING node_list[VIRTUAL]
ui_wid_get_vstring(node_sdbox, VALUE, node_list)
status = do_something_spectacular(node_list)
END FUNCTION /* apply_cb */
FUNCTION do_something_spectacular(node_list)
INTEGER status
INTEGER num_nodes, node_ids(VIRTUAL)
STRING node_list[]
num_nodes = fem_u_count_id_list(LP_SUBLIST_NODE, @
node_list, FALSE, status)
IF (num_nodes == 0) THEN RETURN (-1)
sys_allocate_array(node_ids, 1, num_nodes)
fem_u_get_id_list(LP_SUBLIST_NODE, node_list, @
num_nodes, FALSE, node_ids)
RETURN (0)
END FUNCTION /* do_something_spectacular */
01/22/17
112/252
01/22/17
113/252
01/22/17
114/252
Day 4
Description
Code Example
stat = utl_process_spawn( read_results.exe, TRUE )
IF( utl_process_error( stat ) ) THEN
utl_display_process_error( stat, 3 )
END IF
01/22/17
115/252
External Processes
01/22/17
116/252
External Processes
Locking a database
01/22/17
117/252
External Processes
01/22/17
118/252
External Processes
FUNCTION my_spawn()
INTEGER status
status = db_commit_raw()
status = utl_process_spawn ( process arg1, TRUE )
IF ( utl_process_error ( status ) ) THEN
utl_display_process_error( status, 3 )
END IF
status = db_start_transaction_raw()
END FUNCTION
01/22/17
119/252
External Process
01/22/17
120/252
Special Widgets
A number of specialized widgets exist in MSC.Patran. These
widgets are for often-used operations or to perform specialized
tasks. Two such widgets are the File widget and the Spreadsheet
widget.
File Widget
01/22/17
121/252
Special Widgets
@
form_id,
@
"file_cb",
@
FORM_L_MARGIN,
@
FORM_T_MARGIN,
@
FILE_WID_DOUBLE, @
6,
@
"Filter",
@
"*.db",
@
"Directories",
@
"Database List", @
"Existing Database Name",@
"",
@
"OK",
@
"Filter",
@
"Cancel")
(filter label)
(filter mask)
(directory label)
(files label)
(selection label)
(default selection)
(ok button label)
01/22/17
122/252
Special Widgets
01/22/17
123/252
Special Widgets
Spreadsheet Widget
01/22/17
124/252
01/22/17
125/252
One way to add help to your PCL is to create your own form
which contains a text widget (ui_text_create).
FUNCTION description_cb()
shareware_help.set_alltext(Aero Preference, @
PURPOSE:\n//@
For comments/remarks, send an email to:\n//@
elvis.mscsoftware.com)
END FUNCTION
01/22/17
126/252
Percent Complete
Functions
Example
FUNCTION calc_elm_normals(num_elms, elm_ids, normal_vec)
INTEGER i, num_elms, elm_ids()
REAL
normal_vec()
STRING msg[80]
msg = Processing //str_from_integer(num_elms)// elements
uil_pcntcomplete.initlz(msg)
FOR (i = 1 to num_elms)
/* functions that calculate element normals */
uil_pcntcomplete.update(i*100.0/num_elms)
END FOR
uil_pcntcomplete.close()
RETURN (0)
END FUNCTION /* calc_elm_normals */
01/22/17
127/252
Event Manager
General
Controls heartbeat
01/22/17
128/252
Event Manager
Functions
Example
FOR (i = 1 to num_elms)
IF (!em_proceed_normal()) THEN RETURN (-1)
/* statements that do something */
END FOR
01/22/17
129/252
Primitive Graphics
Graphic Objects
01/22/17
130/252
Primitive Graphics
Graphic Segments
01/22/17
131/252
Primitive Graphics
Example
INTEGER SegmentId
gm_segment_create(SegmentId)
gm_draw_line(SegmentId,
gm_draw_line(SegmentId,
gm_draw_line(SegmentId,
gm_draw_line(SegmentId,
5,
5,
5,
5,
[0
[1
[1
[0
0
0
1
1
0],
0],
0],
0],
[1
[1
[0
[0
0
1
1
0
0])
0])
0])
0])
Very primitive
graphics
01/22/17
132/252
Primitive Graphics
Another Example
FUNCTION Draw2DBox(ColorId, UpperLeft, LowerRight, SegmentId)
/*
Input
Output
*/
ColorId
UpperLeft(2)
LowerRight(2)
SegmentId
<return value>
INTEGER
REAL
REAL
INTEGER
INTEGER
UpperLeft(), LowerRight()
BoxCorners(4, 3)
status = gm_segment_create(SegmentId)
IF (status != 0) THEN RETURN status
status = gm_draw_line(SegmentId, ColorId,
IF (status != 0) THEN RETURN status
status = gm_draw_line(SegmentId, ColorId,
IF (status != 0) THEN RETURN status
status = gm_draw_line(SegmentId, ColorId,
IF (status != 0) THEN RETURN status
status = gm_draw_line(SegmentId, ColorId,
IF (status != 0) THEN RETURN status
01/22/17
133/252
status = gm_segment_flush()
IF (status != 0) THEN RETURN status
RETURN 0
END FUNCTION /* Draw2DBox */
01/22/17
134/252
b)
Be sure to:
1)
2)
3)
gm_segment_create()
b)
c)
gm_segment_flush()
d)
gm_segment_delete()
01/22/17
135/252
MSC.Patran Customization
Adding Utility Programs to the Main Menu
01/22/17
136/252
MSC.Patran Customization
Example
CLASS my_pulldown_menu
CLASSWIDE WIDGET user_menu
FUNCTION init()
WIDGET menubar
menubar = uil_primary.get_menubar_id()
user_menu = ui_menu_create(menubar, user_menu_cb, My_Menu)
ui_item_create(user_menu,
ui_item_create(user_menu,
ui_item_create(user_menu,
ui_item_create(user_menu,
ui_item_create(user_menu,
ui_item_create(user_menu,
hello_world,
dump_nodes,
,
push_me,
football,
group_by_shape,
Hello World!,
Write Nodal Data,
,
Push Me ,
Football Scores ,
Group Elms By Shape ,
FALSE)
FALSE)
FALSE)
FALSE)
FALSE)
FALSE)
FUNCTION display()
/* Dummy display function. The display function is not really necessary
since the menubar is automatically displayed by MSC.Patran. */
END FUNCTION /* display */
FUNCTION user_menu_cb(item)
STRING item[]
SWITCH (item)
CASE (hello_world)
hello_world()
CASE (dump_nodes)
DumpNodes(MyFile.dat)
CASE (push_me)
ui_exec_function(push_me_form, display)
CASE (football)
ui_exec_function(football_scores, display)
CASE (group_by_shape)
ui_exec_function(group_elms_by_shape, display)
END SWITCH
END FUNCTION /* user_menu_cb */
MSC.Patran PCL Workshop Notes
01/22/17
137/252
01/22/17
138/252
MSC.Patran Customization
Example: p3_user_menu.my_menu.def
*MENU LABEL = My_Menu
*CLASS
= -NA*FUNCTION = hello_world
*LABEL
= Hello World!
*LOAD ITEM
Menu label
*SEPARATOR
*CLASS
= push_me_form
*FUNCTION = display
*LABEL
= Push Me
*LOAD ITEM
*CLASS
= football_scores
*FUNCTION = display
*LABEL
= Football Scores
*LOAD ITEM
*CLASS
= group_elms_by_shape
*FUNCTION = display
*LABEL
= Group Elms By Shape
*LOAD ITEM
01/22/17
140/252
MSC.Patran Customization
MSC.Patran looks for this file first in your home directory and
then in the MSC.Patran installation directory.
The file format is very similar to the format used for the
p3_user_menu.def file.
*ICON = tbrotatexy.28.icon
*CLASS = uil_toolbar
*FUNCTION = rotate_xy
*HELP = Mouse rotate XY
*LOAD ITEM
*ICON = tbploterase.icon
*CLASS =
*FUNCTION = tbd(uil_imaging_plot_erase)
*HELP = Plot/Erase form (Display menu)
*LOAD ITEM
01/22/17
141/252
MSC.Patran Customization
For UNIX (i.e., Motif), the icons are in xbm format. For NT, the
icons can be in either xbm format or bmp format (bitmap).
On UNIX, the icons must be black and white. On NT, the icons
can be color if the bmp format is used.
01/22/17
142/252
MSC.Patran Customization
01/22/17
143/252
b)
c)
*CLASS
d)
*FUNCTION
e)
*LABEL
f)
*END FUNCTION
*CASCADE MENU
b)
*CASCADE END
c)
*SEPARATOR
01/22/17
144/252
2)
3)
4)
If the icon file is not in your home directory, you will need to
create a p3midilog.pcl file that contains:
!!PATH /my/path/to/the/icons
5)
01/22/17
145/252
CLASS pat304_toolbar_view
CLASSWIDE LOGICAL flag
FUNCTION toggle_view()
/* these represent rotations in degrees */
REAL rot_x, rot_y, rot_z
IF (flag) THEN
/* aircraft front view */
rot_x = -90.0
rot_y =
0.0
rot_z = 90.0
ELSE
/* aircraft rhs view */
rot_x = -90.0
rot_y =
0.0
rot_z = 180.0
END IF
>
01/22/17
146/252
01/22/17
147/252
01/22/17
148/252
i, j, status
num_bars, bar_ids()
elm_connect(1, 2)
rcids(1), acids(1)
REAL
REAL
REAL
bar_len()
xyz(2, 3)
sum
FOR (i = 1 to num_bars)
status = db_get_node_for_elems(1, 2, bar_ids(i:i), elm_connect)
IF (status != 0) THEN RETURN (status)
status = db_get_nodes(2, elm_connect(1, 1:2), rcids, acids, xyz)
IF (status != 0) THEN RETURN (status)
sum = 0.0
FOR (j = 1 to 3)
sum += (xyz(2, j) xyz(1, j))**2
END FOR
IF (sum > 0.0) THEN
bar_len(i) = mth_sqrt(sum)
ELSE
bar_len(i) = 0.0
END IF
END FOR
RETURN (0)
END FUNCTION
01/22/17
149/252
REAL
REAL
REAL
bar_len()
xyz(VIRTUAL)
sum
sys_allocate_array(elm_connect, 1, num_bars, 1, 2)
status = db_get_node_for_elems(num_nodes, 2, bar_ids, elm_connect)
IF (status != 0) THEN RETURN (status)
sys_allocate_array(node_ids, 1, 2*num_bars)
sys_move_raw(elm_connect, node_ids)
mth_sort(node_ids, TRUE, num_nodes)
sys_reallocate_array(node_ids, 1, num_nodes)
sys_allocate_array(idum, 1, num_nodes)
sys_allocate_array(xyz, 1, num_nodes, 1, 3)
status = db_get_nodes(num_nodes, node_ids, idum, idum, xyz)
IF (status != 0) THEN RETURN (status)
FOR (i = 1 to num_bars)
p1 = mth_array_search(node_ids, elm_connect(i, 1), TRUE)
p2 = mth_array_search(node_ids, elm_connect(i, 2), TRUE)
sum = 0.0
FOR (j = 1 to 3)
sum += (xyz(p2, j) xyz(p1, j))**2
END FOR
01/22/17
150/252
01/22/17
151/252
Appendix A
Built-in Function Examples
01/22/17
152/252
Appendix A
This function gets nodal coordinate frames and coordinates for the
requested nodes.
Input
INTEGER
num_nodes
INTEGER ARRAY
node_ids(num_nodes)
INTEGER ARRAY
rcids(num_nodes)
INTEGER ARRAY
acids(num_nodes)
REAL ARRAY
global_xyz(num_nodes, 3)
INTEGER
<return value>
Output
num_nodes
*node_ids
*rcids
*acids
*global_xyz
01/22/17
153/252
Appendix A
RCID
AC
ACID
0.00
0.00
0.00
5.12
-6.34
4.90
25
56.20
9.01
-1.10
01/22/17
154/252
Appendix A
Elm Shape
Shape Code
Elm Shape
Shape Code
Point
Tet
Bar
Pyramid
NA
01/22/17
155/252
Tria
Wedge
Quad
Hex
01/22/17
156/252
Appendix A
01/22/17
157/252
Appendix A
1,
1,
1,
1,
NumElms)
NumElms)
NumElms)
NumElms)
db_get_elem_ids(NumElms, ElmIds)
db_get_elem_etop(NumElms, ElmIds, ElmTopoCodes)
db_get_elem_topology_data(NumElms, ElmTopoCodes, ElmShapeCodes, @
NumNodesPerElm)
sys_free_array(ElmTopoCodes)
sys_free_array(ElmShapeCodes)
mth_sort(NumNodesPerElm, FALSE, NumElms)
MaxNodesPerElm = NumNodesPerElm(NumElms)
sys_free_array(NumNodesPerElm)
sys_allocate_array(ElmConnect, 1, NumElms, 1, MaxNodesPerElm)
db_get_nodes_for_elems(NumElms, MaxNodesPerElm, ElmIds, @
ElmConnect)
01/22/17
158/252
Appendix A
i
NumElms, ElmIds()
NumRegions, RegionIds(VIRTUAL)
MyRegionId
LOGICAL match
STRING
STRING
MyPropertySetName[]
RegionNames[32](VIRTUAL)
db_count_region_ids(NumRegions)
sys_allocate_array(RegionNames, 1, NumRegions)
sys_allocate_array(RegionIds,
1, NumRegions)
db_get_region_ids_and_names(NumRegions, RegionIds, RegionNames)
match = FALSE
FOR (i = 1 to NumRegions)
IF (str_equal(MyPropertySetName, RegionNames(i))) THEN
match = TRUE
MyRegionId = RegionIds(i)
BREAK
END IF
END FOR
sys_free_array(RegionIds)
sys_free_array(RegionNames)
IF (!match) THEN RETURN 1
db_count_elements_in_region(MyRegionId, NumElms)
IF (NumElms == 0) THEN RETURN 1
sys_allocate_array(ElmIds, 1, NumElms)
MSC.Patran PCL Workshop Notes
01/22/17
159/252
01/22/17
160/252
Appendix A
p
ElmId
ElmIds(1), ElmRegionIds(1)
MaterialId, DataType, IntegerVal, CoordId, NodeId, FieldId
ElmThick, ThickVals(VIRTUAL)
RealVals(3)
CharVal[80]
ElmIds(1) = ElmId
db_get_region_for_elements(1, ElmIds, ElmRegionIds)
db_count_prop(ElmRegionIds, NumWords)
IF (NumWords == 0) THEN RETURN 1
sys_allocate_array(WordIds, 1, NumWords)
db_get_props_by_region(NumWords, ElmRegionIds, WordIds)
p = mth_array_search(WordIds, 36, FALSE)
IF (p == 0) THEN RETURN 1
db_get_prop_value(ElmRegionIds(1), 36, MaterialId, DataType, @
IntegerVal, RealVals, CharVal, CoordId, NodeId, FieldId)
IF (DataType == 1) THEN /* real scalar at elm centroid */
ElmThick = RealVals(1)
ELSE IF (DataType == -1) THEN /* real scalar field at elm centroid */
MyFunc_EvalScalarFieldCentroid(ElmId, FieldId, ElmThick)
ELSE IF (DataType == -7) THEN /* real scalar field at elm nodes */
MyFunc_EvalScalarFieldNodes(ElmId, FieldId, ElmThick)
ELSE
RETURN -1
1
Real scalar at elem centroid 6
List of real values
END IF
2
Real vector
7
Real scalar at elem nodes
3
Integer
8
Node reference
4
Character string
9
Coordinate frame reference
MSC.Patran PCL Workshop Notes 5
01/22/17
Material reference
11
Section ID (dimensions)
161/252
12
Section ID (properties)
Negative datatypes denote field reference.
RETURN 0
END FUNCTION
01/22/17
162/252
Appendix A
There are many other ways to accomplish this same task. The
preceding function is very general and very detailed. If the
element property set references a field for the shell thickness
definition, then functions to evaluate the fields
(MyFunc_EvalScalarFieldCentroid() and
MyFunc_EvalScalarFieldNodes()) will need to be written. If the
shell thickness is only defined at the element centroid, then the
ep_word_val_at_el_cen() function can be used. This function has
an advantage over the previous example in that this function
automatically evaluates any field reference.
FUNCTION get_shell_thickness(ElmId, ElmThick)
INTEGER ElmId, ElmIds(1)
INTEGER NumFoundElms, FoundElmIds(VIRTUAL)
REAL
ElmThick, ThickVals(VIRTUAL)
ElmIds(1) = ElmId
ep_word_val_at_el_cen(36, 1, 1, ElmIds, NumFoundElms, @
FoundElmIds, ThickVals)
IF (NumFoundElms == 0) THEN RETURN -1
p = mth_array_search(FoundElmIds, ElmId, FALSE)
IF (p == 0) THEN RETURN -1
ElmThick = ThickVals(p)
RETURN 0
END FUNCTION
01/22/17
163/252
01/22/17
164/252
Appendix A
ElasticModulus
STRING
MatlName[]
db_get_material_id_from_name(MatlName, MatlId)
db_get_matl_prop_value_count(MatlId, NumWords)
IF (NumWords == 0) THEN RETURN 1
sys_allocate_array(WordIds, 1, NumWords)
sys_allocate_array(FieldIds, 1, NumWords)
sys_allocate_array(WordVals, 1, NumWords)
db_get_matl_prop_value(MatlId, WordIds, FieldIds, WordVals)
p = mth_array_search(WordIds, 2, FALSE)
IF (p == 0) THEN RETURN 1
IF (FieldIds(p) != 0) THEN
/* Elastic Modulus is defined
by a field */
ELSE
ElasticModulus = WordVals(p)
END IF
RETURN 0
END FUNCTION
01/22/17
165/252
01/22/17
166/252
Appendix A
GroupNames[32](VIRTUAL)
ga_group_ngroups_get(NumGroups)
/* There is always at least one group */
sys_allocate_array(GroupNames, 1, NumGroups)
ga_group_groups_get(Group_names)
CurrentGroup[32]
ga_group_current_get(CurrentGroup)
db_get_group_id(CurrentGroup, GroupId)
db_count_nodes_in_group(GroupId, NumNodes)
IF (NumNodes > 0) THEN
sys_allocate_array(NodeIds, 1, NumNodes)
db_get_all_node_ids_in_group(NumNodes, GroupId, NodeIds)
END IF
db_count_elems_in_group(GroupId, NumElms)
01/22/17
167/252
01/22/17
168/252
Appendix A
01/22/17
169/252
Appendix A
Resultcase
Result type
Position or layer
Result quantity
01/22/17
170/252
Appendix A
Element Ids
Coordinate reference
01/22/17
171/252
Appendix A
Centroid
Nodes
01/22/17
172/252
Appendix A
lc_id
lc_name
INTEGER
STRING
db_get_load_case_id(lc_name, lc_id)
INPUT:
OUTPUT:
lc_name
lc_id
STRING
INTEGER
num_rc
lc_ids
num_sc_per_lc
INTEGER
INTEGER ARRAY
INTEGER ARRAY
lc_id
num_sc
sc_ids
INTEGER
INTEGER
INTEGER ARRAY
<None>
num_rc
lc_ids
sc_ids
coordinates
rc_names
INTEGER
INTEGER ARRAY
INTEGER ARRAY
INTEGER_ARRAY
STRING ARRAY
OUTPUT:
num_rc
lc_ids
sc_ids
rc_ids
INTEGER
INTEGER ARRAY
INTEGER ARRAY
INTEGER ARRYA
01/22/17
173/252
Appendix A
prim_id
prim_label
INTEGER
STRING
db_get_primary_res_id(prim_label, prim_id)
INPUT:
OUTPUT:
prim_label
prim_id
STRING
INTEGER
prim_id
sec_id
sec_label
INTEGER
INTEGER
STRING
prim_id
sec_label
sec_id
INTEGER
STRING
INTEGER
res_data_get_result_names(prim_id, sec_id, @
prim_label, sec_label)
INPUT:
OUTPUT:
prim_id
sec_id
prim_label
sec_label
INTEGER
INTEGER
STRING
STRING
res_data_get_result_ids(prim_label, sec_label, @
prim_id, sec_id)
res_utl_get_result_ids(num_rc, lc_ids, sc_ids, @
num_res, prim_ids, sec_ids)
INPUT:
OUTPUT:
num_rc
lc_ids
sc_ids
num_res
prim_ids
sec_ids
INTEGER
INTEGER
INTEGER
INTEGER
INTEGER
INTEGER
ARRAY
ARRAY
ARRAY
ARRAY
01/22/17
174/252
Appendix A
lc_id
prim_id
sec_id
rt_id
INTEGER
INTEGER
INTEGER
INTEGER
rt_id
prim_id
sec_id
INTEGER
NTEGER
INTEGER
res_ids(4)
num_layers
layer_ids
layer_labels
res_data_get_layerpos_name(layer_id, layer_name)
INPUT:
OUTPUT:
layer_id
layer_name
INTEGER
STRING
res_data_get_layerpos_id(layer_name, layer_id)
01/22/17
175/252
Appendix A
INPUT
INTEGER
ResIds(5)
STRING
ElmList[]
STRING
Derivation[10]
STRING
Location[]
STRING
CID[]
OUTPUT
INTEGER
DataType
INTEGER
ResLoc
INTEGER
Nres
INTEGER
INTEGER
REAL
Ids(VIRTUAL)
Nresults(VIRTUAL)
ResVals(VIRTUAL)
INTEGER
MinLoc(12)
INTEGER
MaxLoc(12)
01/22/17
177/252
Appendix B
Strings & String Functions
01/22/17
178/252
Appendix B
Declaration
STRING GroupName[32], Filename[256]
STRING GroupNames[32](VIRTUAL)
STRING Names[80](3)
STRING picklist[VIRTUAL]
Initialization
GroupName = MyGroup
String Comparisons
The string comparison operators are special in that they ignore
trailing blanks and uppercase and lowercase. Therefore, all of the
following expressions are TRUE
ABC == ABC
ABC == abc
TEST
01/22/17
179/252
Appendix B
Functions
str_length(MyString)
DESCRIPTION
Returns the current length of a PCL string.
INPUT
MyString
String[]
Integer
Length of MyString.
OUTPUT
<return value>
EXAMPLE
length = str_length(abcde)
length -> 5
01/22/17
180/252
Appendix B
str_substr(MyString, Position, Length)
DESCRIPTION
Return a portion of the input string from the specified
position of the specified length.
INPUT
MyString
String[]
Position
Integer
Length
Integer
Number of characters to
extract
String[]
OUTPUT
<return value>
EXAMPLES
NewString = str_substr(abcde, 1, 2)
NewString -> ab
NewString2 = str_substr(abcde, 4, 10)
NewString2 -> de
01/22/17
181/252
Appendix B
str_assign(MyString, Position, Length, MyString2)
DESCRIPTION
Replace a portion of a string with another string.
INPUT
MyString
String[]
Original string to be
modified. This parameter will
be modified.
Position
Integer
Length
Integer
Number of characters to be
replaced.
MyString2
String[]
String[]
OUTPUT
MyString
EXAMPLES
MyString = abxyzf
str_assign(MyString, 3, 3, cde)
MyString -> abcdef
01/22/17
182/252
Appendix B
str_index(MyString1, MyString2)
DESCRIPTION
Return the position where a string is found within another
string.
INPUT
MyString1
String[]
MyString2
String[]
Integer
OUTPUT
<return value>
EXAMPLES
Position = str_index(abcdef, cde)
Position -> 3
Position = str_index(abcdef, xyz)
Position -> 0
01/22/17
183/252
Appendix B
str_token(MyString, Delimiter, Ntoken[, Compress])
DESCRIPTION
Extracts a token (a sequence of characters) marked off by a
delimiting character from a string.
INPUT
MyString
String[]
Delimiter
String[1]
Ntoken
Integer
Compress
Logical
String[]
This
OUTPUT
<return value>
EXAMPLE
TmpString = str_token(abc, def, hij, ,, 2)
TmpString -> def
TmpString2 = str_token(*CLASS = MyClass, =, 2)
TmpString2 -> MyClass
01/22/17
184/252
Appendix B
str_strip_lead(MyString)
DESCRIPTION
Return a copy of the string with the leading spaces removed.
INPUT
MyString
String[]
String[]
OUTPUT
<return value>
EXAMPLE
MyString2 = str_strip_lead(
a b c)
MyString2 -> a b c
str_strip_trail(MyString)
DESCRIPTION
Return a copy of the string with the trailing spaces
removed.
INPUT
MyString
String[]
String[]
OUTPUT
<return value>
EXAMPLE
MyString2 = str_strip_trail(
MyString2 ->
a b c
a b c
01/22/17
185/252
Appendix B
str_to_integer(MyString[, status])
DESCRIPTION
Convert a string to an integer.
INPUT
MyString
String[]
Input string.
status
Integer
<return value>
Integer
Integer value.
OUTPUT
EXAMPLE
ival = str_to_integer(12)
ival -> 12
str_from_integer(ival)
DESCRIPTION
Convert an integer to a string.
INPUT
ival
Integer
String[]
String value.
OUTPUT
<return value>
EXAMPLE
MyString = str_from_integer(12)
MyString -> 12
01/22/17
186/252
Appendix B
str_datatype(MyString)
DESCRIPTION
Attempt to decipher the datatype contained in a string.
INPUT
MyString
String
Input string.
String[]
OUTPUT
<return value>
OTHER FUNCTIONS
str_to_real(MyString[, status])
str_from_real(RealValue)
str_to_logical(MyString)
str_from_logical(LogicalValue)
01/22/17
187/252
Appendix C
Noteworthy Functions
01/22/17
188/252
Appendix C
sys_move_raw()
sys_move_raw(source, destination)
DESCRIPTION
Move one raw PCL variable to another. This is a great
function to use when transferring the contents of one array
to another array. It is significantly faster than a loop.
INPUT
source
Any
Any
OUTPUT
destination
EXAMPLE
INTEGER a(12), b(12), c(6, 12), d(24)
sys_move_raw(a, b)
sys_move_raw(a, c(1, 1:))
sys_move_raw(a, c(1, 1:12))
sys_move_raw(a(1:), c(1, 1:))
sys_move_raw(a, c(2, 1:12))
sys_move_raw(a, d(1:12))
sys_move_raw(a, d(13:))
01/22/17
189/252
Appendix C
mth_array_search()
mth_array_search(IntegerArray, Look4, Sorted)
DESCRIPTION
Search an integer array for a value.
INPUT
IntegerArray
Integer array
Look4
Integer
Sorted
Logical
Integer
OUTPUT
<return value>
EXAMPLES
INTEGER p
INTEGER a(4) = [1, 5, 2, 3]
p = mth_array_search(a, 2, FALSE)
p -> 3, i.e., a(3) = 2
p = mth_array_search(a, 12, FALSE)
p -> 0, i.e., a(i) != 12
01/22/17
190/252
Appendix C
mth_sort()
mth_sort(Array, RemoveDuplicates, NumLeft)
DESCRIPTION
This function will sort an array of integers into ascending
order, optionally removing all duplicates.
INPUT
Array
Integer array
Integer array to be
sorted. This argument
is used for both input
and output. The
contents of the
original array are
destroyed and replaced
by the sorted values.
RemoveDuplicates
Logical
Array
Integer array
NumLeft
Integer
OUTPUT
EXAMPLE
INTEGER a(4) = [5, 1, 9, 8]
INTEGER NumLeft
mth_sort(a, TRUE, NumLeft)
a(1:4) -> 1, 5, 8, 9
NumLeft -> 4
01/22/17
191/252
Appendix C
mth_sort_row()
mth_row_sort(Array, Row, Ascend)
DESCRIPTION
Sorts a two-dimensional integer or real array by one of its
rows.
INPUT
Array
Integer or Real
array
Row
Integer
Ascend
Logical
Integer or Real
array
OUTPUT
Array
EXAMPLE
INTEGER a(2, 3) = [3, 1, 2, 4, 5, 6]
mth_row_sort(a, 1, TRUE)
a() -> [1, 2, 3, 5, 6, 4]
mth_sort_column()
mth_sort_column(Array, Column, Ascend)
DESCRIPTION
Sorts a two-dimensional integer or real array by one of its
columns.
01/22/17
192/252
Appendix C
fem_geom_edge_length()
fem_geom_edge_length(PickList, Lengths, NumLengths)
DESCRIPTION
Determines the length of bar elements and/or element edges.
INPUT
PickList
String[]
Lengths(virtual)
Real array
NumLengths
Integer
Number of entities
contained in PickList.
<return value>
Integer
OUTPUT
fem_geom_face_area()
fem_geom_face_area(PickList, Areas, NumAreas)
DESCRIPTION
Returns the face area of 2D elements or 3D element faces.
fem_geom_elem_volume()
fem_geom_elem_volume(PickList, Volumes, NumVolumes)
DESCRIPTION
Returns the volumes of 3D elements.
01/22/17
193/252
Appendix C
fem_geom_elem_location()
fem_geom_elem_location(PickList, Locations, NumLocations)
DESCRIPTION
Returns the location of the centroid of elements, element
edges, etc.
01/22/17
194/252
Appendix D
Form Spacing Parameters
(appforms.p)
01/22/17
195/252
Appendix D
SPACING
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
SINGLE_SPACE
QTR_SPACE
HALF_SPACE
THREE_QTR_SPACE
ONE_AND_HALF_SPACE
DOUBLE_SPACE
FONT_HGT
TEXT_FONT_HGT
SS_FONT_HGT
LINE_THICKNESS
FRAME_1EDGE
FRAME_2EDGE
SFRAME_1EDGE
SFRAME_2EDGE
SCROLL_FRAME_1EDGE
SCROLL_FRAME_2EDGE
SPREADSHEET_1EDGE
SPREADSHEET_2EDGE
HIGHLITE_1EDGE
HIGHLITE_2EDGE
ICON_HGT
- Height of an icon
LOGO_ICON_WID
LOGO_ICON_HGT
BUTTON_ICON_1EDGE
BUTTON_ICON_2EDGE
LABEL_ICON_1EDGE
LABEL_ICON_2EDGE
ITEM_ICON_1EDGE
ITEM_ICON_2EDGE
TOGGLE_ICON_1EDGE
TOGGLE_ICON_2EDGE
Thickness
Thickness
Thickness
Thickness
Thickness
Thickness
Thickness
Thickness
Thickness
Thickness
Thickness
Thickness
Thickness
Thickness
Thickness
Thickness
Thickness
Thickness
Thickness
of
of
of
of
of
of
of
of
of
of
of
of
of
of
of
of
of
of
of
a separator
a frame edge
both frame edges
a select frame edge
both select frame edges
a scroll frame edge
both scroll frame edges
a spreadsheet edge
both spreadsheet edges
a highlight border around widgets
both highlight borders
a
a
a
a
a
a
a
a
COLOR_MENU_WID
- Width of a color menu
COLOR_MENU_HGT
- Height of a color menu
COLOR_MENU_LABEL_Y_OFFSET - Y offset for centering a label next to
a color menu
01/22/17
196/252
Appendix D
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*************************************************************************
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
FORMS
Create an application form. Note that all forms should use the "UL"
screen position, since the values returned by these variables are
based on that assumption.
ui_form_create( "", FORM_X_LOC,
@
FORM_Y_LOC, "UL",
@
FORM_WID_SML,
@
FORM_HGT_TALL, "Label", "Icon" )
Create a medium width form next to an application form, and don't
cover the command window. Use the "Full" height form.
ui_form_create( "", FORM_X_LOC_MED_NX2_SML,
@
FORM_Y_LOC, "UL",
@
FORM_WID_MED,
@
FORM_HGT_FULL, "Label", "Icon" )
Create a centered, half height, medium width modal form.
ui_modalform_create( "", FORM_X_LOC_MED_CEN,
FORM_Y_LOC_HALF_CEN, "UL",
FORM_WID_MED,
FORM_HGT_HALF, "Label" )
@
@
@
FORM_X_LOC_SML
FORM_X_LOC_SPL
FORM_X_LOC_MED
FORM_X_LOC_LRG
01/22/17
197/252
Appendix D
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
FORM_X_LOC_SML_NX2_SML
FORM_X_LOC_SPL_NX2_SML
FORM_X_LOC_MED_NX2_SML
FORM_X_LOC_LRG_NX2_SML
small form
a small form
small form
small form
FORM_X_LOC_SML_NX2_SPL
FORM_X_LOC_SPL_NX2_SPL
FORM_X_LOC_MED_NX2_SPL
FORM_X_LOC_LRG_NX2_SPL
FORM_X_LOC_SML_NX2_MED
FORM_X_LOC_SPL_NX2_MED
FORM_X_LOC_MED_NX2_MED
FORM_X_LOC_LRG_NX2_MED
FORM_X_LOC_SML_NX2_LRG
FORM_X_LOC_SPL_NX2_LRG
FORM_X_LOC_MED_NX2_LRG
FORM_X_LOC_LRG_NX2_LRG
FORM_X_LOC_SML_CEN_AB_COM
FORM_X_LOC_SPL_CEN_AB_COM
FORM_X_LOC_MED_CEN_AB_COM
FORM_X_LOC_LRG_CEN_AB_COM
FORM_X_LOC_OFFSET_CASCADE_1
FORM_X_LOC_OFFSET_CASCADE_2
FORM_X_LOC_OFFSET_CASCADE_3
FORM_X_LOC_OFFSET_CASCADE_4
FORM_X_LOC_OFFSET_CASCADE_5
FORM_Y_LOC_HALF_CEN
FORM_Y_LOC_QTR_CEN
01/22/17
198/252
Appendix D
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
FORM_Y_LOC_3_8THS_CEN
FORM_Y_LOC_5_8THS_CEN
FORM_Y_LOC_3_QTRS_CEN
FORM_Y_LOC_OFFSET_CASCADE_1
FORM_Y_LOC_OFFSET_CASCADE_2
FORM_Y_LOC_OFFSET_CASCADE_3
FORM_Y_LOC_OFFSET_CASCADE_4
FORM_Y_LOC_OFFSET_CASCADE_5
Y
Y
Y
Y
Y
offset
offset
offset
offset
offset
for
for
for
for
for
cascade
cascade
cascade
cascade
cascade
position
position
position
position
position
1
2
3
4
5
Form Margins:
FORM_L_MARGIN
FORM_R_MARGIN
FORM_T_MARGIN
FORM_B_MARGIN
FORM_B_MARGIN_NO_BUTTON
FORM_2H_MARGIN
FORM_2V_MARGIN
FORM_2V_MARGIN_NO_BUTTON
FORM_2H_BORDER
FORM_2V_BORDER
FORM_2V_BORDER_NO_LABEL
FORM_X_ISFRAME
01/22/17
199/252
Appendix D
*
*
*
*
*
FORM_Y_ISFRAME
FORM_Y_ISFRAME_NO_LABEL
*************************************************************************
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
*************************************************************************
*
*
*
*
FRAMES
Create a frame in an application form.
Appendix D
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
widget in the form and that the frame contains a three line listbox
with a label and a databox with a label. Then locate the Y position
for an unframed databox under the frame. Note that the frame's label
must be considered in determining the next widget location as does
the thickness of the frame edges.
Since this is an application form, the first Y location is the
variable "app_form_first_y_loc".
y_loc = APP_FORM_FIRST_Y_LOC
height = FRAME_T_MARGIN +
LBOX_3L_HGT_LABOVE +
INTER_WIDGET_SPACE +
DBOX_HGT_LABOVE +
FRAME_B_MARGIN
@
@
@
@
@
@
@
@
@
@
@
@
@
y_frame_loc = FRAME_T_MARGIN +
LBOX_3L_HGT_LABOVE +
INTER_WIDGET_SPACE
@
@
@
@
@
@
y_loc = y_loc +
FRAME_LABEL_HGT +
height +
FRAME_2EDGE +
INTER_WIDGET_SPACE
ui_databox_create ( frame_id, "",
UNFRAMED_L_MARGIN,
y_loc, 0.0,
DBOX_WID_SINGLE,
"Second Databox Label", value,
TRUE, datatype, num_vals )
@
@
@
@
@
@
@
@
@
01/22/17
201/252
Appendix D
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
@
@
@
@
@
@
@
@
Width
Width
Width
Width
of
of
of
of
a
a
a
a
FRAME_LABEL_HGT
Frame Margins:
FRAME_L_MARGIN
FRAME_R_MARGIN
FRAME_T_MARGIN
FRAME_B_MARGIN
Inside
Inside
Inside
Inside
FRAME_2H_MARGIN
FRAME_2V_MARGIN
Frame Placement:
FRAME_X_LOC_COL1
FRAME_X_LOC_COL2
FRAME_X_LOC_COL3
01/22/17
202/252
Appendix D
*
*************************************************************************
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
SELECT FRAMES
Create a select frame in an application form. Put two select databoxes
in the select frame. Then compute the Y location for the next widget.
Note the use of the supplied Y locations for the select databoxes as
well as the height of the select frame.
y_loc = APP_FORM_FIRST_Y_LOC
ui_selectframe_create( form_id, "callback",
FORM_L_MARGIN,
y_loc,
SFRAME_WID_SINGLE,
SFRAME_2SDB_HGT_LABOVE,
"Select Frame Label",
recycle_flag )
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
SFRAME_LABEL_HGT
SFRAME_1SDB_HGT_LABOVE
SFRAME_2SDB_HGT_LABOVE
Width
Width
Width
Width
of
of
of
of
a
a
a
a
01/22/17
203/252
Appendix D
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
SFRAME_3SDB_HGT_LABOVE
SFRAME_4SDB_HGT_LABOVE
SFRAME_5SDB_HGT_LABOVE
SFRAME_HGT_LABOVE_INCR
- Height of a select
3 select databoxes
- Height of a select
4 select databoxes
- Height of a select
5 select databoxes
frame with
with labels
frame with
with labels
frame with
with labels
Inside
Inside
Inside
Inside
SFRAME_2H_MARGIN
SFRAME_2V_MARGIN
*************************************************************************
*
*
*
*
*
*
*
*
*
*
*
SCROLL_FRAMES
Create a scroll frame in a form.
Scroll Frame Widths and Heights:
SCROLL_FRAME_WID_SINGLE
SCROLL_FRAME_WID_SPECIAL
SCROLL_FRAME_WID_DOUBLE
Appendix D
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
SCROLL_FRAME_WID_TRIPLE
SCROLL_FRAME_WORK_WID_SINGLE
- Working width
scroll frame
SCROLL_FRAME_WORK_WID_SPECIAL - Working width
scroll frame
SCROLL_FRAME_WORK_WID_DOUBLE - Working width
scroll frame
SCROLL_FRAME_WORK_WID_TRIPLE - Working width
scroll frame
SCROLL_FRAME_DBOX_WID_SINGLE
- Width of
databox
SCROLL_FRAME_DBOX_WID_SPECIAL - Width of
databox
SCROLL_FRAME_DBOX_WID_DOUBLE - Width of
databox
SCROLL_FRAME_DBOX_WID_TRIPLE - Width of
databox
of a single width
of a special width
of a double width
of a triple width
SCROLL_FRAME_LABEL_HGT
SCROLL_FRAME_1DBOX_HGT
SCROLL_FRAME_2DBOX_HGT
SCROLL_FRAME_3DBOX_HGT
SCROLL_FRAME_4DBOX_HGT
SCROLL_FRAME_5DBOX_HGT
SCROLL_FRAME_DBOX_HGT_INCR
SCROLL_FRAME_1DBOX_WORK_HGT
SCROLL_FRAME_2DBOX_WORK_HGT
SCROLL_FRAME_3DBOX_WORK_HGT
SCROLL_FRAME_4DBOX_WORK_HGT
SCROLL_FRAME_5DBOX_WORK_HGT
Scroll
Scroll
Scroll
Scroll
Scroll
frame
frame
frame
frame
frame
height
height
height
height
height
with
with
with
with
with
1
2
3
4
5
databox
databoxes
databoxes
databoxes
databoxes
Frame Margins:
SCROLL_FRAME_L_MARGIN
SCROLL_FRAME_T_MARGIN
SCROLL_FRAME_B_MARGIN
SCROLL_FRAME_2H_MARGIN
SCROLL_FRAME_2V_MARGIN
SCROLL_FRAME_R_MARGIN
01/22/17
205/252
Appendix D
*************************************************************************
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
BUTTONS
Create two buttons in a small form. The button on the left is a
default button. Use "half" size buttons.
ui_button_create ( form_id, "callback",
BUTTON_HALF_X_LOC1,
y_loc,
BUTTON_WID_HALF,
0.0, "Left Button",
TRUE, TRUE )
@
@
@
@
@
@
@
@
@
@
@
@
BUTTON_WID_FULL_NT
BUTTON_WID_HALF_NT
BUTTON_WID_THIRD_NT
BUTTON_HGT
BUTTON_DEFAULT_HGT
BUTTON_HGT_NT
- Button height
- Default button height (includes top and
bottom borders)
- Button height of non_troughed button
BUTTON_DEFAULT_BORDER_WID
BUTTON_DEFAULT_BORDER_HGT
Appendix D
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
BUTTON_1XTRA_WID
BUTTON_2XTRA_WID
BUTTON_Y_OFFSET
BUTTON_Y_OFFSET_NT
- X width for
of troughed
- X width for
of troughed
BUTTON_LABEL_Y_OFFSET
BUTTON_FULL_X_LOC1_COL2
BUTTON_HALF_X_LOC1_COL2
BUTTON_HALF_X_LOC2_COL2
BUTTON_THIRD_X_LOC1_COL2
BUTTON_THIRD_X_LOC2_COL2
BUTTON_THIRD_X_LOC3_COL2
BUTTON_FULL_X_LOC1_COL3
BUTTON_HALF_X_LOC1_COL3
BUTTON_HALF_X_LOC2_COL3
BUTTON_THIRD_X_LOC1_COL3
BUTTON_THIRD_X_LOC2_COL3
BUTTON_THIRD_X_LOC3_COL3
BUTTON_FULL_X_LOC1_SPL
BUTTON_HALF_X_LOC1_SPL
BUTTON_HALF_X_LOC2_SPL
BUTTON_THIRD_X_LOC1_SPL
BUTTON_THIRD_X_LOC2_SPL
BUTTON_THIRD_X_LOC3_SPL
BUTTON_FULL_X_LOC_CEN
BUTTON_HALF_X_LOC_CEN
BUTTON_THIRD_X_LOC_CEN
BUTTON_FULL_X_LOC_CEN_MED
BUTTON_HALF_X_LOC_CEN_MED
BUTTON_THIRD_X_LOC_CEN_MED
BUTTON_FULL_X_LOC_CEN_LRG
BUTTON_HALF_X_LOC_CEN_LRG
01/22/17
207/252
Appendix D
*
*
*
*
*
*
BUTTON_THIRD_X_LOC_CEN_LRG
BUTTON_FULL_X_LOC_CEN_SPL
BUTTON_HALF_X_LOC_CEN_SPL
BUTTON_THIRD_X_LOC_CEN_SPL
*************************************************************************
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
DATABOXES
Create a framed databox with a label above the databox. Then
compute the Y location for the next widget inside the frame.
y_frame_loc = FRAME_T_MARGIN
ui_databox_create ( frame_id, "",
FRAME_L_MARGIN,
y_frame_loc, 0.0,
DBOX_WID_SINGLE,
"Databox Label", value,
TRUE, datatype, num_vals )
@
@
@
@
@
y_frame_loc = y_frame_loc +
DBOX_HGT_LABOVE +
INTER_WIDGET_SPACE
@
@
@
@
@
@
@
@
DBOX_HGT_LABOVE
Width
Width
Width
Width
of
of
of
of
a
a
a
a
01/22/17
208/252
Appendix D
*
*
*
*
*
*
*
*
*
*
*
*
DBOX_HGT_NO_LABOVE
DBOX_LABEL_LEN_SINGLE
- REMOVED
- Y offset for placing a label to the right of
a databox with "labelabove" false.
*************************************************************************
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
FILES
Create a form centered under the main menu that has a file
widget inside the a frame. The file widget is placed at
( 0.0, 0.0 ) inside the frame (a top margin is not needed).
The height of the file widget includes a bottom margin
and therefore can be used as the height of the frame that
contains the file widget. The file widget has 5 lines in
the list boxes.
form_hgt = FILE_5L_HGT + FORM_2V_MARGIN + FRAME_2EDGE
x_loc = WINDOW_CEN_X_LOC - 0.5 * ( wid + FORM_2H_BORDER )
y_loc = WINDOW_CEN_Y_LOC - 0.5 * ( form_hgt + FORM_2V_BORDER )
form_id = ui_form_create( "", x_loc, y_loc, "UL",
wid, form_hgt,
"Form Label", "" )
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
File Width:
FILE_WID_SINGLE
01/22/17
209/252
Appendix D
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
FILE_WID_SPECIAL
FILE_WID_DOUBLE
FILE_WID_TRIPLE
File Height:
FILE_1L_HGT
FILE_2L_HGT
FILE_3L_HGT
FILE_4L_HGT
FILE_5L_HGT
FILE_6L_HGT
FILE_7L_HGT
FILE_8L_HGT
FILE_9L_HGT
FILE_HGT_INCR
Height of
Height of
Height of
Height of
Height of
Height of
Height of
Height of
Height of
Increment
a 1
a 2
a 3
a 4
a 5
a 6
a 7
a 8
a 9
for
*************************************************************************
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
@
@
@
y_frame_loc = y_frame_loc +
LABEL_HGT +
INTER_WIDGET_SPACE
@
@
Label Height:
LABEL_HGT
LABEL_Y_OFFSET
LABEL_HGT_TIGHT
- Height of a label
- Y offset of label
- Height of a label when showing multiple
labels
INFO_INDENT
INFO_INDENT_COL1
INFO_INDENT_COL2
INFO_INDENT_COL3
X
X
X
X
location
location
location
location
of
of
of
of
information
information
information
information
label
label in column 1
label in column 2
label in column 3
*************************************************************************
*
*
*
LISTBOXES
01/22/17
210/252
Appendix D
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
Create a framed three line listbox with a label above the listbox. Note
that the widths and heights include the vertical and horizontal sliders.
y_frame_loc = FRAME_T_MARGIN
ui_listbox_create ( frame_id, "callback",
FRAME_L_MARGIN,
y_frame_loc,
LBOX_WID_SINGLE,
3, "Listbox Label",
selection_type, sort_flag )
@
@
@
@
@
y_frame_loc = y_frame_loc +
LBOX_3L_HGT_LABOVE +
INTER_WIDGET_SPACE
@
@
To determine the height for a six line listbox, add the variable
LBOX_HGT_LABOVE_INCR to LBOX_5L_HGT_LABOVE.
Listbox Width and Height:
LBOX_WID_SINGLE
LBOX_WID_SPECIAL
LBOX_WID_DOUBLE
LBOX_WID_TRIPLE
Width
Width
Width
Width
LBOX_1L_HGT_LABOVE
LBOX_2L_HGT_LABOVE
LBOX_3L_HGT_LABOVE
LBOX_4L_HGT_LABOVE
LBOX_5L_HGT_LABOVE
LBOX_8L_HGT_LABOVE
Height
Height
Height
Height
Height
Height
LBOX_HGT_LABOVE_INCR
LBOX_1L_HGT_NO_LABOVE
- Height
(label
- Height
- Height
- Height
- Height
- Height
LBOX_2L_HGT_NO_LABOVE
LBOX_3L_HGT_NO_LABOVE
LBOX_4L_HGT_NO_LABOVE
LBOX_5L_HGT_NO_LABOVE
LBOX_8L_HGT_NO_LABOVE
of
of
of
of
of
of
of
of
of
of
a
a
a
a
of
is
of
of
of
of
of
1
2
3
4
5
8
line
line
line
line
line
line
a 1 line
blank)
a 2 line
a 3 line
a 4 line
a 5 line
a 8 line
listbox
listbox
listbox
listbox
listbox
listbox
with
with
with
with
with
with
a
a
a
a
a
a
top
top
top
top
top
top
label
label
label
label
label
label
with
with
with
with
with
no
no
no
no
no
label
label
label
label
label
*************************************************************************
*
*
OPTION MENUS
01/22/17
211/252
Appendix D
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
Create an option menu with a label to the side. Then set the
Y location for the next widget. Assume this is an unframed widget.
y_loc = APP_FORM_FIRST_Y_LOC
ui_optionmenu_create( form_id, "callback",
UNFRAMED_L_MARGIN,
y_loc,
OPT_MENU_LABEL_LEN,
"Label", FALSE )
@
@
@
@
OPT_MENU_HGT_LABOVE
- Height
on the
- Height
on the
OPT_MENU_HGT_NO_LABOVE
OPT_MENU_Y_OFFSET
*************************************************************************
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
SELECT DATABOXES
Create a framed select databox with a label above the select databox.
Then compute the Y location for the next widget.
y_sframe_loc = SFRAME_T_MARGIN
ui_selectdatabox_create ( sel_frame_id, "",
SFRAME_L_MARGIN,
y_sframe_loc, 0.0,
SDBOX_WID_SINGLE,
"Select Databox Label",
value, TRUE, datatype,
prompt )
@
@
@
@
@
@
y_sframe_loc = y_sframe_loc +
SDBOX_HGT_LABOVE +
INTER_WIDGET_SPACE
@
@
Create a framed select databox with a label to the side. Use the
default label length for a single column select databox and compute
the select databox width.
01/22/17
212/252
Appendix D
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
y_sframe_loc = SFRAME_T_MARGIN
wid = SDBOX_WID_SINGLE SDBOX_LABEL_LEN_SINGLE
@
@
@
@
@
@
@
y_sframe_loc = y_sframe_loc +
SDBOX_HGT_NO_LABOVE +
INTER_WIDGET_SPACE
@
@
SDBOX_HGT_LABOVE
SDBOX_HGT_NO_LABOVE
SDBOX_Y_LOC1_LABOVE
SDBOX_Y_LOC2_LABOVE
SDBOX_Y_LOC3_LABOVE
SDBOX_Y_LOC4_LABOVE
SDBOX_Y_LOC5_LABOVE
SDBOX_Y_LABOVE_INCR
Width
Width
Width
Width
of
of
of
of
a
a
a
a
selectframe
selectframe
selectframe
selectframe
selectframe
databox 1 in a selectframe
not have a label above)
databox 2 in a selectframe
not have a label above)
databox 3 in a selectframe
not have a label above)
databox 4 in a selectframe
not have a label above)
databox 5 in a selectframe
not have a label above)
01/22/17
213/252
Appendix D
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
- REMOVED
- Y offset for placing a label to the right
of a select databox with "labelabove" false.
*************************************************************************
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
SLIDEBARS
Create a slidebar inside a frame and then compute the y location
of the next widget inside the frame. The slidebar has a label
as well as min/max labels above the displayed values.
y_frame_loc = FRAME_T_MARGIN
ui_slidebar_create ( frame_id, "callback",
@
FRAME_L_MARGIN,
@
y_frame_loc,
@
SLIDER_WID_SINGLE,
@
"Slidebar Label", value,
@
num_digits, TRUE, "Min", "Max", @
TRUE, 0, 10 )
@
y_frame_loc = y_frame_loc +
SLIDER_HGT_COMPLETE +
INTER_WIDGET_SPACE
@
@
SLIDER_HGT_COMPLETE
SLIDER_HGT_MINMAX
SLIDER_HGT_VALUES
SLIDER_HGT_LABEL
SLIDER_HGT_MINMAX_VALUES
Width
Width
Width
Width
of
of
of
of
a
a
a
a
01/22/17
214/252
Appendix D
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
SLIDER_HGT_MINMAX_LABEL
SLIDER_HGT_VALUES_LABEL
SLIDER_HGT_BAR_ONLY
SLIDER_LABEL_Y_LOC_MM_VAL
*************************************************************************
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
SPREADSHEETS
Create a spreadsheet in a form.
Spreadsheet Widths and Heights:
SPREADSHEET_WID_SINGLE
SPREADSHEET_WID_SPECIAL
SPREADSHEET_WID_DOUBLE
SPREADSHEET_WID_TRIPLE
SPREADSHEET_LABEL_HGT
SPREADSHEET_HGT_2D_1ROW
SPREADSHEET_HGT_2D_2ROW
SPREADSHEET_HGT_2D_3ROW
SPREADSHEET_HGT_2D_4ROW
SPREADSHEET_HGT_2D_5ROW
SPREADSHEET_HGT_2D_6ROW
SPREADSHEET_HGT_2D_7ROW
SPREADSHEET_HGT_2D_8ROW
SPREADSHEET_HGT_2D_9ROW
SPREADSHEET_HGT_2D_10ROW
SPREADSHEET_HGT_2D_INCR
Height
Height
Height
Height
Height
Height
Height
Height
Height
Height
Height
SPREADSHEET_HGT_3D_1ROW
SPREADSHEET_HGT_3D_2ROW
SPREADSHEET_HGT_3D_3ROW
SPREADSHEET_HGT_3D_4ROW
SPREADSHEET_HGT_3D_5ROW
SPREADSHEET_HGT_3D_6ROW
SPREADSHEET_HGT_3D_7ROW
Height
Height
Height
Height
Height
Height
Height
of
of
of
of
of
of
of
Width
Width
Width
Width
of
of
of
of
a
a
a
a
a
a
a
a
a
a
a
3D
3D
3D
3D
3D
3D
3D
spreadsheet
spreadsheet
spreadsheet
spreadsheet
spreadsheet
spreadsheet
spreadsheet
with
with
with
with
with
with
with
1
2
3
4
5
6
7
row
rows
rows
rows
rows
rows
rows
01/22/17
215/252
Appendix D
*
*
*
*
*
SPREADSHEET_HGT_3D_8ROW
SPREADSHEET_HGT_3D_9ROW
SPREADSHEET_HGT_3D_10ROW
SPREADSHEET_HGT_3D_INCR
Height
Height
Height
Height
*************************************************************************
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
SWITCHES
Create a framed two row switch with a label. Note that the
number of rows is a function of the "num_cols" variable and the
number of items created for the switch.
y_frame_loc = FRAME_T_MARGIN
ui_switch_create( frame_id, "callback",
FRAME_L_MARGIN,
y_frame_loc,
num_cols, "Switch Label",
alwaysone_flag )
@
@
@
@
y_frame_loc = y_frame_loc +
SWITCH_2R_HGT_LABEL +
INTER_WIDGET_SPACE
@
@
Switch Height:
SWITCH_1R_HGT_LABEL
SWITCH_2R_HGT_LABEL
SWITCH_3R_HGT_LABEL
SWITCH_4R_HGT_LABEL
Height
Height
Height
Height
SWITCH_HGT_LABEL_INCR
SWITCH_1R_HGT_NO_LABEL
SWITCH_2R_HGT_NO_LABEL
SWITCH_3R_HGT_NO_LABEL
SWITCH_4R_HGT_NO_LABEL
Height
Height
Height
Height
of
of
of
of
of
of
of
of
a
a
a
a
a
a
a
a
1
2
3
4
1
2
3
4
row
row
row
row
row
row
row
row
switch
switch
switch
switch
switch
switch
switch
switch
with
with
with
with
with
with
with
with
a
a
a
a
no
no
no
no
label
label
label
label
label
label
label
label
*************************************************************************
*
*
*
*
*
*
TEXTBOXES
Create a framed three line textbox with a label. Note that the
widths and heights include the vertical and horizontal sliders.
01/22/17
216/252
Appendix D
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
y_frame_loc = FRAME_T_MARGIN
ui_text_create ( frame_id, "",
FRAME_L_MARGIN,
y_frame_loc,
TBOX_WID_SINGLE,
3, "Textbox Label",
"This is text", editable_flag )
@
@
@
@
@
y_frame_loc = y_frame_loc +
TBOX_3L_HGT_LABOVE +
INTER_WIDGET_SPACE
@
@
To determine the height for a six line textbox, add the value
of "TBOX_HGT_LABOVE_INCR" to "TBOX_5L_HGT_LABOVE".
Textbox Width and Height:
TBOX_WID_SINGLE
TBOX_WID_SPECIAL
TBOX_WID_DOUBLE
TBOX_WID_TRIPLE
Width
Width
Width
Width
TBOX_1L_HGT_LABOVE
TBOX_2L_HGT_LABOVE
TBOX_3L_HGT_LABOVE
TBOX_4L_HGT_LABOVE
TBOX_5L_HGT_LABOVE
Height
Height
Height
Height
Height
TBOX_HGT_LABOVE_INCR
TBOX_1L_HGT_NO_LABOVE
- Height
(label
- Height
- Height
- Height
- Height
TBOX_2L_HGT_NO_LABOVE
TBOX_3L_HGT_NO_LABOVE
TBOX_4L_HGT_NO_LABOVE
TBOX_5L_HGT_NO_LABOVE
of
of
of
of
of
of
of
of
of
a
a
a
a
of
is
of
of
of
of
1
2
3
4
5
line
line
line
line
line
a 1 line
blank)
a 2 line
a 3 line
a 4 line
a 5 line
textbox
textbox
textbox
textbox
textbox
with
with
with
with
with
a
a
a
a
a
top
top
top
top
top
label
label
label
label
label
with
with
with
with
no
no
no
no
label
label
label
label
*************************************************************************
*
*
*
*
*
*
*
*
*
*
TOGGLES
Create a toggle inside a frame and then compute the y location
of the next widget in the frame.
y_frame_loc = FRAME_T_MARGIN
ui_toggle_create ( frame_id, "callback",
FRAME_L_MARGIN,
@
@
01/22/17
217/252
Appendix D
*
*
*
*
*
*
*
*
*
*
*
*
*
*
y_frame_loc,
"Toggle Label" )
y_frame_loc = y_frame_loc +
TOGGLE_HGT +
INTER_WIDGET_SPACE
@
@
@
Toggle Height:
TOGGLE_HGT
TOGGLE_Y_OFFSET
- Height of a toggle
- Y offset for placing a label to the side
of a toggle
*************************************************************************
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
LANGUAGE
Language variables:
ENGLISH
GERMAN
SPANISH
FRENCH
KANJI
"English"
"German"
"Spanish"
"French"
"Kanji"
LANGUAGE
HANDEDNESS
*************************************************************************
*
*
*
*
*
*
*
*
*
*
*
SCREEN
Screen variables:
PIXEL_WID
PIXEL_HGT
SCREEN_WID
SCREEN_HGT
*************************************************************************
*
*
*
*
*
*
BASIC LAYOUT
Basic layout variables:
MAIN_MENU_X_LOC
Appendix D
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
MAIN_MENU_Y_LOC
MAIN_MENU_WID
MAIN_MENU_HGT
MAIN_MENU_L_EDGE
MAIN_MENU_R_EDGE
MAIN_MENU_T_EDGE
MAIN_MENU_B_EDGE
MAIN_MENU_SWITCH_Y_LOC
MAIN_MENU_ICON_Y_LOC
MAIN_MENU_ICON_HGT
MAIN_MENU_ICON_WID
MAIN_MENU_LOGO_ICON_WID
MAIN_MENU_HEART_ICON_WID
MAIN_MENU_HEART_ICON_HGT
MAIN_MENU_MARGIN
MAIN_MENU_ICON_MARGIN
MAIN_MENU_HEART_MARGIN
MAIN_MENU_HEART_X_LOC
MAIN_MENU_HEART_Y_LOC
COMMAND_WINDOW_X_LOC
COMMAND_WINDOW_Y_LOC
COMMAND_WINDOW_WID
COMMAND_WINDOW_HGT
COMMAND_WINDOW_NUM_ROWS
COMMAND_WINDOW_L_EDGE
COMMAND_WINDOW_R_EDGE
COMMAND_WINDOW_T_EDGE
COMMAND_WINDOW_B_EDGE
GRAPHICS_WINDOW_X_LOC
GRAPHICS_WINDOW_Y_LOC
GRAPHICS_WINDOW_WID
GRAPHICS_WINDOW_HGT
GRAPHICS_WINDOW_L_EDGE
GRAPHICS_WINDOW_R_EDGE
GRAPHICS_WINDOW_T_EDGE
GRAPHICS_WINDOW_B_EDGE
GRAPHICS_WINDOW_X_LOC_UL
GRAPHICS_WINDOW_Y_LOC_UL
GRAPHICS_WINDOW_X_LOC_UR
GRAPHICS_WINDOW_Y_LOC_UR
GRAPHICS_WINDOW_X_LOC_LL
GRAPHICS_WINDOW_Y_LOC_LL
GRAPHICS_WINDOW_X_LOC_LR
GRAPHICS_WINDOW_Y_LOC_LR
GRAPHICS_CEN_X_LOC
GRAPHICS_CEN_Y_LOC
WINDOW_CEN_X_LOC
Quarter
Quarter
Quarter
Quarter
Quarter
Quarter
Quarter
Quarter
size
size
size
size
size
size
size
size
graphics
graphics
graphics
graphics
graphics
graphics
graphics
graphics
window
window
window
window
window
window
window
window
upper
upper
upper
upper
lower
lower
lower
lower
left X loc
left Y loc
right X loc
right Y loc
left X loc
left Y loc
right X loc
right Y loc
01/22/17
219/252
Appendix D
*
*
*
*
*
*
*
WINDOW_CEN_Y_LOC
MAIN_MENU_SWITCH_COLS
ENABLE_MAIN_MENU_SWITCH
01/22/17
220/252
Appendix E
MSC.Patran Architecture
01/22/17
221/252
Appendix E
MSC.Patran is architected into 5 major areas:
01/22/17
222/252
Appendix F
Shareware Compiling Functions
01/22/17
223/252
Appendix F
The MSC.Patran Utilities or Shareware library contains several
useful functions for compiling PCL that augment the basic !!
COMPILE functionality. In addition to compiling the function into a
PCL library, these functions first pass the function to be compiled
through the C-preprocessor. Thus, these functions are useful in
the event that it is impossible or inconvenient to use make and a
Makefile.
The functions are contained in the bv_pcl class and can be
executed at the MSC.Patran command line. The compile()
function compiles a single PCL file into a PCL library while the
compile_all() function compiles all files in the current
directory/folder with a .pcl extension into a PCL library.
Complete function descriptions and argument lists are given
below.
bv_pcl.compile(file_name, plb_name)
DESCRIPTION
Same as !!COMPILE file_name plb_name except that the
file_name is passed through the C-preprocessor (cpp) prior
to compiling. Thus, by using this function you do not need
to use make and a makefile prior to compiling. Note
that if the PCL library does not exist, it is created.
INPUT
file_name
String[]
plb_name
String[]
OUTPUT
<None>
EXAMPLE
bv_pcl.compile(My_very_own_pcl.pcl, My_pcl_library.plb)
MSC.Patran PCL Workshop Notes
01/22/17
224/252
Appendix F
bv_pcl.compile_all(plb_name)
DESCRIPTION
Same as bv_pcl.compile() except that all files with a
.pcl extension in the current directory/folder are
compiled. Note that special MSC.Patran files such as
settings.pcl or p3epilog.pcl are not compiled.
INPUT
plb_name
String[]
OUTPUT
<None>
EXAMPLE
bv_pcl.compile_all(My_pcl_library.plb)
01/22/17
225/252
Appendix G
Parametric Patran
01/22/17
226/252
Appendix G
01/22/17
227/252
Appendix G
Variables
Macros
Outputs
Variable definition
Variable name
Optional description
Current value
Macro definition
01/22/17
228/252
Appendix G
Output definition
01/22/17
229/252
Appendix G
Notes
An environment variable:
PARAMETRIC_MODELING_CONFIG_FILE
This must be set prior to the MSC.Patran session.
A PCL function:
parametric_modeling_util.define_user_config_file(config_file)
01/22/17
230/252
Appendix G
is
is
is
is
is
is
an integer
a 3 word integer array
a real
a 4 word real array
a string variable, note no quotes
a string array, again no quotes
01/22/17
231/252
Appendix H
Additional List Processor Notes
01/22/17
232/252
Appendix H
List Processor Mechanics
01/22/17
233/252
Appendix H
List Processor Functions
The first lp_ function used is the lp_eval function. The lp_eval
command:
Evaluates the Picklist using a filter method, (lpenums.i)
A Picklist is evaluated for specific information. If a Picklist is
evaluated for GEOMETRY, then all FEM entities are skipped over.
LP_EVAL_BARE_PARSE
LP_EVAL_PARSE_AND_EXPAND
LP_EVAL_FOR_TOKENS
LP_EVAL_FOR_ID
For retrieving label / ID info
LP_EVAL_FOR_LABEL
LP_EVAL_FOR_GEOMETRY
For retrieving atttribute info
LP_EVAL_FOR_FEM_DEFINITION
LP_EVAL_FOR_PICKLIST_ENUMERATION
LP_EVAL_FOR_PICKLIST_NORMALIZATION
LP_EVAL_FOR_PICKLIST_ADD
LP_EVAL_FOR_PICKLIST_DELETE
01/22/17
234/252
Appendix H
List Processor Sublist Functions
lp_sublist_ Function
lp_sublist_type()
lp_sublist_count()
Use
To get the current sublist type being
referenced.
Counts the number of items in a given
sublist based on the sublist filter.
(The return count for LP_SUBLIST_POINT includes
finite element nodes and geometric points)
/* lpenums.i SublistType
filters for LpSublistType */
next sublist.
#define
#define
#define
#define
#define
#define
LP_SUBLIST_POINT_IMMEDIATE
LP_SUBLIST_VECTOR_IMMEDIATE
LP_SUBLIST_POINT
LP_SUBLIST_CURVE
LP_SUBLIST_SURFACE
LP_SUBLIST_SOLID
#define LP_SUBLIST_GEOMETRY \
(LP_SUBLIST_POINT_IMMEDIATE+LP_SUBLIST_VECTOR_IMMEDIATE+\
LP_SUBLIST_POINT+LP_SUBLIST_CURVE+LP_SUBLIST_SURFACE+\
LP_SUBLIST_SOLID+LP_SUBLIST_PLANE+LP_SUBLIST_VECTOR+\
LP_SUBLIST_PLANE_IMMEDIATE)
#define
#define
#define
#define
#define
#define
LP_SUBLIST_COORD_FRAME
LP_SUBLIST_VECTOR
LP_SUBLIST_AXIS
LP_SUBLIST_NODE
LP_SUBLIST_ELEMENT
LP_SUBLIST_MPC
#define LP_SUBLIST_FINITE_ELEMENT \
(LP_SUBLIST_NODE+LP_SUBLIST_ELEMENT+LP_SUBLIST_MPC)
#define LP_SUBLIST_PLANE
#define LP_SUBLIST_ANY
lp_sublist_next()
01/22/17
235/252
Appendix H
List Processor Attribute Functions
Use
Return an integer value from a
Picklist with a specified
attribute.
lp_sublist_attribute_get_float()
lp_sublist_attribute_get_string()
lp_sublist_attribute_get_inta()
lp_sublist_attribute_get_floata()
LP_ATTRIBUTE_ID
#define LP_ATTRIBUTE_ORIGINAL_PARSE_SUBCLASS
LP_ATTRIBUTE_LABEL
#define LP_ATTRIBUTE_ORIGINAL_PARSE_SUBCLASS_ID
LP_ATTRIBUTE_GEOMETRY
#define LP_ATTRIBUTE_GEOMETRY_IN_NATIVE_FORM
LP_ATTRIBUTE_GEOMETRY_TYPE
#define LP_ATTRIBUTE_U_VALUE
LP_ATTRIBUTE_GEOMETRY_FORMAT
#define LP_ATTRIBUTE_V_VALUE
LP_ATTRIBUTE_GEOMETRY_COMPANY_OF_ORIGIN
#define LP_ATTRIBUTE_TOKEN_VALUE
LP_ATTRIBUTE_ORIGIN
#define LP_ATTRIBUTE_EVALUATED_POINT
LP_ATTRIBUTE_ROTATION_MATRIX
#define LP_ATTRIBUTE_POINT_COUNT
LP_ATTRIBUTE_COORDINATE_FRAME_TYPE
#define LP_ATTRIBUTE_CURVE_COUNT
LP_ATTRIBUTE_LOCATION
#define LP_ATTRIBUTE_SURFACE_COUNT
LP_ATTRIBUTE_DISPLACEMENT
#define LP_ATTRIBUTE_SOLID_COUNT
LP_ATTRIBUTE_BASE
#define LP_ATTRIBUTE_POINT_LIST
LP_ATTRIBUTE_TIP
#define LP_ATTRIBUTE_CURVE_LIST
LP_ATTRIBUTE_CLASS_NAME
#define LP_ATTRIBUTE_SURFACE_LIST
LP_ATTRIBUTE_TOPOLOGY_ID
#define LP_ATTRIBUTE_SOLID_LIST
LP_ATTRIBUTE_DIMENSIONALITY
#define LP_ATTRIBUTE_SIDE_NUMBER
LP_ATTRIBUTE_FACE_NUMBER
#define LP_ATTRIBUTE_NORMAL
LP_ATTRIBUTE_EDGE_NUMBER
#define LP_ATTRIBUTE_PLANE_COUNT
LP_ATTRIBUTE_VERTEX_NUMBER
#define LP_ATTRIBUTE_PLANE_LIST
LP_ATTRIBUTE_NODE_COUNT
#define LP_ATTRIBUTE_VECTOR_COUNT
LP_ATTRIBUTE_NODE_LIST
#define LP_ATTRIBUTE_VECTOR_LIST
LP_ATTRIBUTE_ORIGINAL_PARSE_CLASS
LP_ATTRIBUTE_ORIGINAL_PARSE_SUBCLASS_TOPOLOGICAL_CONTEXT
01/22/17
236/252
Appendix H
Miscellaneous List Processor Functions
lp_print_sublist()
lp_eval_cleanup()
lp_sublist_reset()
fem_u_count_id_list()
fem_u_extract_node_ids()
fem_u_get_id_list()
app_count_id_list()
Use
Print the entire Picklist from the
anchor block to standard out.
Prints to stdout.
Print the sublist prepared by
lp_sublist_type from the anchor
block to standard out. Good for
determining the attributes
associated with a sublist item.
Frees allocated memory for list
processor operations. This should
be performed after lp_ operations
are complete
Reset the sublist parser to resume
parsing the original Picklist.
Quick function to count the
entities of a specified list
processor sublist type without
having to use all the other lp_
commands.
Quick function to extract the array
of nodes IDs from a Picklist.
Quick function to
entities ids of a
processor sublist
having to use all
commands.
return the
specified list
type without
the other lp_
01/22/17
237/252
Appendix H
List Processor Examples
Sublist Evaluation for Attributes
Attribute Examples
SubList
Attribute Definition
Point
Label 2
Id 2
GeometryInNativeForm [0. 0. 0. 0. 1. 0.]
GeometryType CartesianPoint
GeometryCompanyOfOrigin PATRAN
EvaluatedPoint [0.0 1.0 0.0]
Element
Id 50
ClassName Bar2
TopologyId 2
Dimensionality 1
NodeCount 2
NodeList [58 57]
Node
Id 12
Location [0.428571 0.142857 0.000000]
Code example
lp_sublist_attribute_get_int(handle,LP_ATTRIBUTE_LABEL,id)
Returns the label of the current item based on anchor position
lp_sublist_attribute_get_floata(handle_fem,
LP_ATTRIBUTE_LOCATION,BYTES_PER_REAL*3,xyz,size)
Returns Node or Point coordinates as a real array
lp_sublist_attribute_get_inta(handle_fem,
LP_ATTRIBUTE_NODE_LIST,BYTES_PER_INTEGER*cnt(1),nodes,size)
Returns an integer array of nodes associated to an element.
01/22/17
238/252
Appendix H
List Processor PCL Function
Sample PCL, retrieving a list of node labels and the count from a select databox.
FUNCTION get_n_ids(sdbox_wid, num_nodes, node_labels)
/*
* This function returns the node labels and count
* from the picklist of a select databox.
*
* INPUT: select databox widget ID
*
* OUTPUT: node_labels INTEGER ARRAY
Node labels
*
num_nodes
INTEGER
Number of nodes found
*
* This function is the equivalent of fem_u_extract_nodes_ids
*
* Equivalent procedure:
*
* ui_wid_get(sdbox,"VALUE",picklist)
* num_nodes = fem_u_count_id_list(LP_SUBLIST_NODE,picklist,TRUE)
* sys_allocate_array(node_labels,1,num_nodes)
* fem_u_extract_node_ids(picklist,num_nodes,node_labels)
*
*/
#include "lpenums.p"
WIDGET
INTEGER
INTEGER
INTEGER
INTEGER
LOGICAL
REAL
STRING
sdbox_id
num_nodes, node_labels()
i, status
list_type, handle, id(1), ints(2)
node_ids(VIRTUAL)
end_of_list = FALSE
reals(2)
picklist[VIRTUAL], str[10](2)
01/22/17
239/252
Appendix H
i = 0
REPEAT
/* Retrieve the sublist type */
status = lp_sublist_type(handle, LP_SUBLIST_ANY, list_type)
/* Print the sublist */
lp_print_sublist(handle)
IF(list_type == LP_SUBLIST_NODE) THEN
status = lp_sublist_attribute_get_int(handle, LP_ATTRIBUTE_LABEL, id)
IF(status != 0 ) THEN /* If error, print the error message and exit */
msg_to_form(status, 3, 0, ints, reals, str)
RETURN (-1)
END IF
i += 1
node_ids(i) = id
END IF
/* Get the next node */
status = lp_sublist_next(handle)
IF (status != 0 ) then
end_of_list = TRUE
END IF
UNTIL(i == num_nodes || end_of_list)
write(node_ids)
/* Set return variables to captured values */
sys_allocate_array(node_labels, 1, num_nodes)
sys_move_raw(node_ids, node_labels)
RETURN 0
END FUNCTION
01/22/17
240/252
Appendix H
List Processor Example, Pointer, (Anchor) Mechanics
Example
Elm 1
4
1
Point 55 56 Node 34
2
lp_eval(picklist,LP_EVAL_LABEL,handle)
Evaluate the Picklist for Labels
l
lp_sublist_next(handle)
2
lp_sublist_next(handle)
3
lp_sublist_reset(handle)
Resets to beginning of picklist
4
lp_eval_cleanup(handle)
Terminates parsing for handle
01/22/17
241/252
Appendix H
Easy to Use List Processor Functions
Example
#include lpenums.p
FUNCTION get_selected_elms(picklist, num_elms, elm_ids)
INTEGER status
INTEGER num_elms, elm_ids()
STRING
picklist[]
num_elms = FEM_U_COUNT_ID_LIST(LP_SUBLIST_ELEMENT, @
picklist, FALSE, status)
IF (num_elms == 0) THEN
UI_WRITE(No elements selected!); RETURN (-1)
END IF
SYS_ALLOCATE_ARRAY(elm_ids, 1, num_elms)
status = FEM_U_GET_ID_LIST(LP_SUBLIST_ELEMENT, picklist, @
num_elms, FALSE, elm_ids)
RETURN (status)
END FUNCTION
MSC.Patran PCL Workshop Notes
01/22/17
242/252
Appendix H
01/22/17
243/252
Appendix I
Key Mapping
01/22/17
244/252
Appendix I
01/22/17
245/252
Appendix I
01/22/17
246/252
Appendix J
Widget Classification
01/22/17
247/252
Appendix J
Buttons
Databoxes
Toggles
Switches
Listboxes
01/22/17
248/252
Appendix J
CLASS my_class
CLASSWIDE WIDGET main_form, my_opt_menu
FUNCTION init()
my_opt_menu = ui_optionmenu_create(main_form, @
my_opt_menu_cb, x_loc, y_loc, 0, @
Action:, TRUE)
ui_item_create(my_opt_menu, C, Create, FALSE)
ui_item_create(my_opt_menu, E, Edit,
FALSE)
ui_item_create(my_opt_menu, D, Delete, FALSE)
$ ui_item_create(parent, name, label, toggleable)
END FUNCTION
FUNCTION my_opt_menu_cb(value)
STRING value[]
SWITCH (value)
case (C)
/* display create options */
case (E)
/* display edit options */
case (D)
/* display delete options */
END SWITCH
END FUNCTION
END CLASS
MSC.Patran PCL Workshop Notes
01/22/17
249/252
Appendix J
01/22/17
250/252
Appendix K
User Defined AOM
01/22/17
251/252
Appendix K
01/22/17
252/252