Patran的PCL用户手册 - 图文

2019-03-10 22:21

MSC.Patran PCL Handbook

FUNCTION init() WIDGET id INTEGER i, status REAL x_loc, y_loc, form_width, form_height REAL frame_width REAL f_width, half_space 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 ................................................................................................................................ 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 ....................................................................................................... 24 Overview ............................................................................................................................................................... 24 PCL Expressions ...................................................................................................................... 26 Expressions, Comments, Syntax Tips .............................................................................................................. 26 Identifiers .................................................................................................................................. 28 Naming Conventions ........................................................................................................................................... 28 Variable / Function Scope................................................................................................................................... 29 Structure of a PCL Function .................................................................................................... 30 Function Basics ................................................................................................................................................... 30 Simple PCL function Example ........................................................................................................................... 31 Exercise 2: Hello World! .......................................................................................................... 33 Exercise 3: Effective PCL ........................................................................................................ 34 PCL Operators .......................................................................................................................... 35 String comparisons ............................................................................................................................................. 35 PCL Variables and Constants ................................................................................................. 36 Datatypes.............................................................................................................................................................. 36 Variable Scope ..................................................................................................................................................... 37 Directly Allocated Arrays .................................................................................................................................... 38 Virtual arrays ........................................................................................................................................................ 39 Virtual strings ...................................................................................................................................................... 41 Loop Control Statements ......................................................................................................... 42

MSC.Patran PCL Workshop Notes 04/13/16 2/236

For Loop ............................................................................................................................................................... 42 While Loop ........................................................................................................................................................... 42 Repeat Loop ......................................................................................................................................................... 43 BREAK .................................................................................................................................................................. 44 CONTINUE ............................................................................................................................................................ 45

Exercise 4: Writing Files .......................................................................................................... 46 Exercise 5: Reading Files ........................................................................................................ 48 Conditional Control Statements .............................................................................................. 49 IF Statement ......................................................................................................................................................... 49 SWITCH Statement .............................................................................................................................................. 50 Structure of a PCL Function .................................................................................................... 51 Compiling and Linking PCL Functions................................................................................... 54 Primary PCL Directives ....................................................................................................................................... 55 Compiling PCL outside of MSC.Patran ............................................................................................................. 59 Linking Compiled Libraries ................................................................................................................................ 60 Other PCL Directives ........................................................................................................................................... 61 Start Up Files ....................................................................................................................................................... 62 Exercise 6: p3epilog.pcl........................................................................................................... 63 Debugging ................................................................................................................................. 64 Debugging Compile Errors ................................................................................................................................. 64 Debugging Runtime Errors................................................................................................................................. 65 Accessing PCL Functions ....................................................................................................... 67 From The Command Line ................................................................................................................................... 67 From Any MSC.Patran Form .............................................................................................................................. 68 PCL Functions with Field Variables .................................................................................................................. 69 MSC.Patran Built-In Functions ................................................................................................ 70 Naming Conventions for Applications .............................................................................................................. 71 Naming Conventions for Other Operations ...................................................................................................... 72 Exercise 7: Group Elements By Shape................................................................................... 74 Graphical User Interface .......................................................................................................... 75 The PCL Class Statement ................................................................................................................................... 76 PCL Widgets ........................................................................................................................................................ 77 Required Functions for Building/Displaying a Form ....................................................................................... 78 The init() Function ....................................................................................................................................................... 78

The Function.............................................................................................................................................. 79 Widget Callbacks ................................................................................................................................................. 82 What Are They? ................................................................................................................................................................ 82 What Are They Used For? ................................................................................................................................................ 83

display()

MSC.Patran PCL Workshop Notes 04/13/16 3/236

Callback Arguments (Widget Function Data) ................................................................................................................... 83 Widget Placement ................................................................................................................................................ 85 Widget Variables .................................................................................................................................................. 87 Modifying Widgets ............................................................................................................................................... 88 Getting Data from Widgets ................................................................................................................................. 89 Putting it all Together (Example) ....................................................................................................................... 90

