PATRAN PCL语言函数全攻略

需积分: 12 10 下载量 167 浏览量 更新于2024-07-14 2 收藏 2.64MB PDF 举报
"patran的PCL语言函数查询手册" PCL(PATRAN Command Language)是MSC.Patran软件中的脚本语言,用于自动化和定制各种分析任务。PCL语言具有丰富的功能,使得用户能够编写复杂的命令序列,以实现特定的工程计算和数据处理需求。 1. **理解PCL** PCL是MSC.Patran的核心部分,它允许用户扩展软件的功能,创建自定义的工作流程。PCL不仅包含内置的命令,还支持用户定义的函数和类,增强了其灵活性和适应性。 2. **基本概念** - **MSC.Patran与PCL**:PCL是与MSC.Patran紧密集成的语言,可以控制和扩展软件的各种操作。 - **PCL命令**:这些是PCL中的基本元素,用于执行特定任务,如读取数据、执行计算或生成报告。 - **PCL注释**:以“!”开头,用于解释代码,不被解释器执行。 - **NOODL命令和Databoxes中的嵌入式PCL**:PCL可以嵌入到NOODL(Nonlinear Object-Oriented Dynamic Link Library)命令和数据框中,以增强图形用户界面的交互性。 3. **PCL变量和常量** - **数据类型**:包括整型、实型、字符串、逻辑型等。 - **作用域**:变量在特定范围内有效,如全局或局部。 - **数组**:PCL支持一维、二维和多维数组,用于存储一组相关数据。 - **变量初始化**:变量在声明时可以赋值。 - **参数声明**:在函数定义中声明参数,用于传递值。 4. **PCL运算符和表达式** - **运算符优先级**:不同的运算符有不同的执行顺序,了解这一点有助于编写正确的表达式。 5. **控制语句** - **分支**:如IF-THEN-ELSE结构,用于根据条件执行不同代码块。 - **循环**:如WHILE、FOR循环,用于重复执行一段代码。 6. **PCL函数** - **PCL类结构**:定义类并创建对象,实现面向对象编程。 - **PCL函数结构**:包括函数定义、参数列表和函数体。 - **访问PCL函数**:通过调用来执行函数,可能涉及库和路径管理。 - **库**:函数可以组织在库中,方便管理和重用。 - **Path Directive**:用于指定查找函数库的路径。 7. **C预处理器** PCL支持C语言的预处理器指令,如宏定义和条件编译。 8. **错误检测** - **Trace Directive**:用于追踪程序执行过程,帮助调试。 - **Debug Directive**:启用调试模式,提供更详细的信息。 9. **会话初始化** - **PCL启动文件**:用户可以在启动时执行自定义的PCL代码。 - **Session Files Support in PCL**:PCL可以处理会话文件,保存和恢复工作状态。 10. **PCL命令行解释器P3PCLCOMP** 提供一个命令行界面来直接执行PCL代码,方便进行测试和调试。 通过深入理解和熟练掌握PCL,用户可以充分利用MSC.Patran的强大功能,定制自己的工程分析流程,提高工作效率。这份查询手册将为用户提供详细的指导,帮助他们更好地利用PCL语言。
2009-04-17 上传
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 for Everyone 10 Entering Equations 10 Entering Data 11 Session Files 12 Rebuilding Models 13 PCL for the More Adventurous 16 Parametric Modeling 16 Adding a Graphical User Interface, GUI 20 Exercise 1: Session Files 21 PCL Programming Basics 23 Overview 23 PCL Expressions 25 Expressions, Comments, Syntax Tips 25 Identifiers 27 Naming Conventions 27 Variable / Function Scope 28 Structure of a PCL Function 29 Function Basics 29 Simple PCL function Example 30 Exercise 2: Hello World! 32 Exercise 3: Effective PCL 33 PCL Operators 34 String comparisons 34 PCL Variables and Constants 35 Datatypes 35 Variable Scope 36 Directly Allocated Arrays 37 Virtual arrays 38 Virtual strings 40 Loop Control Statements 41 For Loop 41 While Loop 41 Repeat Loop 42 BREAK 43 CONTINUE 44 Exercise 4: Writing Files 45 Exercise 5: Reading Files 47 Conditional Control Statements 48 IF Statement 48 SWITCH Statement 49 Structure of a PCL Function 50 Compiling and Linking PCL Functions 53 Primary PCL Directives 54 Compiling PCL outside of MSC.Patran 58 Linking Compiled Libraries 59 Other PCL Directives 60 Start Up Files 61 Exercise 6: p3epilog.pcl 62 Debugging 63 Debugging Compile Errors 63 Debugging Runtime Errors 64 Accessing PCL Functions 66 From The Command Line 66 From Any MSC.Patran Form 67 PCL Functions with Field Variables 68 MSC.Patran Built-In Functions 69 Naming Conventions for Applications 70 Naming Conventions for Other Operations 71 Exercise 7: Group Elements By Shape 73 Graphical User Interface 74 The PCL Class Statement 75 PCL Widgets 76 Required Functions for Building/Displaying a Form 77 The init() Function 77 The display() Function 78 Widget Callbacks 81 What Are They? 81 What Are They Used For? 82 Callback Arguments (Widget Function Data) 82 Widget Placement 84 Widget Variables 86 Modifying Widgets 87 Getting Data from Widgets 88 Putting it all Together (Example) 89 Exercise 8: Simple Form 91 The C-Preprocessor and Include Files 92 Make Files 93 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 Exercise 10: Form to Group Elms By Shape 109 Executing Programs Outside of MSC.Patran 111 Spawning Remote Processes 111 Locking a database 113 Using C and Fortran executables to access a MSC.Patran database directly. 114 External Access of an MSC.Patran Database 115 Special Widgets 117 File Widget 117 Spreadsheet Widget 120 Exercise 11: File Widget 121 Adding Help/Description to your PCL 122 Percent Complete 123 Functions 123 Example 123 Event Manager 124 General 124 Functions 125 Example 125 Primitive Graphics 126 Graphic Objects 126 Graphic Segments 127 Example 128 Another Example 129 Exercise 12: Primitive Graphics 130 MSC.Patran Customization 131 Adding Utility Programs to the Main Menu 131 Example 132 Example: p3_user_menu.my_menu.def 133 Customizing the MSC.Patran Toolbar 134 Exercise 13: Pulldown Menu 137 Exercise 14: Toolbar 138 Some Final Thoughts 140 Appendix A 143 Built-in Function Examples 143 Documentation for a typical MSC.Patran built-in function. 144 To get all the nodes and their global coordinates 145 To get the topology of every element 146 To get the shape of every element 147 To get all the element connectivity for all elements 148 To get the elements associated to a particular element property set 149 To get an element property value (shell thickness) for a specific element 150 To get a material property value 152 To get a list of all groups 153 To get the nodes and elements associated to the current group 153 To get result values for specified elements 154 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 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