patran 2010 pcl and customization

Click here to load reader

Post on 18-Nov-2014

113 views

Category:

Documents

0 download

Embed Size (px)

DESCRIPTION

This manual describes how to use PCL to customize Patran by adding new functionalities.

TRANSCRIPT

Patran 2010PCL and Customization

CorporateMSC.Software Corporation 2 MacArthur Place Santa Ana, CA 92707 USA Telephone: (800) 345-2078 Fax: (714) 784-4056

EuropeMSC.Software GmbH Am Moosfeld 13 81829 Munich, Germany Telephone: (49) (89) 43 19 87 0 Fax: (49) (89) 43 61 71 6

Asia PacificMSC.Software Japan Ltd. Shinjuku First West 8F 23-7 Nishi Shinjuku 1-Chome, Shinjuku-Ku Tokyo 160-0023, JAPAN Telephone: (81) (3)-6911-1200 Fax: (81) (3)-6911-1201

Worldwide Webwww.mscsoftware.com

DisclaimerThis documentation, as well as the software described in it, is furnished under license and may be used only in accordance with the terms of such license. MSC.Software Corporation reserves the right to make changes in specifications and other information contained in this document without prior notice. The concepts, methods, and examples presented in this text are for illustrative and educational purposes only, and are not intended to be exhaustive or to apply to any particular engineering problem or design. MSC.Software Corporation assumes no liability or responsibility to any person or company for direct or indirect damages resulting from the use of any information contained herein. User Documentation: Copyright 2010 MSC.Software Corporation. Printed in U.S.A. All Rights Reserved. This notice shall be marked on any reproduction of this documentation, in whole or in part. Any reproduction or distribution of this document, in whole or in part, without the prior written consent of MSC.Software Corporation is prohibited. The software described herein may contain certain third-party software that is protected by copyright and licensed from MSC.Software suppliers. Contains IBM XL Fortran for AIX V8.1, Runtime Modules, (c) Copyright IBM Corporation 1990-2002, All Rights Reserved. MSC, MSC/, MSC Nastran, MD Nastran, MSC Fatigue, Marc, Patran, Dytran, and Laminate Modeler are trademarks or registered trademarks of MSC.Software Corporation in the United States and/or other countries. NASTRAN is a registered trademark of NASA. PAM-CRASH is a trademark or registered trademark of ESI Group. SAMCEF is a trademark or registered trademark of Samtech SA. LS-DYNA is a trademark or registered trademark of Livermore Software Technology Corporation. ANSYS is a registered trademark of SAS IP, Inc., a wholly owned subsidiary of ANSYS Inc. ACIS is a registered trademark of Spatial Technology, Inc. ABAQUS, and CATIA are registered trademark of Dassault Systemes, SA. EUCLID is a registered trademark of Matra Datavision Corporation. FLEXlm is a registered trademark of Macrovision Corporation. HPGL is a trademark of Hewlett Packard. PostScript is a registered trademark of Adobe Systems, Inc. PTC, CADDS and Pro/ENGINEER are trademarks or registered trademarks of Parametric Technology Corporation or its subsidiaries in the United States and/or other countries. Unigraphics, Parasolid and I-DEAS are registered trademarks of UGS Corp. a Siemens Group Company. All other brand names, product names or trademarks belong to their respective owners.

P3:V2010:Z:CUS:Z: DC-USR-PDF

ContentsPCL and Customization

PCL a tion,

1

Introduction to CustomizationUnderstanding PCL 2 3 Steps to Adding a New Functionality to Patran

2

The PATRAN Command Language (PCL) IntroductionIntroduction 6 Basic Concepts 7 Patran and PCL 7 PCL Commands 7 PCL Comments 7 PCL Embedded in NOODL Commands and Databoxes Identifiers 8 Directives 9 PCL Variables and Constants Data Types 10 Scope 12 Arrays 13 Variable Initialization 17 Argument Declaration 18 PCL Operators and Expressions Hierarchy of Operators 19 Control Statements 21 Branching 21 Break and Continue 21 Simple If Then 21 If Then Else 21 Switch and Case 22 Looping 23 For 23 While 23 Repeat 24 10

8

19

4 PCL and Customization

List

24

PCL Functions 25 Structure of a PCL Class 25 Structure of a PCL Function 26 Accessing PCL Functions 28 Libraries 28 Path Directive 29 The C Preprocessor 31 33

Finding Programming Errors with PCL Trace Directive 33 Debug Directive 33 Initializing the Session 35 PCL Start-Up File 35 Session Files Support in PCL

35

3

Basic FunctionsIntrinsic Functions 44 Math Functions 44 String Functions 59 Block I/O Functions 78 File Utility Functions 81 Record I/O Utility Functions 97 Stream I/O File Utility Functions 110 String I/O Conversion Utility Functions Text File I/O Utility Functions 126 Virtual I/O Scratch File Utility Functions Console I/O Functions 144 Message System Functions 155 Event Manager 161 Session File Functions 163 Obsolete File I/O Functions 169 Graphics Functions 175 Graphics Manager 175 Retained Graphics 175

120 136

4

System and Utility FunctionsSpawning a Process 186

CONTENTS 5

Database Locking System Functions

187 188

5

User Interface and List Processor FunctionsIntroduction 220 General Form Style 225 General Forms 225 General Widgets 229 Box Widgets 239 Switch 244 Creating Forms and Widgets Using PCL widget Function Descriptions 256 246

List Processor 258 File lpenums.i 259 Example: Creating a Simple Customized Menu and Form User Interface Functions 297

293

6

Creating New Analysis Forms Using PCLIntroduction 422 423 Updating Patran Release 1.1 Analysis Forms Naming Convention 424 425 426

The Analysis PCL Library

Contents of the Analysis Library The Main Analysis Form 427

Main Analysis Form Functions 429 Changing the Appearance 429 _load_aom_data 432 Subordinate Analysis Forms and Functions The Class 438 Fetching Data From analysis_main 440

437

6 PCL and Customization

7

Modifying the Database Using PCLIntroduction 446 447 451 452 Querying the Patran Database

Loading Definitions for MSC Supported Preferences Loading Definitions for User Defined Preferences Loading Basic Definitions 453 459

Adding A New Analysis Preference 454 Custom Data and Application Region Sub-Forms Adding New Element Types/Properties Adding the New Material Properties 517 468

Adding New Loads and Boundary Conditions Adding Custom General Field Functions Adding Functions to the Database 568 Evaluator PCL 570 An Example Case 574 567

540

Adding New Multi-Point Constraint Definitions Adding Element Verification Parameters Examples of Modifying the Database 586 582

577

8

Accessing the Patran DatabaseIntroduction 591 592 593 Syntax of Documented Calls

Calling the Database Access Functions from C and FORTRAN External Access of the Patran Database Miscellaneous Database Functions Groups 600 602 607 596 595

Nodes 602 Exporting Node Data Importing Node Data

CONTENTS 7

Coordinate Frames 609 Exporting Coordinate Frame Data Importing Coordinate Frame Data Patran Element Topology Codes Elements 615 Exporting Element Data Importing Element Data 615 622

609 609 613

Element Properties 625 Exporting Element Property Data Importing Element Property Data

625 635 640

Association between Elements and Element Properties 640 Extracting Association between Elements and Element Properties Data Fields 643 Importation of Data Fields 653

Material Properties 672 Exportation of Material Data 672 Importation of Material Data 683 Exportation of Composite Material Creation Data Load Cases 692 Exportation of Load Case Definitions 692

687

Loads 700 Evaluation of Loads on Finite Element Entities Exportation of Load Data 700 Importation of Load Data 729 Multi-point Constraints 751 Exportation of Multi-point Constraint Data Importing Results 767 Drop Results Indexing 767 Create/Find Loadcases 768 Associate Global Variables 770 Create Result Types 770 751

700

Examples of Translation 790 Results Reader 790 Extracting Temperature Dependent and/or Non-Linear Material Data Extracting Transient Load Histories 812 Forward Moldflow Translator 816

797

8 PCL and Customization

9

PATRAN 2.5 Database CompatibilityIntroduction 822 823 PATRAN 2.5 Compatible Database Functions

10

Broken, Obsolete, Modified and New FunctionsIntroduction 842 843 844 847 865 Basic Functions (Chapter 3)

System and Utility Functions (Chapter 4)

User Interface and List Processor Functions (Chapter 5) Possible parm names: 854 Creating New Analysis Forms Using PCL (Chapter 6) Modifying the Database Using PCL (Chapter 7) Accessing the Patran Database (Chapter 8) 873 879 866

PATRAN 2.5 Database Compatibility (Chapter 9)

Chapter 1: Introduction to Customization PCL and Customization

1

Introduction to Customization

Understanding PCL Steps to Adding a New Functionality to Patran

2 PCL and CustomizationUnderstanding PCL

Understanding PCLThe PATRAN Command Language, or PCL, is central to all Patran customization. PCL is used to: Create functions to be called directly from Patran. Create forms and widgets. Call functions from all areas of Patran including all applications, graphics, the user interface, and

the database. Spawn individual remote processes outside of Patran.

The chapters listed below will present information covering all of these topics. The PATRAN Command Language (PCL) Introduction User Interface and List Processor Functions System and Utility Functions