Exercise 8: Simple Form .......................................................................................................... 92 The C-Preprocessor and Include Files ................................................................................... 93 Make Files ............................................................................................................................................................ 94 Exercise 9: Callbacks ............................................................................................................... 96 Handling Errors and Messaging ............................................................................................. 98 Errors from Built-In Functions ........................................................................................................................... 98 Custom Error Messages ..................................................................................................................................... 99 Using User Messages Database ........................................................................................................................................ 99 Without a Messages Database ......................................................................................................................................... 100 Taking Advantage of the UNDO Feature ......................................................................................................... 102 Select Mechanism .................................................................................................................. 103 Select Mechanism GUI Mechanics .................................................................................................................. 103 Select Databoxes, Select Frames, and Select Menus ...................................................................................................... 103 GUI PCL Example .......................................................................................................................................................... 105 List Processor .................................................................................................................................................... 106 List Processor Mechanics ................................................................................................................................................ 106 All You Really Need to Know ........................................................................................................................................ 107 Exercise 10: Form to Group Elms By Shape ........................................................................ 110 Executing Programs Outside of MSC.Patran ....................................................................... 112 Spawning Remote Processes .......................................................................................................................... 112 Locking a database ........................................................................................................................................... 114 Using C and Fortran executables to access a MSC.Patran database directly. ........................................... 115 External Access of an MSC.Patran Database ................................................................................................. 116 Special Widgets ...................................................................................................................... 118 File Widget ......................................................................................................................................................... 118 Spreadsheet Widget .......................................................................................................................................... 121 Exercise 11: File Widget ........................................................................................................ 122 Adding Help/Description to your PCL .................................................................................. 123 Percent Complete ................................................................................................................... 124 Functions............................................................................................................................................................ 124 Example .............................................................................................................................................................. 124 Event Manager ........................................................................................................................ 125

MSC.Patran PCL Workshop Notes 04/13/16 4/236

General ............................................................................................................................................................... 125 Functions............................................................................................................................................................ 126 Example .............................................................................................................................................................. 126

Primitive Graphics .................................................................................................................. 127 Graphic Objects ................................................................................................................................................. 127 Graphic Segments ............................................................................................................................................. 128 Example .............................................................................................................................................................. 129 Another Example ............................................................................................................................................... 130 Exercise 12: Primitive Graphics ............................................................................................ 131 MSC.Patran Customization .................................................................................................... 132 Adding Utility Programs to the Main Menu ..................................................................................................... 132 Example .......................................................................................................................................................................... 133 Example: p3_user_menu.my_menu.def .......................................................................................................................... 134 Customizing the MSC.Patran Toolbar ............................................................................................................. 135 Exercise 13: Pulldown Menu ................................................................................................. 138 Exercise 14: Toolbar .............................................................................................................. 139 Some Final Thoughts ............................................................................................................. 141 Appendix A ............................................................................................................................. 144 Built-in Function Examples .............................................................................................................................. 144 Documentation for a typical MSC.Patran built-in function. .......................................................................... 145 To get all the nodes and their global coordinates ......................................................................................... 146 To get the topology of every element .............................................................................................................. 147 To get the shape of every element .................................................................................................................. 148 To get all the element connectivity for all elements ...................................................................................... 149 To get the elements associated to a particular element property set ......................................................... 150 To get an element property value (shell thickness) for a specific element ................................................. 151 To get a material property value ...................................................................................................................... 153 To get a list of all groups .................................................................................................................................. 154 To get the nodes and elements associated to the current group ................................................................ 154 To get result values for specified elements .................................................................................................... 155 Appendix B ............................................................................................................................. 164 Strings & String Functions ............................................................................................................................... 164 Declaration ......................................................................................................................................................... 165 Initialization ........................................................................................................................................................ 165 String Comparisons .......................................................................................................................................... 165 Functions............................................................................................................................................................ 166 Appendix C ............................................................................................................................. 174 Noteworthy Functions ....................................................................................................................................... 174 sys_move_raw(…) ............................................................................................................................................. 175 mth_array_search(…) ........................................................................................................................................ 176 mth_sort(…) ....................................................................................................................................................... 177 mth_sort_row(…) ............................................................................................................................................... 178 mth_sort_column(…) ........................................................................................................................................ 178

MSC.Patran PCL Workshop Notes 04/13/16 5/236


Patran的PCL用户手册 - 图文.doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:12年7月劳动法串讲资料

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: