In a Nutshell 7
What is PCL? 7
What can PCL be used for? 8
How does PCL work? 9
All you really need to know is on this page! 10
Documentation 10
PCL for Everyone 11
Entering Equations 11
Entering Data 12
Session Files 13
Rebuilding Models 14
PCL for the More Adventurous 17
Parametric Modeling 17
Adding a Graphical User Interface, GUI 21
Exercise 1: Session Files 22
PCL Programming Basics 25
Overview 25
PCL Expressions 27
Expressions, Comments, Syntax Tips 27
Identifiers 29
Naming Conventions 29
Variable / Function Scope 30
Structure of a PCL Function 31
Function Basics 31
Simple PCL function Example 32
Exercise 2: Hello World! 34
Exercise 3: Effective PCL 35
PCL Operators 36
String comparisons 36
PCL Variables and Constants 37
Datatypes 37
Variable Scope 38
Directly Allocated Arrays 39
Virtual arrays 40
Virtual strings 42
Loop Control Statements 43
For Loop 43
While Loop 43
Repeat Loop 44
BREAK 45
CONTINUE 46
Exercise 4: Writing Files 47
Exercise 5: Reading Files 49
Conditional Control Statements 50
IF Statement 50
SWITCH Statement 51
Structure of a PCL Function 52
Compiling and Linking PCL Functions 55
Primary PCL Directives 56
Compiling PCL outside of MSC.Patran 60
Linking Compiled Libraries 61
Other PCL Directives 62
Start Up Files 63
Exercise 6: p3epilog.pcl 64
Debugging 65
Debugging Compile Errors 65
Debugging Runtime Errors 66
Accessing PCL Functions 68
From The Command Line 68
From Any MSC.Patran Form 69
PCL Functions with Field Variables 70
MSC.Patran Built-In Functions 71
Naming Conventions for Applications 72
Naming Conventions for Other Operations 73
Exercise 7: Group Elements By Shape 75
Graphical User Interface 77
The PCL Class Statement 78
PCL Widgets 79
Required Functions for Building/Displaying a Form 80
The init() Function 80
The display() Function 81
Widget Callbacks 84
What Are They? 84
What Are They Used For? 85
Callback Arguments (Widget Function Data) 85
Widget Placement 88
Widget Variables 90
Modifying Widgets 92
Getting Data from Widgets 93
Putting it all Together (Example) 95
Exercise 8: Simple Form 97
The C-Preprocessor and Include Files 98
Make Files 99
Exercise 9: Callbacks 101
Handling Errors and Messaging 103
Errors from Built-In Functions 103
Custom Error Messages 104
Using User Messages Database 104
Without a Messages Database 105
Taking Advantage of the UNDO Feature 107
Select Mechanism 108
Select Mechanism GUI Mechanics 108
Select Databoxes, Select Frames, and Select Menus 108
GUI PCL Example 110
List Processor 111
List Processor Mechanics 111
All You Really Need to Know 112
Exercise 10: Form to Group Elms By Shape 115
Executing Programs Outside of MSC.Patran 117
Spawning Remote Processes 117
Locking a database 119
Using C and Fortran executables to access a MSC.Patran database directly. 120
External Access of an MSC.Patran Database 121
Special Widgets 123
File Widget 123
Spreadsheet Widget 126
Exercise 11: File Widget 127
Adding Help/Description to your PCL 128
Percent Complete 129
Functions 129
Example 129
Event Manager 130
General 130
Functions 131
Example 131
Primitive Graphics 132
Graphic Objects 132
Graphic Segments 133
Example 134
Another Example 135
Exercise 12: Primitive Graphics 137
MSC.Patran Customization 138
Adding Utility Programs to the Main Menu 138
Example 139
Example: p3_user_menu.my_menu.def 141
Customizing the MSC.Patran Toolbar 143
Exercise 13: Pulldown Menu 146
Exercise 14: Toolbar 147
Some Final Thoughts 150
Appendix A 154
Built-in Function Examples 154
Documentation for a typical MSC.Patran built-in function. 155
To get all the nodes and their global coordinates 156
To get the topology of every element 157
To get the shape of every element 159
To get all the element connectivity for all elements 160
To get the elements associated to a particular element property set 161
To get an element property value (shell thickness) for a specific element 163
To get a material property value 167
To get a list of all groups 169
To get the nodes and elements associated to the current group 169
To get result values for specified elements 171
Appendix B 180
Strings & String Functions 180
Declaration 181
Initialization 181
String Comparisons 181
Functions 182
Appendix C 190
Noteworthy Functions 190
sys_move_raw(…) 191
mth_array_search(…) 192
mth_sort(…) 193
mth_sort_row(…) 194
mth_sort_column(…) 194
fem_geom_edge_length(…) 195
fem_geom_face_area(…) 195
fem_geom_elem_volume(…) 195
fem_geom_elem_location(…) 196
Appendix D 197
Form Spacing Parameters
(appforms.p) 197
* SPACING 198
Appendix E 223
MSC.Patran Architecture 223
Appendix F 225
Shareware Compiling Functions 225
Appendix G 228
Parametric Patran 228
Appendix H 234
Additional List Processor Notes 234
List Processor Mechanics 235
List Processor Functions 236
List Processor Sublist Functions 237
List Processor Attribute Functions 238
Miscellaneous List Processor Functions 239
List Processor Examples 240
Easy to Use List Processor Functions 244
Appendix I 246
Key Mapping 246
Appendix J 249
Widget Classification 249
Appendix K 253
User Defined AOM 253