For more information concerning a particular function, refer to the Introduction (p. 9) in the PCL Reference Manual. Important:As with any powerful programming language, the user is encouraged to take formalized training available from the MSC Institute of Technology to best exploit the underlying functionality and to minimize resulting problems.

Chapter 1: Introduction to Customization 3Steps to Adding a New Functionality to Patran

Steps to Adding a New Functionality to PatranIn order to add a new analysis code to Patran three steps must be performed. First, modify the database to contain data about the new analysis code. This is done through PCL function calls. The resulting database will possess the information needed to display the new analysis code on the analysis preferences form. The preferences form allows the creation of element property, material property, loads and boundary condition, and multi-point constraint forms specific to the new analysis code. Also, element verification parameters specific to the new analysis code can be employed. This first step is fully described in Modifying the Database Using PCL. Second, specific PCL functions to control the Analysis forms used for the new analysis code must be created. These routines will be used to create a PCL library which will be brought into Patran automatically when the analysis preference is set to the new analysis code. These forms can be as simple or as complex as desired. Creation of these Analysis forms is described in detail in Creating New Analysis Forms Using PCL. Third, a translator must be created to import and export data to and from the Patran database. The functions used to extract, add or evaluate data stored in a database are discussed in the final two chapters. Accessing the Patran Database (Ch. 8) describes the standard Patran database interface, and PATRAN 2.5 Database Compatibility (Ch. 9) discusses database functions which are compatible with PATRAN 2.5.

4 PCL and Customization

Steps to Adding a New Functionality to Patran

Chapter 2: The PATRAN Command Language (PCL) Introduction PCL and Customization

2

The PATRAN Command Language (PCL) Introduction

Introduction

6 7 10 19

Basic Concepts

PCL Variables and Constants PCL Operators and Expressions Control Statements PCL Functions 25 31 21

The C Preprocessor

Finding Programming Errors with PCL Initializing the Session 35

33

6 PCL and CustomizationIntroduction

IntroductionThe PATRAN Command Language (PCL) is a programming language which is an integral part of the Patran system. It can be used to write application or site specific commands and forms, perform variational or connatural modeling, and completely integrate commercial or in-house programs. The entire Patran user interface is driven by PCL. PCL is a high level block structured language. It provides many features found in traditional programming languages including: Operators for arithmetic, relational, and string expressions. Intrinsic functions for math, string, and other operations. Variables with type, scope, and dimension attributes. Dynamically allocated virtual strings and arrays. Loop control structures such as WHILE, FOR, LIST, and REPEAT. Conditional control such as IF-THEN-ELSE and SWITCH-CASE. Subroutine and function calls from within PCL functions. Class grouping of related functions. Read/write access to external files. Support for PATRAN 2.5 NOODL rule. Preference to user interfaces, applications, databases, and graphics. PCL specific start-up files. Text output to the history window, session file, or TTY terminal.

PCL is a complete MCAE programming environment that greatly enhances the versatility of the Patran system. Some of the benefits of PCL include: Application specific commands provide more accurate modeling. For example, pressure applied

as a function of chord length along a turbine blade. In-line expressions make Patran more versatile for the everyday user. Allows Patran to be integrated more easily and completely with other commercial or in-house

codes. Provides a mechanism for parametric design studies. Patran may be customized to service specific customer requirements.

Chapter 2: The PATRAN Command Language (PCL) Introduction 7Basic Concepts

Basic ConceptsPatran and PCLPCL is tightly coupled with Patran. The user interface system is integrated with PCL via callbacks. What this means is whenever a menu item is selected or a button clicked on, a PCL function is called to process the operation. In a similar fashion, after entering a line into the command line, that line is sent to PCL for processing. If a session file for processing is selected, the session file manager passes to PCL any lines that it does not handle itself. Important:Examples in the following sections are excerpts from working PCL functions. By themselves, they are incomplete and will not execute properly.

PCL CommandsPCL statements come in many forms. Some examples of PCL statements include:theta = 360.0 - MTH_ASIND( value ) IF ( radius > 20.0 ) THEN radius = 20.0 make_gear ( 30, 100 )

PCL commands may be entered interactively through the command line, or processed in a session file or retrieved from an external PCL file or library. A PCL statement is normally terminated by a carriage return. A statement can be continued across multiple lines by using an at sign @ as the last non-blank character of the line to be continued. It is not permissible to break a statement in the middle of an identifier, keyword, or constant value. It is possible to have multiple statements on a single line by separating them with a semicolon ;. In general, break a line at a space, comma, or operator. Multiple spaces and/or tabs are treated as a single space. Exampl...