patran 2010 pcl and customization

918
Patran 2010 PCL and Customization

Upload: don

Post on 18-Nov-2014

141 views

Category:

Documents


7 download

DESCRIPTION

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

TRANSCRIPT

Patran 2010

PCL and Customization

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

Corporate Europe Asia Pacific

MSC.Software Corporation2 MacArthur PlaceSanta Ana, CA 92707 USATelephone: (800) 345-2078Fax: (714) 784-4056

MSC.Software GmbHAm Moosfeld 1381829 Munich, GermanyTelephone: (49) (89) 43 19 87 0Fax: (49) (89) 43 61 71 6

MSC.Software Japan Ltd.Shinjuku First West 8F23-7 Nishi Shinjuku1-Chome, Shinjuku-Ku Tokyo 160-0023, JAPANTelephone: (81) (3)-6911-1200Fax: (81) (3)-6911-1201

C o n t e n t sPCL and Customization

PCL and Custotion,

1 Introduction to Customization

Understanding PCL 2

Steps to Adding a New Functionality to Patran 3

2 The PATRAN Command Language (PCL) Introduction

Introduction 6

Basic Concepts 7Patran and PCL 7PCL Commands 7PCL Comments 7PCL Embedded in NOODL Commands and Databoxes 8Identifiers 8Directives 9

PCL Variables and Constants 10Data Types 10Scope 12Arrays 13Variable Initialization 17Argument Declaration 18

PCL Operators and Expressions 19Hierarchy of Operators 19

Control Statements 21Branching 21Break and Continue 21Simple If Then 21If Then Else 21Switch and Case 22Looping 23For 23While 23Repeat 24

PCL and Customization

4

List 24

PCL Functions 25Structure of a PCL Class 25Structure of a PCL Function 26Accessing PCL Functions 28Libraries 28Path Directive 29

The C Preprocessor 31

Finding Programming Errors with PCL 33Trace Directive 33Debug Directive 33

Initializing the Session 35PCL Start-Up File 35Session Files Support in PCL 35

3 Basic Functions

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

Graphics Functions 175Graphics Manager 175Retained Graphics 175

4 System and Utility Functions

Spawning a Process 186

5CONTENTS

Database Locking 187

System Functions 188

5 User Interface and List Processor Functions

Introduction 220

General Form Style 225General Forms 225General Widgets 229Box Widgets 239Switch 244

Creating Forms and Widgets Using PCL 246

widget Function Descriptions 256

List Processor 258File lpenums.i 259Example: Creating a Simple Customized Menu and Form 293

User Interface Functions 297

6 Creating New Analysis Forms Using PCL

Introduction 422

Updating Patran Release 1.1 Analysis Forms 423

Naming Convention 424

The Analysis PCL Library 425

Contents of the Analysis Library 426

The Main Analysis Form 427

Main Analysis Form Functions 429Changing the Appearance 429<analysis_code>_load_aom_data 432Subordinate Analysis Forms and Functions 437The <apply_class> Class 438Fetching Data From “analysis_main” 440

PCL and Customization

6

7 Modifying the Database Using PCL

Introduction 446

Querying the Patran Database 447

Loading Definitions for MSC Supported Preferences 451

Loading Definitions for User Defined Preferences 452

Loading Basic Definitions 453

Adding A New Analysis Preference 454Custom Data and Application Region Sub-Forms 459

Adding New Element Types/Properties 468

Adding the New Material Properties 517

Adding New Loads and Boundary Conditions 540

Adding Custom General Field Functions 567Adding Functions to the Database 568Evaluator PCL 570An Example Case 574

Adding New Multi-Point Constraint Definitions 577

Adding Element Verification Parameters 582

Examples of Modifying the Database 586

8 Accessing the Patran Database

Introduction 591

Syntax of Documented Calls 592

Calling the Database Access Functions from C and FORTRAN 593

External Access of the Patran Database 595

Miscellaneous Database Functions 596

Groups 600

Nodes 602Exporting Node Data 602Importing Node Data 607

7CONTENTS

Coordinate Frames 609Exporting Coordinate Frame Data 609Importing Coordinate Frame Data 609

Patran Element Topology Codes 613

Elements 615Exporting Element Data 615Importing Element Data 622

Element Properties 625Exporting Element Property Data 625Importing Element Property Data 635

Association between Elements and Element Properties 640Extracting Association between Elements and Element Properties 640

Data Fields 643Importation of Data Fields 653

Material Properties 672Exportation of Material Data 672Importation of Material Data 683Exportation of Composite Material Creation Data 687

Load Cases 692Exportation of Load Case Definitions 692

Loads 700Evaluation of Loads on Finite Element Entities 700Exportation of Load Data 700Importation of Load Data 729

Multi-point Constraints 751Exportation of Multi-point Constraint Data 751

Importing Results 767Drop Results Indexing 767Create/Find Loadcases 768Associate Global Variables 770Create Result Types 770

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

PCL and Customization

8

9 PATRAN 2.5 Database Compatibility

Introduction 822

PATRAN 2.5 Compatible Database Functions 823

10 Broken, Obsolete, Modified and New Functions

Introduction 842

Basic Functions (Chapter 3) 843

System and Utility Functions (Chapter 4) 844

User Interface and List Processor Functions (Chapter 5) 847Possible parm names: 854

Creating New Analysis Forms Using PCL (Chapter 6) 865

Modifying the Database Using PCL (Chapter 7) 866

Accessing the Patran Database (Chapter 8) 873

PATRAN 2.5 Database Compatibility (Chapter 9) 879

Chapter 1: Introduction to CustomizationPCL and Customization

1 Introduction to Customization

Understanding PCL

Steps to Adding a New Functionality to Patran

PCL and CustomizationUnderstanding PCL

2

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.

3Chapter 1: Introduction to CustomizationSteps 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.

PCL and CustomizationSteps to Adding a New Functionality to Patran

4

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

2 The PATRAN Command Language (PCL) Introduction

Introduction 6

Basic Concepts 7

PCL Variables and Constants 10

PCL Operators and Expressions 19

Control Statements 21

PCL Functions 25

The C Preprocessor 31

Finding Programming Errors with PCL 33

Initializing the Session 35

PCL and CustomizationIntroduction

6

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.

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

Basic Concepts

Patran 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.

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.0make_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.

Example:

IF( str_length( mystring ) >= 100 || @bigarray(n) < bigarray(n+1) ) THEN quit = TRUEx = 5; y = 10; z = x * ( y + 5 )

PCL CommentsIn PCL a comment is specified by starting with the sequence /* and ending with the sequence */. Comments may appear anywhere within a PCL statement except in the middle of a string constant. A comment may span multiple lines. A one line comment can also be specified by a dollar or pound sign as the first non-blank character. Examples of PCL comments include:

FillRadius = 5.0 /* Outside fillet radius */

and the following sequence:

/** A typical header block comment might look like this*/

Important:Examples in the following sections are excerpts from working PCL functions. By themselves, they are incomplete and will not execute properly.

PCL and CustomizationBasic Concepts

8

or a one line comment with:

$ This is a comment.# This is a comment too.

PCL Embedded in NOODL Commands and DataboxesA PCL expression can be embedded within any NOODL command by enclosing it in a set of backquote characters, ( ` ). Also PCL expressions can be embedded within most of the user interface databoxes in the same manner.

An example use of PCL within a NOODL would be:

LI,3#,ARC,5(0)/1/`30 + offset`,10

To use Patran as a calculator for example, enter:

!$` SQRT(250.) * 12.4`

and the response is made into the originating TTY window:

$ 196.0612

Be sure to preface any calculator directives with the “!$” sequence so that Patran does not attempt to process the line as a Patran command.

Another way to use Patran as a calculator is to use the write function.

WRITE (SQRT(250.) *12.4)

And the response is made into the command line:

$# 196.0612

In a user interface databox, use the backquote syntax such as:

Angle: ‘360/5‘

IdentifiersAn identifier is a one to thirty-one character name containing letters, digits, and underscores and beginning with a non-digit character. Variable names and function names are identifiers. PCL is not sensitive to uppercase and lowercase for all uses of identifiers and keywords. String contents are retained as case sensitive, but string comparisons are case insensitive.

Keywords are identifiers reserved for use by PCL. These cannot be used as variable or function names. Current PCL keywords include:

9Chapter 2: The PATRAN Command Language (PCL) IntroductionBasic Concepts

Some examples of valid identifiers are:

a, b, c, X1, x_2, InnerRadiusTryAgain, not_done

While the following are invalid:

_status, 10b(Variable names must begin with a letter.)

real, list(Variable names must not be reserved.)

This_is_Much_Much_Much_Much_too_long(Variable names may contain up to 31 characters.)

DirectivesDirectives begin with “!!” and are processed differently than regular PCL statements. Directives are processed immediately when encountered. Do not embed directives into PCL functions. Unexpected results may occur. Directive key words are:

BREAK BY CASE CLASS CLASSWIDE

CONTINUE DEFAULT DUMP ELSE END

FALSE FOR FUNCTION GLOBAL

IF INFORMATIVE INTEGER LIST

LOCAL LOGICAL ON READONLY REAL

REPEAT RETURN STATIC STRING SWITCH

THEN TO TRUE UNTIL VIRTUAL

WHILE WIDGET WIDGET_NULL

!!INPUT file Direct Patran to process all further input from the specified file.

!!LIBRARY file Access PCL libraries.

!!PATH Directory Specific directory search path for opening files.

!!TRACE option PCL execution verification.

!!DEBUG option Store PCL line contents in file for future reference when debugging PCL code.

!!COMPILE file into library

Compiles a PCL text file into library format.

!!OPTIONS option PCL environment options setting.

!!SIZE CODE newsize Set new size for compiler code area.

!!CLEAR GLOBAL name Erase definition of global variable.

!!CLEAR FUNCTION name Erase definition of a function.

PCL and CustomizationPCL Variables and Constants

10

PCL Variables and ConstantsPCL variables have the attributes of type, scope, and dimension. All variables must be defined before they are used. Variable names may be 1 to 31 characters in length. Valid variable types are integer, real, logical, string, and widget. Scope defines a variable's visibility and lifetime.

Data TypesAll PCL variables must be declared before they are used. The declaration specifies the variable's type, scope and dimension.

Dynamic

A dynamic data type is a data type that is used to describe an input argument, output argument, or return value from a built in PCL function that can be any combination of an integer, logical, real, string, or widget data type.

This data type is denoted in a PCL function description in this manual using an acronym: DYNAMIC_ILRSW. The ILRSW component in the acronym will be used to denote the exact data types that can be used with that value where I is used for an integer, L is used for logical, R is used for a real, S is used for a string, and W is used for a widget data type.

The dynamic data type is not supported by the PCL language and trying to declare a variable with a dynamic data type will generate an error. While it is possible for built in functions to use the dynamic data type, it is not possible to write a PCL function that uses this data type.

An example of a PCL function that returns a dynamic data type is the function sys_eval, 200.

Integers

An integer variable is defined by prefixing the variable name with the keyword INTEGER.

Example:

INTEGER a, b, c

An integer constant is represented by an optional plus or minus sign followed by a set of digits. The range of an integer is machine dependent but will always be able to represent a number between -2147483647 and 2147483647. It is also acceptable to use a hexadecimal constant by having the prefix 0x or 0X followed by hexadecimal digits in uppercase or lowercase.

Examples:

11Chapter 2: The PATRAN Command Language (PCL) IntroductionPCL Variables and Constants

Logicals

A logical variable is defined by prefixing the variable name with the keyword LOGICAL.

Example:

LOGICAL exit_flag

A logical constant is represented by the reserved identifiers TRUE and FALSE.

Examples:

exit_flag = TRUE

or

exit_flag = FALSE

Reals

A real variable is defined by prefixing the variable name with the keyword REAL.

Example:REAL x, y, z, height

A real constant is represented by an optional plus or minus sign followed by an optional set of digits, a required decimal point, another optional set of digits, and an optional “E” followed by an optional plus or minus sign and a set of digits. There always needs to be at least one digit before or after the decimal point. The range and precision of real numbers is machine dependent, but count on 5 digits of accuracy and an exponent range of 1.E-30 through 1.E30.

Examples:

x = 4100.06; y = -22.E-4; z = -1.0E3

Strings

A string variable is defined by prefixing the variable name with the keyword STRING and appending the maximum string length as a positive integer within square brackets.

Example:

STRING name[20], option[130]

A character string constant is represented by a double quote, a string of characters, and another double quote. A character string which spans lines should do so by splitting it into smaller pieces and

4510, -17, 0X11E0 (The first two examples show positive and negative integer constants. In the third example, the prefix 0X indicates that 11E0 is a hexadecimal constant.)

PCL and CustomizationPCL Variables and Constants

12

concatenating the pieces together. A character string has both a maximum length and a current length. The current length of a character string can be anywhere from zero up to its maximum length.

Examples:

name = “I”multiplier = “23*A”option = “A CHARACTER STRING WHICH SPANS LINES SHOULD DO SO “// @ “BY SPLITTING IT INTO SMALLER PIECES AND “// @ “CONCATENATING THE PIECES TOGETHER.”

PCL strings are variable length up to the maximum size that they are declared. Therefore, the series of statements:

STRING line[40]line = “ABC”line = line // “ ”line = line // “DEF”

produces the variable line defined as “ABC DEF” with no trailing blanks. This is quite different than the way FORTRAN strings work.

Widgets

A widget variable is defined by prefixing the variable name with the keyword WIDGET and is used only for working with the user interface routines. A widget can be assigned from a user interface function or other widget or can be compared against another widget.

Example:

WIDGET myform, mybutton

The only widget constant defined is WIDGET_NULL. If a user interface routine fails to operate sucessfully, the widget value returned will normally be WIDGET_NULL. To initialize widget variables, initialize them to WIDGET_NULL.

Examples:

IF ( myform == WIDGET_NULL ) THEN WRITE (“Form not initialized”)

ScopeScope defines a variable's visibility and lifetime. Variables that are not assigned a scope behave like LOCAL variables if declared within a function definition or like GLOBAL variables if declared outside of a function. PCL variables may have the scope of global, local, static, or classwide. These scopes are defined below.

13Chapter 2: The PATRAN Command Language (PCL) IntroductionPCL Variables and Constants

Examples:

Arrays

Directly Allocated Arrays

Any variable, regardless of its data type, can be made into an array. Arrays can have any number of subscripts. Subscripts are contained in parentheses separated by commas appended to the variable identifier. Each subscript may have a lower and upper bound separated by a colon. If the subscript range

GLOBAL Variable definition is available to all functions. Global variables become undefined when Patran terminates.

LOCAL Variable definition is local to a single function. A local definition temporarily overrides any global definition. Local variables become undefined when the function exits.

STATIC Variable definition is local to a single function. A Static variable retains its value between function calls. Static variables become undefined when Patran terminates.

CLASSWIDE Variable definition is local to a group of functions. A classwide variable retains its value between function calls. Classwide variables become undefined when Patran terminates.

Important: PCL uses a flat name space for both function names and variable names. The user should be careful not to use conflicting names for PCL variables and functions.

GLOBAL LOGICAL flag. Flag is defined global and since outside of a function definition is defined for use in the command line and in databoxes.

CLASS my_classCLASSWIDE STRING line[80]

The string line is defined within all the functions within the class my_class.

FUNCTION MY_FUNCTION (arg_list)STATIC INTEGER entries

The value established for entries in MY_FUNCTION remains the same between function calls.

LOCAL REAL x,y,z. These variables are only defined within my_function.

REAL arg_list () Since arg_list is an argument to the function, its scope is inherited from the calling function.

GLOBAL LOGICAL flag. Even though flag is defined GLOBAL outside the function, within each function definition it needs to be declared the same way. All references to flag affect the same global value.

END FUNCTIONEND CLASS

PCL and CustomizationPCL Variables and Constants

14

is not specified with a lower and upper bound, the lower bound is assumed to be one (not zero as in the C programming language). Subscript bounds may be negative or zero.

Arrays are stored in sequential order starting from the subscript to the right and moving to the left. This is opposite to the way FORTRAN stores array data, see Figure 2-1

LOCAL arrays are only allocated when the function is called and the memory is freed up when the function exits. Memory for arrays of other scopes remains allocated for the duration of the program’s execution.

Examples:

An array constant can be specified by enclosing a set of constant values in square brackets. The following examples will best illustrate the syntax.

STATIC INTEGER entries(100)

The subscript 100 creates a STATIC array of 100 integers referenced by 1 to 100.

REAL table(-5:10, 20, 5:7)

The first subscript of table, -5:10, allocates 16 rows which are referenced by the bounds of -5 to 10. The second subscript allocates 20 rows. The third subscript allocates three sets of data referenced by 5 to 7. The total array occupies 16*20*3 or 960 storage locations.

GLOBAL LOGICAL flags(0:8192)

The logical array flags occupies 8193 storage locations referenced by 0 to 8192.

STRING line[80](100),

ch[1](10,5) 100 strings of variable line, 80 characters each and 10 x 5 strings of variable ch, one character each.

INTEGER I(3,5) The integer array I occupies 15 storage locations arranged in order where the rightmost subscript varies most rapidly.

15Chapter 2: The PATRAN Command Language (PCL) IntroductionPCL Variables and Constants

Figure 2-1 PCL Array Storage

When referencing arrays, a portion of the array may be specified by using a colon to separate the upper and lower bound.

Examples:

Virtual Arrays

Any variable can be defined as a virtual array instead of a directly allocated array. Virtual arrays do not have storage locations assigned to them at program initialization. The size and amount of storage is allocated as requested and can be reused for other virtual arrays. To declare a virtual array, use the keyword VIRTUAL in place of the subscripts for the declaration. For example:

REAL mydata(VIRTUAL)

To allocate storage and specify lower and upper bounds, use the function SYS_ALLOCATE_ARRAY( array, lb1, hb1, lb2, hb2, lb3, hb3, lb4, hb4) passing 3, 5, 7, or 9 arguments depending on whether to allocate a virtual array to be one, two, three, or four dimensional. Once allocated, a virtual array can be used interchangeably with a non-virtual array. A different size array can be re-allocated with a subsequent SYS_ALLOCATE_ARRAY call, but the original contents of the array are lost. A different size array can be re-allocated to retain the old contents of the array with the SYS_REALLOCATE_ARRAY function. Storage can be freed with a SYS_FREE_ARRAY call. A virtual array with LOCAL scope is automatically freed when the function it is declared in exits. SYS_ALLOCATE_ARRAY returns a zero status on success and a non-zero if the allocation failed.

Or, to allocate a two dimensional array, enter:

[1, 2, 3] A three element integer array.

[“Ace”, “King”, “Queen”,“Jack”] A string array constant.

[1.1, 2.2], [17,5], [-8,0]] A real array constant dimensioned (3,2).

my_function( node_list(10:30) )

In this example, elements 10 through 30 of the node_list array are passed to my_function.

err = SYS_ALLOCATE_ARRAY (mydata, 1, 1000 ) Allocate a one dimensional array.

PCL and CustomizationPCL Variables and Constants

16

err = SYS_ALLOCATE_ARRAY (mydata, 1, 1000, 1, 20000)

Or, to re-allocate the two dimensional array, enter:

err = SYS_REALLOCATE_ARRAY (mydata, 1, 30, 1, 20000)

To find out the dimension associated with any array, use the PCL command SYS_ARRAY_NBOUND( array ).

The lower and upper bounds of an array are found by using the commands, SYS_ARRAY_LBOUND( array, bound ) and SYS_ARRAY_HBOUND( array, bound ).

Virtual Strings

A string can be defined as a virtual string instead of directly declaring the size of the string. Virtual strings do not have storage locations assigned to them at program initialization. The size and amount of storage is allocated as requested and can be reused for other virtual data. To declare a virtual string, use the keyword VIRTUAL in place of the string size for the declaration. For example:

STRING line[VIRTUAL]

To allocate storage and specify the maximum size of the string, use the function SYS_ALLOCATE_STRING( string, maxsize). Currently, the string size must be between one and 32767. Once allocated, a virtual string can be used interchangeably with a non-virtual string. A different size string can be re-allocated with a subsequent SYS_ALLOCATE_STRING function, but the original contents of the string will be lost. A different size string can be re-allocated to retain the old contents of the string with a SYS_REALLOCATE_STRING function. Storage can be freed with the SYS_FREE_STRING function. A virtual string with LOCAL scope is automatically freed when the function it is declared in exits. SYS_ALLOCATE_STRING returns a zero status on success and a non-zero if the allocation failed. Virtual strings arrays are allowed, but currently a SYS_REALLOCATE_STRING may not be performed on one.

SYS_FREE_ARRAY (mydata) Free up the array storage space.

err = SYS_ALLOCATE_ARRAY (moredata, -200, 200, 0, 20)

Allocate a two dimensional array.

SYS_FREE_ARRAY (moredata) Free up the array storage space.

17Chapter 2: The PATRAN Command Language (PCL) IntroductionPCL Variables and Constants

To find out the maximum size of any string, use the PCL function STR_MAXLENGTH(string).

Variable InitializationVariables may be initialized with a value when they are declared. Initializations are specified by following the variable declaration with an equal sign (“=”) and then a constant of the correct type for the item being declared. If an array is being declared, there must be enough constants to initialize the entire array, separated by blanks or commas optionally enclosed in square brackets.

GLOBAL variables defined within a FUNCTION definition cannot be initialized. CLASSWIDE variables also cannot be initialized currently. If a STATIC variable is initialized, the initialization takes place at compile time, and any modification to the value of the variable remains intact for the duration of the session. When GLOBAL or LOCAL variables are initialized, the initialization is identical to including the assignments following the declaration. This means that a LOCAL variable with initialization will be re-initialized on each entry into the FUNCTION in which it is defined.

Some example initializations are:

REAL TABLE(2,3) = [ 10, 20, 30, 11, 21, 31 ]STRING PROMPT[20] = “This is a prompt”INTEGER I = 0, J = 17

err = SYS_ALLOCATE_STRING (line, 500) Allocate a 500 character string.

err = SYS_REALLOCATE_STRING(line, 800) Now reallocated as a 800 character string.

SYS_FREE_STRING (line) Free up the string storage space.

STRING lines1[VIRTUAL](20), lines2[VIRTUAL](VIRTUAL)

err = SYS_ALLOCATE_STRING(lines1,100)

Allocate the array to have strings of 100 characters.

err = SYS_ALLOCATE_STRING(lines2,80)

err = SYS_ALLOCATE_ARRAY (lines2,1,20)

Allocate a 20 element array of strings of 80 characters.

SYS_FREE_STRING (lines1)

SYS_FREE_STRING (lines2)

SYS_FREE_ARRAY (lines2)

Important:Multi-dimension arrays are stored in row major order. This is opposite of FORTRAN's definition. Virtual arrays and virtual strings can not be initialized.

PCL and CustomizationPCL Variables and Constants

18

Argument DeclarationThe input and output parameters that are passed back and forth to a function are called arguments. Arguments to a function must be declared and must match the datatypes used within the function.

Within a function, it is permissible and recommended that the values within an array or string definition be omitted. The function uses the dimension values of the arrays or strings specified in the calling argument in any case so it can be misleading to specify values for dimensions for the arguments. Some examples are:

REAL ENTRY(5,20), ELEMTABLE(20,40)STRING ENTRYTITLE[40] = “This is the title for the Entry Table”STRING ELEMTITLE[15] = “Type of Element”INTEGER N, K...R = MY_FUNCTION (ENTRY, N, ENTRYTITLE )...R = MY_FUNCTION (ELEMTABLE, K, ELEMTITLE )...FUNCTION MY_FUNCTION (TABLE, POINTER, TITLE )REAL TABLE()STRING TITLE[]INTEGER POINTER

19Chapter 2: The PATRAN Command Language (PCL) IntroductionPCL Operators and Expressions

PCL Operators and Expressions

Hierarchy of OperatorsPCL supports a wide range of operators including basic math and Booleans. Expressions are built from a set of operators, constants, variables, and functions. User functions and intrinsic functions can be used as operands. Uniary operators take a single operand to the right, and binary operators are placed between two operands. Numeric, logical and string operators are provided.

Certain operators take precedence over others (i.e., multiplication is done before addition). The precedence can be overridden by use of parentheses. The following list gives the operators in order of precedence from highest to lowest.

The following table is list of operators giving the datatypes that they can operate on and the result datatype for the operation. In the table, the letters I, R, S, L, and W stand for INTEGER, REAL, STRING, LOGICAL, and WIDGET respectively.

Table 2-1

Operators Definitions

+ - Uniary Plus or Minus, Logical Not

** Exponentiation

* / Multiplication and Division

+ - Addition and Subtraction

// String Concatenation

< > <= >= == != Relational Operators

|| && Logical Or, Logical And

+= -= = Increment, Decrement, Assignment

PCL and CustomizationPCL Operators and Expressions

20

.

Examples:

An example of using operators to find the two real roots of a quadratic equation in PCL:

IF ( b**2 > 4.0 * a * c && ABS(a) >= 1.0E-7) THEN root(1) = ( -b + SQRT( b**2 - 4.0 * a * c )) / (2.0*a) root(2) = ( -b - SQRT( b**2 - 4.0 * a * c )) / (2.0*a)END IF

String Comparisons:

The string comparison operators are special in that they ignore trailing blanks and uppercase and lowercase. Therefore, all the following expressions are TRUE.

“ABC” == “ABC”“ABC” == “abc”“TEST” == “TEST”“HELLO” < “help”“hello” < “HELP”

Table 2-2

Operators Operands Result

** * / + - += -= I,R I,R

// S S

< > <= >= I,R,S L

== != I,R,S,L,W L

= I,R,S,L,W I,R,S,L,W

|| && L L

Note: Expressions with a mixture of INTEGER and REAL data types are valid and will be converted to the assigned data type. Real to integer conversion truncates the fraction. All arithmetic expression evaluations are done in single precision.

IVAL += 4 * SIND( MYANGLE )

IVAL is incremented by the integer value resulting from the calculation of (4 x sin(MYANGLE) and the truncation of all digits after the decimal point.

MYFUNC( ) >= (A+1)*2 && STR1 // STR2 == “TESTING”

Test for MYFUNC( ) greater or equal to (A+1)*2 and the concatenation of STR1 with STR2 logically equal to the string “TESTING”.

21Chapter 2: The PATRAN Command Language (PCL) IntroductionControl Statements

Control StatementsControl statements are used to transfer control to another section of the program. The following syntax conventions are observed in the following examples:

REQUIRED KEYWORDSAll required keywords are identified in bold Courier font.entryItems in plain Courier font are descriptions of the expected entry.[label]Items enclosed in brackets are optional.

BranchingPCL is a block structured language. Language elements that control branching and skipping are the IF THEN ELSE, SWITCH CASE, BREAK and CONTINUE statements.

Break and ContinueThe BREAK and CONTINUE statements are only allowed within the body of FOR, WHILE, REPEAT, SWITCH and LIST statements. In addition, if the optional label field is given, the label must match one of the above block structures the statement is within. The CONTINUE statement causes transfer to the END statement processing for the block structure indicated by the label field or the most current block structure if no label is provided. This essentially causes the loop to repeat. The BREAK statement is similar except that it transfers control past the END statement, thereby terminating execution of the loop. The format of the two statements is as follows:

BREAK [ label ]CONTINUE [ label ]

Examples:

CONTINUE active_set_loop

BREAK

Simple If ThenThe simple IF statement evaluates the logical expression in the clause. If the result is TRUE, the single statement immediately following the THEN keyword is executed. If the result is FALSE, then nothing happens. The IF statement structure is as follows:

IF( logical_expression ) THEN statement

If Then ElseThe IF statement evaluates the expression in the clause. If the result is TRUE, the group of statements immediately following is executed and then control skips to the matching END IF clause. If the result is FALSE, then if there is an ELSE IF clause, it is evaluated and the preceding logic is repeated. If all results evaluate to FALSE, then the statements following the ELSE are executed. Multiple ELSE IF clauses are allowed. The IF statement structure is as follows:

PCL and CustomizationControl Statements

22

IF( logical_expression ) THENstatements...ELSE IF( logical_expression ) THENstatements ...ELSEstatements ...END IF

The program statements within a conditional structure are normally indented to make it easier to read. PCL and Patran ignore all leading blanks in a line.

Examples:

In the following example of the IF THEN statement, a patch model is being adaptively meshed based on the previously evaluated strain energy density for the region defined by the patches in patch_list:

IF ( strain_energy > max_threshold ) THEN

el_length = el_length / 2.0do_my_mesh( patch_list, “QUAD”, I,el_length )

ELSE IF ( strain_energy < min_threshold) THEN

el_length = 2.0 * el_lengthdo_my_mesh( patch_list, “QUAD”, I,el_length )

ELSE

BREAK adapting /* Break out of loop called adapting */

END IF

Switch and CaseThe SWITCH statement starts by evaluating the expression in the clause. It then scans for each CASE statement in turn. Upon reaching the CASE statement, each expression in the CASE is evaluated. If there is an equality match of the CASE expression result and the SWITCH expression result, the statements up to the next CASE or DEFAULT are executed, and then control passes to the statement after the END SWITCH. If the DEFAULT is reached with no CASE expressions matching, then the statements following the DEFAULT will be executed. The DEFAULT clause is optional. See the Break and Continue, 21 statement for a description of the SWITCH label. The SWITCH statement structure is as follows:

SWITCH(expression) [ label ]CASE(expression1,expression2,...)statements ...CASE(expression1,expression2,...)statements ...DEFAULTstatements ...END SWITCH

As an example of using the SWITCH statement, a PCL function is used to interactively construct the element property cards based on the element configuration code. The function UI_READ_REAL prompts the user with the argument string and returns the real value input from the keyboard.

SWITCH (el_config) CASE (2)

23Chapter 2: The PATRAN Command Language (PCL) IntroductionControl Statements

midm = UI_READ_REAL(“ENTER MEMBRANE MATERIAL ID:”)CASE (3)mids = UI_READ_REAL(“ENTER SHELL MATERIAL ID:”)CASE (mconfig)mass = UI_READ_REAL(“ENTER TOTAL MASS:”)CASE (sconfig)spring = UI_READ_REAL(“ENTER SPRING CONSTANT:”)DEFAULTWRITE_LINE(“WARNING: ELEMENT CONFIG”, el_config,“UNDEFINED”)END SWITCH

LoopingA loop is a repeated execution of a particular segment or group of statements. Loops include initialization, incrementation, execution and test. Loops may be nested within one another. Block structures used for looping in PCL are WHILE, REPEAT, LIST and FOR statements.

ForThe FOR statement begins by evaluating the first numeric expression and assigning it to the variable. Next, the second expression is evaluated and saved as the TO result. The third expression is evaluated and saved as the BY result. If the BY result is zero, an error occurs. If the BY result is positive and the variable value is greater than the TO result, control passes to the statement following the matching END FOR. If the BY result is negative and the variable value is less than the TO result, control also passes to the statement following the matching END FOR. Otherwise the statements in the body are executed. When the END FOR is reached, the variable is incremented by the BY result. The preceding logic is then repeated starting at the point after the expressions were evaluated. Also see the description of the Break and Continue, 21 statements. The FOR statement structure is as follows:

FOR(variable=numeric_expr.TO numeric_expr. [ BY numeric_expr. ]) [ label ]statements...END FOR

WhileThe WHILE statement evaluates the expression in the clause. If the result is FALSE, control passes to the point after the matching END WHILE. Otherwise, the statements are executed and the preceding logic is repeated. Also see the description of the Break and Continue (p. 2-21) statements. The WHILE statement structure is as follows:

WHILE( logical_expression ) [ label ]statements...END WHILE

The program statements within a loop structure are normally indented to make it easier to read.

The following is an example of the use of WHILE and FOR statements. A text file containing node displacements in FORTRAN format 6E16.9 is read and stored in array “node_disp” with library utility function TEXT_READ. The file “fid” has previously been opened with a call to the library function TEXT_OPEN. The integer function TEXT_READ returns the value 0 for a successful read and non-zero otherwise.

PCL and CustomizationControl Statements

24

count = 0WHILE ( TEXT_READ ( fid, “%OF%%6E16.9%”, O, node_dis ( count +1, 1:6)) == 0)count += 1IF ( count > 10000) THENWRITE_LINE(“* DISCONTINUED READING FILE AT” // @“10,000 RECORDS”)BREAK END IFEND WHILE

RepeatThe REPEAT statement starts by executing the statements up to the matching UNTIL clause. Then the expression in the clause is evaluated. If the result is FALSE, the preceding logic is repeated. Otherwise, execution continues with the statement after the UNTIL. Also see the description of the Break and Continue, 21 statements. The REPEAT statement structure is as follows:

REPEAT [ label ]statements ...UNTIL( logical_expression )

As an example of the REPEAT structure, the user is requested to input a grid ID. If an invalid ID is entered, the user is prompted until a valid ID is entered.

REPEATgrid_id = UI_READ_INTEGER( “ INPUT GRID ID ”)UNTIL ( VALID_GID(grid_id) )

ListThe LIST statement executes the statements in the body for each expression in the expression list. Each expression is evaluated in turn and assigned to the variable. For each assignment done, the statements in the body are executed. Also see the description of the Break and Continue, 21 statements. The LIST statement structure is as follows:

LIST( variable=expression1 [,expression2, ...] ) [ label ]statements ...END LIST

In the following example of a LIST statement, the variable “diameter” is used to create both the inside and outside surface of a sphere. The variables x0, y0 and z0 are the global coordinates of the sphere’s origin.

LIST ( diameter = inside_diameter, inside_diameter + thickness )!GR,#,,`x0`,`y0 - diameter`,`z0`!LIN,2#,ARC,`x0`/`y0`/`z0`/`x0`/`y0`/`z0 + 1`/180,#!PA,8#,ARC,`x0`/`y0`/`z0`/`x0`/`y0 + 1`/`z0`/360,2#END LIST!HP,8#,2P,,`maxpid + 1`T`maxpid + 8`,`maxpid + 9`T`maxpid + 16`

25Chapter 2: The PATRAN Command Language (PCL) IntroductionPCL Functions

PCL FunctionsA PCL function is a self-contained program unit consisting of PCL statements. It can perform as a subroutine, breaking programs into logical modules and passing arguments back and forth to other PCL functions or to the main program. Or, it can return a calculated output quantity for the function. In addition, a PCL function can be used to perform both tasks.

PCL functions are defined in files which can be created and modified with system level text editors. PCL functions are then compiled during a Patran session. A PCL function can call other functions. PCL functions can be called recursively.

PCL provides the ability to group functions into named libraries using the LIBRARY command with options to ADD, REMOVE CREATE, DELETE and LIST. An extensive Patran library of functions is also available. The library contains the following categories of functions:

Structure of a PCL ClassPCL functions may optionally be grouped into PCL classes. A PCL class is simply a group of functions that may share a common set of variables. PCL classes are used primarily for working with the user interface routines.

The first statement in a PCL class must contain the word CLASS and the name of the class. The last statement in a PCL class must be an END CLASS statement.

Patran Function Type Function Prefix

Mathematical MTH_

String STR_

System Utility SYS_, UTL_

Block I/O BLOCK_

File I/O FILE_

Record I/O RECORD_

Stream I/O STREAM_

String I/O STRING_

Text I/O TEXT_

Virtual I/O VIRTUAL_

Miscellaneous XF_, UI_, IO_, MSG_, EM_

Session File SF_

PCL and CustomizationPCL Functions

26

A PCL class may have a set of “classwide” variables. These variables are declared the same as other variables but must specify the scope CLASSWIDE and must appear between the CLASS statement and the first function definition.

The syntax of a PCL class definition is:

CLASS classnameCLASSWIDE declarations...functions (see Structure of a PCL Function, 26)... END CLASS

Where classname is the name given to the class.

To refer to a function that resides in a class, specify the classname, a period, and then the function name, i.e., classname.functionname.

Structure of a PCL FunctionThe first statement in a PCL function must start with the word FUNCTION. The last statement in a PCL function must be an END FUNCTION statement.

A PCL function may have an argument list and may also calculate an output quantity for the function. If an argument list is present, it may contain input parameters from the calling program and/or output parameters which pass values back to the calling program or function. The RETURN [value] statement is used to return a calculated output quantity for the function.

Since a FUNCTION may have more than one logical ending, the RETURN [value] statement can appear more than once. The optional value associated with the RETURN statement is the calculated output quantity of the function.

The syntax of a PCL function definition is:

FUNCTION fname( arglist ) declarations... statements... (and/or) NOODL commandsEND FUNCTION

Where fname is the function identifier. arglist is the argument list passed by the function. For the function to return a value, the following statement must be contained in the function:

RETURN value

Whenever the statement RETURN is encountered in a PCL function, processing of the current function terminates and control is passed to the calling function. The return value is optional.

The WHILE loop discussed in a previous example is shown in the context of a complete function. The array “node_disp” is a GLOBAL variable which will hold the node displacement data for use later on

Important:Variable names and function names conflict in PCL. PCL uses a flat name space for both.

27Chapter 2: The PATRAN Command Language (PCL) IntroductionPCL Functions

during the Patran session. The function TEXT_OPEN opens a file and returns the integer value -1 when it is finished reading a file. The following listing is the complete PCL function:

FUNCTION DISP_READ( file_name)

/* ABSTRACT: Read a file containing node displacements** INPUT:* file_nameOS level name of file containing*formatted records* SIDE EFFECTS:* GLOBALnode_dispNode displacements read and stored here*/

GLOBAL REAL node_disp(10000,6)INTEGER count, i, fidSTRING file_name[80]REAL nodes (6)

/* Open file containing node displacements*/

IF ( TEXT_OPEN( file_name, “or”, 0, 0, fid) == 0 ) THENcount = 0

/* Read and store the data in the global variable “node_disp”*/

WHILE(TEXT_READ ( fid, “%OF%%6E16.7%”, O, nodes, “ ”) == 0 ) count += 1

/* File is too large */

IF ( COUNT > 10000 ) THENWRITE_LINE(“* DISCONTINUED READING”, file_name, @“AT 10,000 RECORDS” )BREAK END IF

/* Each record contains six entries, three displacements* and three rotations. file is formatted FORTRAN 6E16.7 */

node_disp (count, 1:6) = nodesEND WHILE

/* Close the file */

TEXT_CLOSE(fid, “ ”)ELSEWRITE_LINE(“* CANNOT FIND FILE”, file_name)END IFEND FUNCTION

To use the DISP_READ function during a Patran session, the following command is entered in the command line.

DISP_READ(“displacements.dat”)

If, for example, the file displacements.dat contains the desired data, DISP_READ accesses the file to read the displacement data into variable “node_disp.” To access the array “node_disp,” it must be defined as GLOBAL in the session by entering:

GLOBAL REAL node_disp(10000,6)

PCL and CustomizationPCL Functions

28

Accessing PCL FunctionsOnce a text file has been created which defines the function, the file must be read into Patran so that it is accessible. There are two directives for achieving this:

!!INPUT file

!!COMPILE file [INTO] library_file

A directive is recognized by the two “!!” exclamation marks at the start of the line. Unlike a PCL statement, which is first compiled making it available for execution, PCL directives are executed immediately.

The INPUT directive allows selection of an input file for further PCL or Patran commands. After receipt of an INPUT directive, commands will now be read from the specified operating system text file. When the end of that file is reached, input will return to the previous file or to the user. Input files can be nested several layers deep. This allows INPUT directives to be used similarly to the concept of including files found in other programming languages.

PCL functions are always compiled into a binary format before being executed. If a function is simply entered or !!INPUT, the compile takes place “on the fly.” The COMPILE directive allows the function to be compiled into the binary format in advance and save the compiled form in a library file with other compiled PCL functions. Using this method the user avoids having to compile the function each time Patran is used.

For the previous two function examples, the directives:

!!INPUT nx !!INPUT disp_read

read the files nx.pcl and disp_read.pcl and allow access to the functions during the session in which the directives are issued. If the file type is not specified .pcl is assumed.

To put the same two functions into the library my_library.plb, issue the directives:

!!COMPILE nx my_library!!COMPILE disp_read my_library

If the library my_library does not exist in the current directory, executing the COMPILE directive will create it with maximum entries set to 256, otherwise, the files will be placed in the existing my_library. If a function by the same name exists in the library, it will be replaced and a message will be issued to the history window.

LibrariesA LIBRARY is a binary file containing any number of compiled PCL functions. A library provides a convenient mechanism for accessing and organizing compiled PCL functions. Whenever PCL is requested to execute a PCL function, it will search the set of libraries that have been specified in LIBRARY directives. The format of the LIBRARY directive is:

!!LIBRARY [ ADD ] file [ file ....]!!LIBRARY REMOVE file [ file ....]!!LIBRARY NONE

29Chapter 2: The PATRAN Command Language (PCL) IntroductionPCL Functions

!!LIBRARY!!LIBRARY CREATE file [ max_entries ]!!LIBRARY MERGE sourcefile destfile!!LIBRARY SORT file!!LIBRARY REHASH !!LIBRARY KEEPOPEN file [ file ....]!!LIBRARY DELETE file function [ function ...]!!LIBRARY LIST file [ function ... ]

Where file is the operating system name of a library to include in future searches. LIBRARY ADD directives are cumulative. Each one adds an additional library for which to search. The libraries are searched in the reverse order from when specified. The REMOVE option removes a library from the search. The NONE option clears the library search list. A null library command displays the current library search list.

The CREATE option creates a new library which can contain up to the number of functions specified by max_entries, or if max_entries is zero, a “growable” library is created. (If max_entries is not specified it defaults to 256.)

The MERGE option allows the entries to be merged or added from one library into another library. This operation can also be used to compress a library by creating a new library, merging the old library into the new library, and then replacing the original library with the new library.

The SORT option allows the entries in the library to be sorted alphabetically to obtain a nicer listing.

The REHASH option is rarely used but, it can recognize that the contents of the libraries in the library list may have been changed by another user or process and causes Patran to rebuild its optimization tables for all libraries.

The KEEPOPEN option can be used for any library that is already in the library list and attempts to increase performance of accessing frequently used PCL libraries by keeping the operating system library file open all the time.

The DELETE option is used to delete functions from a library. The LIST option lists the contents of a library providing date and size for each function.

To access the library, my_library, issue the directive:

!!LIBRARY my_library

The functions NX and DISP_READ may now be used at any time during the session. To eliminate the need for compiling functions each time they are used, try creating and saving libraries. Use the start-up files to issue the LIBRARY directive.

The sys_library (option, data) function also allows access to the library functions and can be compiled into PCL functions or used within IF statements in PCL start-up scripts. Generally, the “option” is a string containing the operation such as “ADD” and the “data” is a string with the file or function names.

Path DirectiveTo exercise more control over the use of PCL files, the PATH directive defines the order in which a set of directories is searched to find files needed by PCL. These include the files referenced by the other directives as well as files used by many of the PCL intrinsic functions. Examples of files are libraries,

PCL and CustomizationPCL Functions

30

INPUT files, start-up files, and files opened by the file I/O utilities. The current directory is always searched first. The default PATH is often configured by the init.pcl file but normally contains the user’s home directory followed by any needed Patran system directories. The format of the PATH directive is:

!! PATH [ ADD ] directory [directory ...]!! PATH REMOVE directory [directory ...]!! PATH NONE!! PATH

where directory is the operating system name of a directory to search. The directories are searched in order. The latest ADD is used first. Within an ADD, the directories are searched first to last. REMOVE will remove entries from the PATH. NONE will clear the PATH. A null PATH command will list the current PATH setting.

The sys_path (option, data) function also allows access to the path and can be compiled into PCL functions or used within IF statements in PCL start-up scripts. Generally, the option is a string such as “ADD” and the data is a string with the directory name(s).

31Chapter 2: The PATRAN Command Language (PCL) IntroductionThe C Preprocessor

The C PreprocessorDuring the development of Patran, the C preprocessor is used with C, FORTRAN and PCL source code. In other words, our source files are automatically sent through the C preprocessor prior to being sent to the specific compiler.

Use of the C preprocessor has many advantages. It allows for substitutions which make the source much more readable. For example, with the C preprocessor a section of code could be written like this:

#define NODE 1#define ELEMENT 2 IF ( entity == NODE ) THEN xxx ELSE IF ( entity == ELEMENT ) THEN xxx END IF

instead of like this:

IF ( entity == 1 ) THEN xxx ELSE IF ( entity == 2 ) THEN xxx END IF

Furthermore, these substitutions can be placed into an include file which would allow for centralization of the “#define” statements. Centralization of definitions into include files allows for cleaner and simpler code, ensures consistency and allows for changes throughout the code to be made very simply. If the two “#define” statements mentioned above were put into an include file called “entity_codes.p” then the above piece of code would be as follows:

#include “entity_code.p” IF ( entity == NODE ) THEN xxx ELSE IF ( entity == ELEMENT ) THEN xxx END IF

If the “entity_codes.p” include file were used consistently through out all source then the element entity code could change from 2 to 3 by simply changing one line in the “entity_code.p” file. The same idea applies to character strings. If all character strings used in code are placed into include files then changing the text strings is a simple task. If the name of an application changed from “in-house-code 5.3” to “in-house-code 5.4” it would only require one change in one file.

The naming convention for include files in Patran is that PCL include files are suffixed with a “.p,” FORTRAN include files are suffixed with a “.i” and C include files are suffixed with a “.h.” An include file is only used for one language, so if the same type of file is to be used in FORTRAN, C and PCL there would be three files. In such a case there is always one master include file and then slave files which merely “#include” the master file. Continuing with our “entity_code.p” example, if this file were to be used in PCL, FORTRAN and C then there would be three include files (entity_codes.p, entity_codes.i and entity_codes.h) whose contents would be:

-------- Contents of entity_codes.p -------------- /* Include file containing entity codes */ #define NODE 1 #define ELEMENT 2

PCL and CustomizationThe C Preprocessor

32

-------- Contents of entity_codes.i -------------- /* Include file containing entity codes */ #include “entity_codes.p”

-------- Contents of entity_codes.h -------------- /* Include file containing entity codes */ #include “entity_codes.p”

Such exclusiveness of include files allows the developer to easily accommodate for the different requirements of different computer languages.

Standard C compilers automatically send source files through the C preprocessor, so C source files do not need to be preprocessed prior to compilation. But, whenever C preprocessor commands are imbedded in FORTRAN or PCL source the source file must first be sent through the C preprocessor and the resulting file sent to the appropriate compiler. A typical C preprocessor command would be:

cpp -P -I$P3_HOME/customization <input_file_name> <output_file_name>

See any C language manual for more on the C preprocessor.

There are many PCL include files which are delivered with Patran in the $P3_HOME/customization directory: appforms.p, appstrings.p, uistrings.p, etc. Two of these include files, appforms.p and uiforms.p, are heavily used in the PCL functions which create Patran forms. The contents of these files are discussed in User Interface and List Processor Functions (Ch. 5).

33Chapter 2: The PATRAN Command Language (PCL) IntroductionFinding Programming Errors with PCL

Finding Programming Errors with PCLThere are two features in PCL that track the PCL program as it is processed: TRACE and DEBUG. These “Debugging tools” can be very useful when finding and correcting errors in the program logic. The first of these tools is the TRACE directive.

Trace DirectiveThe TRACE directive allows specification of tracing options during execution of PCL functions. The TRACE should normally be set to NONE. There are three options that can be enabled in TRACE; they are CALLS, EXITS, and LINES. When CALLS is set, each time a PCL function is called, a message is output. When EXITS is set, messages are output when PCL functions return control to their calling functions. When LINES is set, the current statement numbers are displayed as a function executes. In addition, if DEBUG was ON when the function was compiled, the source statements themselves will be displayed when LINES is set. The format of the TRACE directive is:

!! TRACE NONE(disable tracing)!! TRACE CALLS(enable tracing of function calls)!! TRACE NOCALLS(disable tracing of function calls)!! TRACE EXITS(enable tracing of function exits)!! TRACE NOEXITS(disable tracing of function exits)!! TRACE LINES(enable tracing of function statements)!! TRACE NOLINES(disable tracing of function statements)...

!! TRACE CALLS LINES!! TRACE level mask is CALLS NOEXITS LINES...

Debug DirectiveThe second directive that is useful for debugging PCL programs is the DEBUG directive. The DEBUG directive allows specification of a debugging flag which affects future compilations. With DEBUG ON, the original source lines of the file are compiled into the function. This allows the TRACE command to display the source during execution. The DEBUG option should only be used during development as it creates much larger and slower code. The format of the DEBUG directive is:

!!DEBUG ON(enable DEBUG lines during compile)!!DEBUG OFF(disable DEBUG lines during compile)

Don't forget to set TRACE to LINES when using the debug mode or compiling the function with DEBUG set to ON.

Another feature provided by PCL is the DUMP command. The format of the DUMP command is:

DUMP variable

Where variable is any currently declared variable.

PCL and CustomizationFinding Programming Errors with PCL

34

When the DUMP statement is encountered during execution of any PCL function, the contents of the variable is displayed in the alpha buffer. For an example, we examine the variable xyz by putting the following statement in function NX.

DUMP xyz

When the function NX is executed with a node located at the x=1,y=0,z=0 location, the following is displayed in the alpha buffer:

Array: ( 3 )Data: 1.0, 0.0, 0.0

35Chapter 2: The PATRAN Command Language (PCL) IntroductionInitializing the Session

Initializing the Session

PCL Start-Up FilePCL provides a means to control the session environment by reading the init.pcl file in the current directory when beginning a Patran session.

The init.pcl file does not usually have to be modified. Instead, the init.pcl as delivered will execute the additional start-up files p3prolog.pcl and p3epilog.pcl. These files, if they exist, are executed at the start(p3prolog) and end (p3eiplog) of the init.pcl processing and are a good place to place user or site specific commands.

Typical commands in the start-up files are custom !!PATH and !!LIBRARY settings. In addition, !!INPUT statements can be added to the start-up files to provide additional user or site start-up file capabilities.

Session Files Support in PCLThe purpose of adding session file support to PCL code is to allow a Patran session to be recreated when the session file is played. The sections below describe how an application developer may indicate the PCL commands that need to be recorded and played to duplicate a session. These PCL commands are known as “events of interest.”

Controlling recording file contents

There are tools available to the application developer to control the contents of a session file. They are described in the following sections. In general, it is desired that a session file only contains PCL function calls that affect the database (e.g., open/new/close database, create/modify/delete geometry, etc.). The following sections describe the tools which allow the application developer to control which function calls are recorded and how their parameters should be written to a session file (evaluated or symbolically). Additionally, the issue of recording user rotation events is addressed.

PCL recording directive (>)

The “>” directive is used to indicate that the function call on a line of PCL is an “event of interest.” When these events are executed, they are usually written to the session file. They are also sent to the history window at execution time. In situations where nested “events of interest” occur, only the first/top level event will be written to the session file. This prevents the recording of nested events, which would cause undesirable results. This directive should be placed in column one of a PCL statement.

The intent of this directive is to allow an application that is not invoked from the command line (e.g., forms) to record only those PCL commands that affect the database. In this way, playback can suppress all application dependent user interfacing. Consider the following simple example of PCL code that operates the form to build a grid.

asm_const_grid_xyz( “1”,“[0 0 0]”, “CF 0”,create_grid_xyz_created_ids))

PCL and CustomizationInitializing the Session

36

the > directive is placed on the line containing the call to be recorded as shown:

> asm_const_grid_xyz( “1”, “[0 0 0]”, “CF 0”,create_grid_xyz_created_ids))

If the function is called from the command line or a session file, all the ">" in the function will be ignored. For example,

FUNCTION simpoint() > STRING asm_create_grid_xyz_created_ids[VIRTUAL] > asm_const_grid_xyz( "#", "[1 0 0]", "Coord 0", asm_create_grid_xyz_created_ids ) END FUNCTION

Then execute at the command prompt (or via a session file)

simpoint()

The asm command will not be written to the session file. The reason is that "simpoint( )" is already being written to the session file. If the asm line were written, it would be run twice; once by the simpoint function being called again, and once by the session file itself.

The ">" directive only works if the function is called by a GUI. That is, if an "Apply" button, callback etc. is used in a custom form, then "simpoint()" is not written to the session file, so asm_... is.

Variables in session files

Occasionally, it is desirable to use more than one PCL function call with variables being passed from one function to another. There are two methods to allow this mechanism to work within the confines of a session file.

Combining separate functions

The first method requires the application developer to create a parent function which handles the variable passing from one function to another. This new parent function would be marked as the “event of interest” in the PCL code. For example, assume two functions PCLF1 and PCLF2 are being used. The parameter returned from PCLF1 is passed to PCLF2. This is handled as follows:

FUNCTION PCLF1AND2REAL arg1to2PCLF1 (arg1to2, 45.5, 60, “TRUE”)PCLF2 (arg1to2)END FUNCTION /* PCLF1AND2 */

Variable substitution by name

An alternate method causes Patran to automatically substitute the name of the variable rather than the value of the variable. This is accomplished with the $ directive. By placing the $ before any variable, the variable declaration is automatically written to the session file and the reference is symbolic (the name is used as opposed to its value). The variable declaration is automatically output to the session file. The following example illustrates another technique to handle the previous example.

37Chapter 2: The PATRAN Command Language (PCL) IntroductionInitializing the Session

> PCLF1 ($arg1to2, 45.5, 60, “TRUE”)> PCLF2 ($arg1to2)

Direct writes to the Session File

There are two PCL functions which allow the PCL applications developer to write directly to the session file. They are:

sf_write( string )sf_force_write( string )

The first function writes the string into the session file if session file recording. The second function forces the string into the current session file, assuming one is open and not paused, even if recording would not normally occur, i.e., nested function calls. This second function is probably most useful for either debugging PCL functions or adding comments to session files.

Conditional recording of rotation function calls

Sometimes it is not desirable to record every PCL function call. Some workstations that have hardware graphic accelerators may actually generate hundreds or thousands of function calls for a single user action (e.g., geometry scaling or rotations using a dial). For situations such as these, it is desirable to avoid recording these function calls, as they expand the session file without adding particularly interesting information. There are, however, situations where recording these function calls is desirable. The following PCL function allows the user to optionally record these rotation function calls:

sf_rotation( )

This function call must be executed immediately before the call which performs the rotation. For example:

IF( doit ) THEN sf_rotation()>gm_rot_x( .5 )ENDIF

If the record rotations toggle on the Session File Record form is set, then the call to gm_rot_x is recorded. If the toggle is not set, the function call is not recorded. See Session File Functions, 163 for the location of this toggle.

User controlled conditional recording

There is also a PCL function to allow the user to control recording of the session file. This function allows the user to prevent the next function call from being recorded, based upon the value of its logical argument. The function is:

sf_write_disable ( donext )

If the value of donext is TRUE, then the next function call to be recorded is executed normally, but is not recorded. For example:

sf_write_disable ( not_completed )

Note: Do not start a line with a $ before a variable. Patran recognizes lines that begin with $ as comment lines.

PCL and CustomizationInitializing the Session

38

> asm_create_patch_xyz ( arg1, arg2 )

In this example, if the value of not_completed is TRUE, then the call to asm_create_patch_xyz is not recorded.

Function calls used as arguments

Although it is sometimes convenient to use the return value from a function as an argument to another function, when using the > directive this should generally be avoided. For example, consider:

> funcx( funcy( x, y, z) )

If session file recording has not been disabled, both funcx and funcy are output. If one level is suppressed, then only funcx is recorded, (funcy recording is suppressed). Note also, that normally funcy gets recorded first, followed by funcx.

Undo support

In order to support the undo feature, applications should insure that all commands that can be written to a session file do not perform any database commits (uil_db_commit) either directly or indirectly (as a consequence of any command). The corresponding PCL code that handles the user interface is expected to perform the commit, passing a string that describes the operation that is about to take place.

Sample PCL Functions with > directive

The following PCL file contains three functions which demonstrate all of the available session file recording controls:

1 FUNCTION sftest2 STRING string1[256], string2[256], string3[256]34 string1 = “FIRST string”5 string2 = “The 2nd string”6 string3 = “This is string 3”78/* Write a line to the session file */9sf_write(“/* Written by ‘sf_write’ */”)1011/* Next function call records in session file */12> sub1 ( string1, string2 )1314/* Record Arg 1 of next func as variable NAME, not VALUE 15> sub1( $string3, string1 )1617/* Record Arg 2 of next func as variable NAME, not VALUE 18> sub2( string2, $string3 )1920/* Demonstrate how nested >’s act */21string3 = “String 3 assigned by sftest”22 sub2 (string2, string3)2324 /* Disable session file recording for the next line */25 sf_write_disable(TRUE)26> sub1 ($string3, string1)27 sf_force_write(“/* Written no matter what!”)2829/* test record rotation functionality */30 sf_rotation()31> ui_writec(“!Recorded only if record rotations is ON”)

39Chapter 2: The PATRAN Command Language (PCL) IntroductionInitializing the Session

32 END FUNCTION /* sftest */3334 FUNCTION sub1 (c, d)35 STRING c[256], d[256]36> UI_WRITEC (“SUB1: Arg1:%s - Arg2:%s\n”, c, d)37 END FUNCTION /* sub1 */3839 FUNCTION sub2 (e, f)40 STRING e[256], f[256]41> sub3 (e, f)42 f = “SUB2 set this string!”43 END FUNCTION /* sub2 */4445 FUNCTION sub3 (g, h)46 STRING g[256], h[256]47 sub3 (g, h)48> UI_WRITEC (“SUB3: Arg1:%s - Arg2:%s\n”, g, h)49 END FUNCTION /* sub3 */

Notes

1. Line 25 prevents line 26 from being recorded in the session file. Line 26 executes normally.

2. Line 30 prevents line 31 from being recorded in the session file if record rotations is off. The default condition is record rotations off. Line 31 always executes normally.

3. Line 36 never appears in the session file because function sub1() is always called from a line which contain the > directive.

4. Line 41 is recorded when function sub2() is called from line 22, but it is not recorded when function sub2 is called from line 18.

The following text is the session file created by the execution of the PCL function sftest() documented above.

1/# Session file recording started: 01/01/1991 00:00:00 2/* Written by ‘sf_write’ */ 3sub1( “FIRST string”, “The 2nd string” ) 4STRING string3[256] 5sub1( string3, “FIRST string” ) 6sub2( “The 2nd string”, string3 ) 7sub3( “The 2nd string”, “String 3 assigned by sftest” ) 8/* Written no matter what! ** 9/# Session file recording stopped: 05/01/1991 12:05:39

Lines 1 and 9 are created by the Session File init and exit functions. They are not passed from one session file to another when playing and recording at the same time.

Line 2 is recorded at execution of SFTEST line 9.

Line 3 is recorded at execution of SFTEST line 12.

Line 4 is recorded at execution of SFTEST line 15. Because this is the first use of argument ‘string3’ it is declared before it is used as an argument to the call.

Line 5 is also recorded at execution of SFTEST line 15. Note that the first arg is recorded as ‘string3’ rather than the value of ‘string3’ -- this is activated by the $ directive immediately preceding ‘string3’ on line 15.

PCL and CustomizationInitializing the Session

40

Line 6 is recorded at execution of SFTEST line 18. Note that the second argument is recorded as ‘string3’ rather than the value of ‘string3.’

Line 7 is recorded at execution of line 41 in function sub2. Since sub2 was executed without a > directive, > directives within sub2 are recorded.

Line 8 is recorded at execution of SFTEST line 27.

The following text is the output created by the execution of the PCL function sftest() documented above.

Output from the PCL function to the startup window:

1. SUB1: Arg1:FIRST string - Arg2:The 2nd string

2. SUB1: Arg1:This is string3 - Arg2:FIRST string

3. SUB3: Arg1:The 2nd string - Arg2:This is string 3

4. SUB3: Arg1:The 2nd string - Arg2:String 3 set by sftest

5. SUB1: Arg1:SUB2 set this string! - Arg2:FIRST string

6. /* Recorded only if record rotations is ON

Line 1 is printed from SUB1 when called from SFTEST line 12.

Line 2 is printed from SUB1 when called from SFTEST line 15.

Line 3 is printed from SUB3 when called from SUB2 line 41, which is called from SFTEST line 18.

Line 4 is printed from SUB3 when called from SUB2 line 41, which is called from SFTEST line 22.

Line 5 is printed from SUB1 when called from SFTEST line 26. Note that SUB1 is called, even though it is not recorded.

Line 6 is printed from SFTEST line 31, but the ui_write call is not recorded in the session file, because the default condition is NOT to record rotations, and the sf_rotation() call on line 30 indicates that line 31 is a rotation function.

The PCL Command Line Interpreter P3PCLCOMP

The executable p3pclcomp provides an interface to a PCL interpreter that can be executed from the command line of a UNIX shell or a Windows NT command processor.

The p3pclcomp executable functions exactly as the command line for Patran with two main differences. There is no graphics capability, and there is no access to databases. The runtime paths and libraries for p3pclcomp are also different, but this is simply because at start time, $P3_HOME/init.pcl is read by Patran and not by p3pclcomp.

Commands that are supported by p3pclcomp include:

!!input [all known options] !!compile [all known options] !!library [all known options] !!path [all known options]

and most PCL functions that do not deal with graphics or the database.

41Chapter 2: The PATRAN Command Language (PCL) IntroductionInitializing the Session

Possible uses of p3pclcomp include:

Test compiles of PCL function code to check for syntax errors.

Text execution of PCL functions that work without database or graphics, for example, file input and output functions.

The creation and manipulation of PCL function libraries or .plb files.

The p3pclcomp provides a good way to make libraries. A library named make_library.plb can be created using the following commands.

!!compile test.pcl into my_library.plb

The p3pclcomp executable can then be used with input from make_library.plb file.

$P3_HOME/bin/p3pclcomp < make_library.plb

The p3pclcomp executable can also be used to execute PCL commands provided through standard input, listing the results through standard output, allowing p3pclcomp to be used in script and batch files:

echo "!!LIBRARY LIST "make_library.plb | $P3_HOME/bin/p3pclcomp > make_library.lst

This command line will pass the PCL command "!!LIBRARY LIST make_library.plb" through the p3pclcomp executable. The p3pclcomp will create a list of all of the PCL functions included in the make_library.plb file to standard output. Standard output will then be redirected to the file "make_library.lst"

PCL and CustomizationInitializing the Session

42

Chapter 3: Basic FunctionsPCL and Customization

3 Basic Functions

Intrinsic Functions 6

Graphics Functions 130

PCL and CustomizationIntrinsic Functions

44

Intrinsic FunctionsPCL has an extensive library of intrinsic functions accessible at any time. Each function name is prefixed with a several letter mnemonic which specifies the category.

Most--but not all--PCL functions return a value. In the descriptions below, the definition of the return value is shown under the output parameters by using the name of the function as the variable name to be returned.

PCL intrinsic functions are more flexible than normal PCL functions when it comes to passing simple integers and reals. If an intrinsic function calls for a non-array input only integer or real value, pass either an integer or a real for that argument and PCL will convert automatically to the needed type.

Many PCL intrinsic functions are specific to the Patran environment and allow sophisticated control of the database and user interface. These PCL functions are documented elsewhere. The PCL functions documented here represent a core set of routines to perform many general operations such as math, string manipulation, and file input/output. The following documentation breaks down the intrinsic functions by categories.

Math FunctionsPCL contains a large number of intrinsic mathematical functions. Since the math functions are used so often, the prefix MTH_ is optional when referring to the Math Functions (unless otherwise specified in the documentation).

45Chapter 3: Basic FunctionsIntrinsic Functions

.

mth_sind ( angle )

Description:

Return trigonometric sine value of the argument specified in degrees.

Input:

REAL angle The angle in degrees for which to compute the sine

Output:

REAL <Return Value>

The sine value.

Error Conditions:

None.

mth_asind ( value )

Description:

Return angle in degrees which corresponds to the trigonometric sine contained in the argument.

Input:

REAL value The sine value for which to find the angle.

Output:

REAL <Return Value> The angle in degrees for the sine.

Error Conditions:

None.

mth_cosd ( angle )

Description:

Return trigonometric cosine value of the argument specified in degrees.

Input:

REAL angle The angle in degrees for which to compute the cosine.

Output:

REAL <Return Value> The cosine value.

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

46

mth_acosd ( value )

Description:

Return angle in degrees which corresponds to the trigonometric cosine contained in the argument.

Input:

REAL value The cosine value for which to find the angle.

Output:

REAL <Return Value>

The angle in degrees for the cosine.

Error Conditions:

None.

mth_tand ( angle )

Description:

Return trigonometric tangent value of the argument specified in degrees.

Input:

REAL angle The angle in degrees for which to compute the tangent.

Output:

REAL <Return Value> The tangent value.

Error Conditions:

None.

mth_atand ( value )

Description:

Return angle in degrees which corresponds to the trigonometric tangent contained in the argument.

Input:

REAL value The tangent value for which to find the angle.

Output:

REAL <Return Value> The angle in degrees for the tangent.

Error Conditions:

None.

47Chapter 3: Basic FunctionsIntrinsic Functions

mth_atan2d ( y, x )

Description:

Return angle in degrees which corresponds to the trigonometric tangent represented by the specified x and y components.

Input:

REAL y The y component of the tangent.

REAL x The x component of the tangent.

Output:

REAL <Return Value> The angle in degrees for the tangent.

Error Conditions:

None.

mth_sinr ( angle )

Description:

Return trigonometric sine value of the argument specified in radians.

Input:

REAL angle The angle in radians for which to compute the sine.

Output:

REAL <Return Value> The sine value.

Error Conditions:

None.

mth_asinr ( value )

Description:

Return angle in radians which corresponds to the trigonometric sine contained in the argument.

Input:

REAL value The sine value for which to find the angle.

Output:

REAL <Return Value> The angle in radians for the sine.

PCL and CustomizationIntrinsic Functions

48

Error Conditions:

None.

49Chapter 3: Basic FunctionsIntrinsic Functions

mth_cosr ( angle )

Description:

Return trigonometric cosine value of the argument specified in radians.

Input:

REAL angle The angle in radians for which to compute the cosine.

Output:

REAL <Return Value>

The cosine value.

Error Conditions:

None.

mth_acosr ( value )

Description:

Return angle in radians which corresponds to the trigonometric cosine contained in the argument.

Input:

REAL value The cosine value for which to find the angle.

Output:

REAL <Return Value> The angle in radians for the cosine.

Error Conditions:

None.

mth_tanr ( angle )

Description:

Return trigonometric tangent value of the argument specified in radians.

Input:

REAL angle The angle in radians for which to compute the tangent.

Output:

REAL <Return Value> The tangent value.

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

50

mth_atanr ( value )

Description:

Return angle in radians which corresponds to the trigonometric tangent contained in the argument.

Input:

REAL value The tangent value for which to find the angle.

Output:

REAL <Return Value>

The angle in radians for the tangent.

Error Conditions:

None.

mth_atan2r ( y, x )

Description:

Return angle in degrees which corresponds to the trigonometric tangent represented by the specified x and y components.

Input:

REAL y The y component of the tangent.

REAL x The x component of the tangent.

Output:

REAL <Return Value>

The angle in radians for the tangent.

Error Conditions:

None.

mth_sqrt ( value )

Description:

Return square root of the argument.

Input:

REAL value The value for which to obtain the square root.

Output:

51Chapter 3: Basic FunctionsIntrinsic Functions

REAL <Return Value>

The square root.

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

52

mth_ln ( value )

Description:

Return natural logarithm of the argument.

Input:

REAL value The value for which to obtain the natural logarithm.

Output:

REAL <Return Value>

The natural logarithm.

Error Conditions:

None.

mth_log ( value )

Description:

Return common logarithm of the argument.

Input:

REAL value The value for which to obtain the common logarithm.

Output:

REAL <Return Value>

The common logarithm.

Error Conditions:

None.

mth_exp ( value )

Description:

Return power function of natural logarithm base, e to the x power.

Input:

REAL value The raising power

Output:

REAL <Return Value>

The result of the power of the input argument.

53Chapter 3: Basic FunctionsIntrinsic Functions

Error Conditions:

None.

mth_abs ( value )

Description:

Return the absolute value of the input argument.

Input:

NUMERIC value The value to get the absolute value of, integer or real.

Output:

NUMERIC <Return Value> The absolute value of the input argument. The datatype will match that of the input argument.

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

54

mth_sign ( value )

Description:

Return a sign, -1, 0, or 1 for the input argument.

Input:

REAL value The value of which to get the sign.

Output:

INTEGER <Return Value> The sign value of the input argument, -1 for a negative argument, 0 for zero, and 1 for a positive argument.

Error Conditions:

None.

mth_nint ( value )

Description:

Return the nearest integer value for the input argument.

Input:

REAL value The value for which to obtain the nearest integer.

Output:

INTEGER <Return Value> The nearest integer value, rounding off the input argument.

Error Conditions:

None.

55Chapter 3: Basic FunctionsIntrinsic Functions

mth_max ( val1, val2, ... )

Description:

Return the largest value of a set of input values.

Input:

NUMERIC valnnn Input values to check, INTEGER or REAL. There may be one or more input values specified.

Output:

NUMERIC <Return Value>

The largest value of the input arguments. If all input arguments are INTEGER, then this result is also INTEGER. Otherwise, this result is REAL.

Error Conditions:

None.

mth_min ( val1, val2, ... )

Description:

Return the smallest value of a set of input values.

Input:

NUMERIC valnnn Input values to check, INTEGER or REAL. There may be one or more input values specified.

Output:

NUMERIC <Return Value>

The smallest value of the input arguments. If all input arguments are INTEGER, then this result is also INTEGER. Otherwise, this result is REAL.

Error Conditions:

None.

mth_mod ( value, divisor )

Description:

Return remainder of a number after dividing by a divisor.

Input:

NUMERIC value The value to be divided by the divisor.

PCL and CustomizationIntrinsic Functions

56

Example:

mth_round( 12.34567, 2 ) yields 12.35mth_round( 12.34567, 0 ) yields 12.0mth_round( 12.3457, -1 ) yields 10.0mth_round( 3.3715, 1 ) yields 3.4000001

NUMERIC divisor The divisor value.

Output:

NUMERIC <Return Value> The remainder after dividing value by the divisor an integral number of times. If both input arguments are INTEGER, then this result is also INTEGER. Otherwise, this result is REAL.

Error Conditions:

None.

mth_round ( value, ndecimals )

Description:

Return a value rounded to a specified number of decimals.

Input:

REAL value The value to be rounded.

INTEGER ndecimals Number of decimals.

Output:

REAL <Return Value> The input value rounded to the specified number of decimals. Note that with round-off errors, the value may not get exactly rounded.

Error Conditions:

None.

57Chapter 3: Basic FunctionsIntrinsic Functions

mth_sort ( array, dupflag, nleft )

Description:

This function will sort an array of integers, optionally removing all duplicate values.

Input:

INTEGER() array( ) This value specifies the items to be sorted. This value is used as both an input and an output. The original values passed into the function will be destroyed.

LOGICAL dupflag This value specifies, when set to TRUE, that duplicate sorted values will be removed. When this value is set to FALSE, duplicate values will not be removed.

Output:

INTEGER() array( ) This value returns the sorted items. This value is used as both an input and an output to this function, allowing the original values to be destroyed.

INTEGER nleft Number of integers that are in the final sort. Values in the array past this point are undefined. If DUPFLAG is FALSE then this will be the same as the size of the array.

Error Conditions:

None.

mth_sort_column ( matrix, column, ascend )

Description:

Sort a two dimensional integer or real array by one of its columns. The mth_ prefix is required for this routine.

Input:

NUMERIC() matrix Matrix of values to sort.

INTEGER column Column number within the matrix to sort by. Note that this column number starts from 1 even if the matrix is not based at a lowest dimension of 1.

LOGICAL ascend TRUE for an ascending order sort, FALSE for a descending order sort

Output:

NUMERIC() <Return Value> Matrix is sorted in place.

PCL and CustomizationIntrinsic Functions

58

Error Conditions:

None.

mth_sort_row ( matrix, row, ascend )

Description:

Sort a two dimensional integer or real array by one of its columns. The mth_ prefix is required for this routine.

Input:

NUMERIC() matrix Matrix of values to sort.

INTEGER row Row number within the matrix to sort by. Note that this row number starts from 1 even if the matrix is not based at a lowest dimension of 1.

LOGICAL ascend TRUE for an ascending order sort, FALSE for a descending order sort

Output:

NUMERIC() <Return Value> Matrix is sorted in place.

Error Conditions:

None.

59Chapter 3: Basic FunctionsIntrinsic Functions

Example:

Some examples of using PCL math functions:

max_shear = SQRT( ( sigma_x - sigma_y ) / 2.0)**2 + shear**2 )eigenroot = n * pi / length y = SINR( eigenroot * x ) * ( a * COSR( k * t ) + @ b * SINR( k * t ))thru_the_thickness = NINT( thickness/edge)

Note that the trigonometric functions operate on either degrees or radians depending on the last character (D for degrees and R for radians) in the function name. It is a simple matter to write a set of functions which operate in the manner preferred:

FUNCTION SIN( x )/* ABSTRACT: Return the SIN of x, where x is in degrees*/REAL xRETURN MTH_SIND( x ) END FUNCTION

String FunctionsThe String functions test, convert, and manipulate PCL strings. String functions are useful for user interface applications and parsing.

mth_array_search ( array, look4, sorted )

Description:

Search an integer array for a value. The mth_ prefix is required for this routine.

Input:

INTEGER() array Integer array of values to search.

INTEGER look4 Value to find in the array.

LOGICAL sorted TRUE if input array is already in ascending sort order. If FALSE then a complete search of the array will be necessary.

Output:

INTEGER <Return Value> Position in the array from 1 to n or zero if the value was not found in the array.

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

60

.

Example:

string line[40]line = “ ”str_length( line ) is now 0line = line // “testing”str_length( line ) is now 7

str_length ( string )

Description:

Return the current length of a PCL string.

Input:

STRING string The string for which to return the length.

Output:

INTEGER <Return Value> The current length of the string. Remember that PCL strings are variable length.

Error Conditions:

None.

61Chapter 3: Basic FunctionsIntrinsic Functions

str_maxlength ( string )

Description:

Return the maximum length of a PCL string.

Input:

STRING string The string for which to return the maximum length.

Output:

INTEGER <Return Value> The maximum length of the string. For a virtual string, this returns the current maximum length. For an unallocated virtual string, the result is currently undefined.

Error Conditions:

None.

str_to_lower ( string )

Description:

Return a copy of the input string with all characters converted to lower case letters.

Input:

STRING string The string to convert to lower case. The input string argument is not modified by this call.

Output:

STRING <Return Value> The input string converted to lower case.

Error Conditions:

None.

str_to_upper ( string )

Description:

Return a copy of the input string with all characters converted to upper case letters.

Input:

STRING string The string to convert to upper case. The input string argument is not modified by this call.

Output:

STRING <Return Value> The input string converted to upper case.

PCL and CustomizationIntrinsic Functions

62

Error Conditions:

None.

63Chapter 3: Basic FunctionsIntrinsic Functions

str_strip_lead ( string )

Description:

Return a copy of the input string with leading blank characters removed.

Input:

STRING string The string to strip leading blanks from. The input string argument is not modified by this call.

Output:

STRING <Return Value>

The input string without any leading blanks.

Error Conditions:

None.

str_strip_trail ( string )

Description:

Return a copy of the input string with trailing blank characters removed.

Input:

STRING string The string to strip trailing blanks from. The input string argument is not modified by this call.

Output:

STRING <Return Value> The input string without any trailing blanks.

Error Conditions:

None.

str_substr ( string, position, length )

Description:

Return a portion of the input string from the specified position for the specified length.

Input:

STRING string The string to extract the substring from. The input string argument is not modified by this call.

INTEGER position Starting position in the string where 1 is the first position.

PCL and CustomizationIntrinsic Functions

64

INTEGER length Number of characters to extract. If less than or equal to zero, then an empty string is extracted. If more characters are requested than are available in the string from the specified position, only the available characters will be returned.

Output:

STRING <Return Value> The extracted substring of the input string.

Error Conditions:

None.

65Chapter 3: Basic FunctionsIntrinsic Functions

str_assign ( mystring, position, length, substring )

Description:

This function will replace a portion of a string with a another string.

Input:

STRING mystring[ ] This value specifies the original string to be modified. This value is used as both an input and output value. The original string will not be preserved.

INTEGER position This value specifies the starting place in the input value mystring where the substitution will take place. The first character in the string is at position 1.

INTEGER length This value specifies the number of characters to be replaced.

STRING substring[ ] This value specifies the string that will be substituted into the input value mystring.

Output:

STRING mystring[ ] This value returns the original input value mystring with a portion of the string being replaced with the input value substring. This value is used as both an input and an output value. The original input value mystring will be overwritten.

Error Conditions:

None.

str_index ( string1, string2 )

Description:

Return the position where a string is found within another string.

Input:

STRING string1 The string within which to find an occurrence of the second string.

STRING string2 The string to look for within the first string.

Output:

INTEGER <Return Value> The position where string2 was found within string1 where 1 is the first position. Zero is returned if the string was not found.

Error Conditions:

None.

str_find_match ( string, chars )

PCL and CustomizationIntrinsic Functions

66

Description:

Return the position where any of a set of characters is found within another string.

Input:

STRING string The string within which to find an occurrence of any character in the second string.

STRING chars A list of characters to search for within the first string.

Output:

INTEGER <Return Value> The position where one of the characters was found within the string where 1 is the first position. Zero is returned if the non of the characters occurred in the string.

Error Conditions:

None.

str_find_nomatch ( string, chars )

Description:

Return the position where any character other than those in a set of characters is found within another string.

Input:

STRING string The string within which to find an occurrence of any character not in the second string.

STRING chars A list of characters not to search for within the first string.

Output:

INTEGER <Return Value>

The position where a character was found within the string which is not in the chars string, where 1 is the first position. Zero is returned if the string is only made up of characters within the chars string.

Error Conditions:

None.

67Chapter 3: Basic FunctionsIntrinsic Functions

str_equal ( string1, string2 )

Description:

Check for an exact match between two strings including exact character case and trailing blanks. Normally the standard PCL == operator would be used which ignores character case and trailing blanks.

Input:

STRING string1 First string to compare.

STRING string2 Second string to compare.

Output:

LOGICAL <Return Value> TRUE if strings match exactly, FALSE otherwise.

Error Conditions:

None.

str_to_integer ( string [, stat] )

Description:

Convert a string to an integer.

Input:

STRING string String to convert to integer value.

Output:

INTEGER stat Optional status, zero for success, or the position within the input string which contains the first invalid character.

INTEGER <Return Value> Integer value from conversion. Usually zero if the conversion fails.

Error Conditions:

None.

str_to_real ( string [, stat] )

Description:

Convert a string to a real.

Input:

STRING string String to convert to real value.

PCL and CustomizationIntrinsic Functions

68

Output:

INTEGER stat Optional status, zero for success, or the position within the input string which contains the first invalid character.

REAL <Return Value>

Real value from conversion. Usually zero if the conversion fails.

Error Conditions:

None.

69Chapter 3: Basic FunctionsIntrinsic Functions

str_to_logical ( string )

Description:

Convert a string to a logical.

Input:

STRING string String to convert to logical value.

Output:

LOGICAL <Return Value> Logical value from conversion. This will be TRUE if the first non-blank character of the string is a T, Y, or 1, regardless of case. Otherwise, the value will be FALSE.

Error Conditions:

None.

str_from_integer ( ival )

Description:

Convert an integer to a string.

Input:

INTEGER ival Integer to convert to string representation.

Output:

STRING <Return Value> String that represents the integer value.

Error Conditions:

None.

str_from_real ( rval )

Description:

Convert a real to a string.

Input:

REAL rval Real to convert to string representation.

Output:

STRING <Return Value> String that represents the real value. The string may end up being in decimal or in exponential notation.

PCL and CustomizationIntrinsic Functions

70

Error Conditions:

None.

71Chapter 3: Basic FunctionsIntrinsic Functions

str_from_logical ( lval )

Description:

Convert a logical to a string.

Input:

LOGICAL lval Logical to convert to string representation.

Output:

STRING <Return Value> String that represents the logical value. The string will be either “TRUE” or “FALSE”.

Error Conditions:

None.

str_datatype ( string )

Description:

Attempt to decipher the type of representation in a string.

Input:

STRING string String to decipher.

Output:

STRING <Return Value>

String representing datatype. Either “INTEGER,” “REAL,” “LOGICAL,” or “STRING.”

Error Conditions:

None.

str_formatc ( string, format, args... )

Description:

Perform a limited C style format conversion into a string. This routine is obsolete but exists for special purposes. Use STRING_WRITE instead.

Input:

STRING string Input string.

STRING format C Format string with handling of \n, \r, \t, %d, %f, %e, %g, %x, %s, %c, and %%.

PCL and CustomizationIntrinsic Functions

72

unknown args Appropriate datatype for format specifiers. Incorrect specifications may cause a crash.

Output:

STRING <Return Value>

Resultant string from processing format.

Error Conditions:

None.

73Chapter 3: Basic FunctionsIntrinsic Functions

str_formatf ( string, format, args... )

Description:

Perform a limited C style format conversion into a string. This routine is obsolete but exists for special purposes. Use STRING_WRITE instead.

Input:

STRING string Input string.

STRING format FORTRAN format string with handling of /, 'string', X, I, F, E, G, and A formats.

unknown args Appropriate datatype for format specifiers. Incorrect specifications may cause a crash. Array arguments are allowed.

Output:

STRING <Return Value> Resultant string from processing format.

Error Conditions:

None.

str_token ( string, delim, num [, compress ] )

Function;

This function will extract a token or a sequence of characters marked off by a delimiting character or a set of characters from a string.

Input:

STRING string[ ] This value specifies the source string from which tokens will be extracted.

STRING delim[1] This value specifies the single character token delimiter.

INTEGER num This value specifies the ordinal of the token to return from the input value string. This value must be set to at least one. If there are five tokens in the input value string, setting this value to three will cause this function to return the third token.

LOGICAL compress This value specifies, when set to TRUE, that empty tokens will be ignored. When this value is set to FALSE, empty tokens caused by multiple delimiters will not be ignored. This value is optional and has a default value of FALSE.

Output:

PCL and CustomizationIntrinsic Functions

74

STRING <Return Value>

This function returns the token extracted from the input value string. Leading and trailing spaces will be deleted if the delimiter character is not a space.

Error Conditions:

None.

75Chapter 3: Basic FunctionsIntrinsic Functions

str_abbreviation ( input, abbrev, minmatch )

Description:

Check if a string is a valid abbreviation of another string.

Input:

STRING input Input string to check as a valid abbreviation.

STRING abbrev String to check input string against.

INTEGER minmatch Minimum number of characters that must match for the abbreviation to be considered valid.

Output:

LOGICAL <Return Value> TRUE if abbreviation is valid, FALSE otherwise.

Error Conditions:

None.

str_to_ascii ( string [, position ] )

Description:

Return the ASCII integer value for a character within a string.

Input:

STRING string String which contains character for which to return ASCII value.

INTEGER position Optional position of the character. Default is one for the first character in the string.

Output:

INTEGER <Return Value> ASCII integer value or zero if string too small.

Error Conditions:

None.

str_from_ascii ( ascii )

Description:

Return the character represented by an ASCII value.

Input:

INTEGER ascii Integer ASCII value to convert to a character.

PCL and CustomizationIntrinsic Functions

76

Output:

STRING <Return Value>

Single character represented by ASCII value.

Error Conditions:

None.

77Chapter 3: Basic FunctionsIntrinsic Functions

str_pattern ( string, pattern, options )

Description:

Compare a string against a pattern and return match results.

Input:

STRING string String to compare against the pattern.

STRING pattern Pattern to check against with wildcards as defined by the options parameter.

INTEGER options 1 = Unix file type compare where “*” matches any number of characters and “?” matches a single character. 2= VMS file type compare where “*” matches any number of characters other than a period and “%” matches any single character. 0 = use 1 for unix systems and 2 for VMS systems.

Output:

LOGICAL <Return Value> TRUE if the pattern match succeeds. FALSE otherwise.

Error Conditions:

None.

string_newline_count (string, count)

Description:

This function counts the number of newline characters ( \n ) in a string.

Input:

STRING string[] This value specifies the string to look for newline characters.

Output:

INTEGER count The number of newline characters in the string.

Error Conditions:

None.

string_newline_position (string, position)

Description:

This function returns the newline character ( \n ) positions in a string.

PCL and CustomizationIntrinsic Functions

78

Block I/O FunctionsThe block I/O package gives access to operating system files in a very efficient manner. The files that block I/O operate on are viewed as fixed record files of a specific block size which is usually some multiple of the file system's disk block size. The block I/O package is often cumbersome to use and is normally not called directly by an application. The Record, Stream, and Virtual I/O utilities all use the Block I/O package. The format of a block I/O file is an MSC proprietary format. A Fortran or other application created file using the block I/O package cannot be accessed.

Input:

STRING string[] This value specifies the string to look for newline characters.

Output:

INTEGER position[] The newline character positions in the string.

Error Conditions:

None.

79Chapter 3: Basic FunctionsIntrinsic Functions

block_open ( filename, options, nwpb, chan, fsize )

Description:

Open a binary block oriented proprietary format file for access.

Input:

STRING filename Operating system name of file.

STRING options File open flags. Some set of R, W, N, O, P, and V. See File Utility Functions, 81.

INTEGER nwpb Number of words per block to use for the file.

Output:

INTEGER chan Channel number to use for subsequent block I/O operations.

INTEGER fsize Current file size in bytes if determinable.

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

block_close ( chan, options )

Function;

Close a file that was opened for block I/O.

Input:

INTEGER chan Channel from a previous block_open call.

STRING options Close flags. If “D” is specified, then the file will be deleted after closing.

Output:

INTEGER <Return Value> Zero for success, else error message code.

Error Conditions:

None.

block_read ( chan, blknum, nwords, buffer, numread )

Description:

Read a block or blocks from a file opened for block oriented I/O.

PCL and CustomizationIntrinsic Functions

80

Input:

INTEGER chan Channel from a previous block_open call.

INTEGER blknum Block number to read from the file where zero is the first block.

INTEGER nwords Number of words to be read. Normally this is a multiple of the number of words per block.

Output:

INTEGER() buffer Buffer area into which data is read. More than NWORDS of data may be returned if NWORDS is not a multiple of the number of words per block.

INTEGER numread Number of words actually read.

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

81Chapter 3: Basic FunctionsIntrinsic Functions

File Utility FunctionsThe file utility functions provide access to the operating system file structure. These functions can look up, delete, and copy files. There are also routines to help parse file specifications into component pieces. The file utility also maintains a path list which is a set of directories that is often used for searching for a file. The PCL !!PATH list is built on top of the file utility path routines.

block_write ( chan, blknum, nwords, buffer )

Description:

Write a block or blocks to a file opened for block oriented I/O.

Input:

INTEGER chan Channel from a previous block_open call.

INTEGER blknum Block number to write from the file where zero is the first block.

INTEGER nwords Number of words to write.

INTEGER() buffer Buffer area from which data is written.

Output:

INTEGER <Return Value> Zero for success, else error message code.

Error Conditions:

None.

block_get_name ( chan, fspec, lenfspec )

Description:

Get the operating system filename of a file open for block oriented I/O.

Input:

INTEGER chan Channel from a previous block_open call.

Output:

STRING fspec File specification of open file.

INTEGER lenfspec Length of name returned in FSPEC.

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

82

Several of the file utilities and also the text, record, stream, and block I/O utility open and close routines request an option string for how to find, open, or delete a file. The option string is a set of characters, each of which specifies an option. The order and case of the characters does not matter. Below are the options that can be specified. Many of these options only make sense for certain operations.

The file and I/O utilities also have a limited amount of support for file version numbers. For UNIX and Windows NT systems, a version number is specified by appending a period and a number, one or greater, to the filename. If the version number is less than 10, a leading zero is added to provide better sorting for UIMS and UNIX file sorting. The version utilities will recognize a versioned file with or without the leading zero.

An example of an open options specification for opening an already existing file for read access only is given below.

status = text_open (filename, “OR”, 0, 0)

N Create a new file.

O Open an existing file. If N is given also, the file will be created if it does not already exist.

R Open the file for read access.

W Open the file for write access. If R is given also, the file is opened for both reading and writing.

A Open the file for appending at the end of the file (text_open only).

V Use version numbers for searching for or creating the file.

P Search the file utilities path to find the file.

L Lock the file for exclusive access (not yet implemented).

S Use scratch directory (file_unique_name only).

D Delete the file after close (close routines only).

83Chapter 3: Basic FunctionsIntrinsic Functions

file_add_path ( where, newpath )

Description:

Add a path to the path list.

Input:

INTEGER where Position to insert path. Zero inserts at the start (after current directory), 1 inserts after the first path, and so on.

STRING newpath New directory specification to add to the path list.

Output:

INTEGER <Return Value> Zero for success, else error message code.

Error Conditions:

None.

file_append_version ( version, nzeros, fspec )

Description:

Append a version number to a file specification only if there is not already a version number in the specification. This is a utility routine which will not normally be called by the user. Use file_build_fname instead.

Input:

INTEGER version Version number or zero for no version.

INTEGER nzeros Number of leading zeros to add to version number.

STRING fspec Original file specification.

Output:

STRING fspec Modified file specification.

Error Conditions:

None.

file_build_fname ( dir, base, ext, options, filespec )

Description:

Create a full file specification given its component parts.

Input:

STRING dir Directory portion of file specification.

PCL and CustomizationIntrinsic Functions

84

STRING base Base filename portion.

STRING ext Extension for filename.

STRING options Options of N, O, P, or V. See File Utility Functions, 81.

Output:

STRING filespec Resultant file specification.

Error Conditions:

None.

file_create_directory ( dirname, access )

Description:

Create a directory.

Input:

STRING dirname Path to directory to create. If multiple directories need to be created for the path, they will be.

INTEGER access Unix style access permissions for new directories. This value is normally an octal number which is hard to represent in PCL. The easiest way to specify a protection such as 755 is to use the expression (7*64+5*8+5). Using zero gives no access to the directory, using 7*64+7*8+7 gives full access to the directory.

Output:

INTEGER <Return Value> Zero for success. If the directory already exists, the call is considered successful.

Error Conditions:

None.

85Chapter 3: Basic FunctionsIntrinsic Functions

file_delete ( filespec )

Description:

Delete an operating system file.

Input:

STRING filespec File to delete. The path will not be searched for the file.

Output:

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

file_delete_path ( oldpath )

Description:

Remove a path from the path list.

Input:

STRING oldpath Directory specification to remove from the path.

Output:

INTEGER <Return Value> Zero for success, else error message code.

Error Conditions:

None.

file_executable ( filespec )

Description:

Return whether or not a specified file has execute permission.

Input:

STRING filespec File specification to check.

Output:

LOGICAL <Return Value>

True for execute permission, False if no execute permission.

Error Conditions:

PCL and CustomizationIntrinsic Functions

86

None.

Side Effects:

Warning. If the operating system can’t determine execute permission, this function will normally return True.

87Chapter 3: Basic FunctionsIntrinsic Functions

file_exists ( filespec, options )

Description:

Check to see if a file exists.

Input:

STRING filespec File to look up.

STRING options Option flags of P or V. See File Utility Functions, 81.

Output:

LOGICAL <Return Value> TRUE if file exists. FALSE if file could not be found.

Error Conditions:

None.

file_exists_local ( filespec )

Description:;

Check to see if a file exists in the current directory. Normally, the “file_exists” function should be used with empty options instead of this routine.

Input:

STRING filespec File to look up.

Output:

LOGICAL <Return Value>

TRUE if file exists. FALSE if file could not be found.

Error Conditions:

None.

file_exists_version ( filespec, version, nzeros )

Description:

Find the highest version of a file in the current directory.

Input:

STRING filespec File to look up without version specified.

Output:

PCL and CustomizationIntrinsic Functions

88

INTEGER version Version number found or zero if no versions exists but the file exists without any version.

INTEGER nzeros Number of leading zeros that were found in the version number.

LOGICAL <Return Value>

TRUE if file exists. FALSE if file could not be found.

Error Conditions:

None.

89Chapter 3: Basic FunctionsIntrinsic Functions

file_expand_home ( inspec, outspec )

Description:

Expand any “~” home directory syntax in the file specification.

Input:

STRING inspec Input file specification.

Output:

STRING outspec File specification with expanded home syntax.

Error Conditions:

None.

file_get_bfname ( filespec, basename )

Description:

Extract the base filename given a file specification (without versions).

Input:

STRING filespec Input file specification.

Output:

STRING basename Base filename.

Error Conditions:

None.

file_get_dfname ( filespec, directory )

Description:

Extract the directory specification given a file specification.

Input:

STRING filespec Input file specification.

Output:

STRING directory Directory specification.

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

90

file_get_efname ( filespec, extension )

Description:

Extract the extension specification given a file specification (without versions).

Input:

STRING filespec Input file specification.

Output:

STRING extension Extension specification.

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

file_get_filespec ( inspec, options, outspec )

Description:

Get a file specification that matches the specified input specification and options.

Input:

STRING inspec Input file specification.

STRING options Option string containing any of N, O, P, or V. See File Utility Functions, 81.

Output:

STRING outspec Output file specification.

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

file_get_next_path ( ipath, path )

Description:

Iteratively retrieve entries from the path list.

Input:

91Chapter 3: Basic FunctionsIntrinsic Functions

INTEGER ipath Set to zero on first call. Pass return result back in on subsequent calls.

Output:

STRING path Next entry from the path list. The current directory path is returned as an empty string.

INTEGER <Return Value> Minus one if no more paths left. Otherwise use this value for the next call to file_get_next_path.

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

92

file_get_p3_home ( path )

Description:

Return directory path for Patran “home” directory.

Input:

None.

Output:

STRING path Path to Patran “home” directory.

INTEGER <Return Value> Status, zero for success.

Error Conditions:

None.

file_init_path ( option )

Description:

Initialize the path list for use.

Input:

INTEGER option Zero to initialize if not already done. One to clear all entries from the path. Two to reset the path back to the initial default path setting.

Output:

None.

Error Conditions:

None.

file_list_end ( chan )

Description:

Iteratively retrieve entries from the path list.

Input:

INTEGER chan Value from file_list_start.

Output:

INTEGER <Return Value>

Status, zero for success, else error code.

93Chapter 3: Basic FunctionsIntrinsic Functions

Example:

INTEGER status, chanSTRING fname [256]status = file_list_start ( “/tmp”, “patran.ses.*”, chan )IF ( status == 0 ) THENWHILE ( file_list_next ( chan, fname ) == 0 )xf_write_comment ( fname )END WHILEfile_list_end ( chan )END IF

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

94

file_list_next ( chan, fname )

Description:

Iteratively retrieve entries from the directory using the optional filter specified in file_list_start.

Input:

INTEGER chan Value from file_list_start that indicates the directory and filter..

Output:

STRING fname The next file in the indicated directory that matches the specified filter.

INTEGER <Return Value> Status, zero for success, -1 for end of list, else error code.

Error Conditions:

None.

file_list_start ( directory, filter, chan )

Description:

Initialize a file directory search for files matching a pattern. This routine initializes the search, file_list_next gets each name, and file_list_end cleans up.

Input:

STRING directory Name of directory to search. A “.” will cause the current directory to be searched.

STRING filter File name qualifier. Only * and ? are guaranteed to work.

Output:

INTEGER chan Return value to use on subsequent calls to file_list_next and file_list_end.

INTEGER <Return Value> Status, zero for success, else error code.

Error Conditions:

None.

Side Effects:

Memory. Be sure to call file_list_end to match file_list_start or memory structures may not be freed.

file_readable ( filespec )

95Chapter 3: Basic FunctionsIntrinsic Functions

Description:

Check if read access is possible to a file.

Input:

STRING filespec File to check for read access.

Output:

LOGICAL <Return Value>

TRUE if reading is possible, otherwise FALSE.

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

96

file_writeable ( filespec )

Description:

Check if write access is possible to a file.

Input:

STRING filespec File to check for write access.

Output:

LOGICAL <Return Value> TRUE if writing is possible, otherwise FALSE.

Error Conditions:

None.

file_unique_name ( prefix, options, outspec )

Description:

Generate a unique name for a file (usually a scratch work file).

Input:

STRING prefix Prefix string for file, may be empty.

STRING options Option “S” for create in temp directory, or empty for create in current directory.

Output:

STRING outspec Output file specification.

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

file_copy ( source, dest )

Description:

Copy an operating system file.

Input:

STRING source Name of existing source file.

STRING dest Name of new destination file which must not exist.

97Chapter 3: Basic FunctionsIntrinsic Functions

Record I/O Utility FunctionsThe record input/output package provides a set of routines to read and write files consisting of complex records of variable length mixed data types. Integers, logicals, reals, strings, and 1, 4, or 8 bit integers are all supported. Record I/O files are self defining with the data in the file specifying the datatypes and lengths of the data in the file. This means that a Record I/O file can be processed by a program which does not know the contents of the file, and makes it easy to expand the capabilities of an application without obsoleting existing files. The Record I/O package is built on top of the Stream I/O package.

Each record is defined as having a typecode followed by any combination of datatypes. A typecode is a positive integer that is defined by the application which usually denotes what kind of data is represented by the record. An example record might have a typecode of 100 followed by 3 integers, 100 reals, 2 more integers, 20 characters, and a logical. When reading in a record, the application can query the next datatype and data count in the record.

Since the Record I/O package is built on top of the Stream I/O package, the creation and modification dates of the file are retained. The file also has a file type code and a character description. The performance of the Record I/O should be good since at the bottom layer buffered block I/O is performed.

Generally, to create a Record I/O file, first call record_open_new to create the file. Next, start a new record with record_begin_write passing the typecode for the record. Then call record_write_rechead passing the datatype and count for the next field in the record. Then call the appropriate record_write_xxx routine for the datatype that is being written. Repeat the record_write_rechead and record_write_xxx

Output:

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

file_query_remote ( filename )

Description:

Determine whether or not a file resides on a remote file system.

Input:

STRING filename File to check.

Output:

INTEGER <Return Value> Zero for file is remote, otherwise message code for file local or does not exist.

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

98

calls for each field in the record, and then call record_end_rw to terminate the record. Continue writing records as desired, and call record_close when with the file. For several simple record types, there are routines of the name record_write_rec_xxx which will do much of the work automatically.

To read a Record I/O file, first call record_open_old to open the file, then read the next record header with record_begin_read which will return the typecode of the record. Now call record_read_rechead which returns the datatype and count of the next field in the record followed by a call the appropriate record_read_xxx routine to read the data. Close the file with record_close when done.

99Chapter 3: Basic FunctionsIntrinsic Functions

record_open_new ( filename, options, filecode, description, chan )

Description:

Create and open a new record I/O file.

Input:

STRING filename Name of file to open.

STRING options Open options of R, W, P, or V. See File Utility Functions, 81.

INTEGER filecode Integer value for the filetype of the new file. Ideally this should be a unique number for each kind of file that is created.

STRING description A informational text description of the file.

Output:

INTEGER chan Value to use for subsequent operations to this file.

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

record_open_old ( filename, options, chan, filecode, description )

Description:

Open an existing record I/O file.

Input:

STRING filename Name of file to open.

STRING options Open options of R, W, P, or V. See File Utility Functions, 81.

Output:

INTEGER chan Value to use for subsequent operations to this file.

INTEGER filecode Integer value that represents kind of file and is set by the record_open_new routine.

STRING description Description of the file.

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

100

record_close ( chan, options )

Description:

Close a file opened for record I/O.

Input:

INTEGER chan Channel from the record I/O open routine.

STRING options Close options. Either “D” to delete the file after close or an empty string.

Output:

INTEGER <Return Value> Zero for success, else error message code.

Error Conditions:

None.

record_get_name ( chan, fspec, lenfspec )

Description:

Return the file specification for an open record I/O file.

Input:

INTEGER chan Channel from the record I/O open routine.

Output:

STRING fspec Filename of open record I/O file.

INTEGER lenfspec Length of the file specification.

INTEGER <Return Value> Zero for success, else error message code.

Error Conditions:

None.

record_writerec_chars ( chan, typecode, count, buffer )

Description:

Write a record containing only character data to the record I/O file.

Input:

INTEGER chan Channel from the record I/O open routine.

INTEGER typecode Typecode for the record.

INTEGER count Number of characters to write from the string.

CSTRING buffer String to write to record file.

101Chapter 3: Basic FunctionsIntrinsic Functions

Output:

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

102

record_writerec_intchr ( chan, typecode, icount, ibuffer, ccount, cbuffer )

Description:

Write a record containing only integer and character data to the record I/O file.

Input:

INTEGER chan Channel from the record I/O open routine.

INTEGER typecode Typecode for the record.

INTEGER icount Number of integers to write to the record.

INTEGER() ibuffer Integer data to write.

INTEGER ccount Number of characters to write from the string.

CSTRING cbuffer String to write to record file.

Output:

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

record_writerec_ints ( chan, typecode, count, buffer )

Description:

Write a record containing only integer data to the record I/O file.

Input:

INTEGER chan Channel from the record I/O open routine.

INTEGER typecode Typecode for the record.

INTEGER count Number of integers to write to the record.

INTEGER() buffer Integer data to write.

Output:

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

record_writerec_reals ( chan, typecode, count, buffer )

103Chapter 3: Basic FunctionsIntrinsic Functions

Description:

Write a record containing only integer data to the record I/O file.

Input:

INTEGER chan Channel from the record I/O open routine.

INTEGER typecode Typecode for the record.

INTEGER count Number of reals to write to the record.

REAL buffer() Real data to write.

Output:

INTEGER <Return Value> Zero for success, else error message code.

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

104

record_begin_write ( chan, typecode )

Description:

Start the writing of a complex record in the record I/O file.

Input:

INTEGER chan Channel from the record I/O open routine.

INTEGER typecode Typecode for the record.

Output:

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

record_begin_read ( chan, typecode )

Description:

Start the reading of a record from the record I/O file.

Input:

INTEGER chan Channel from the record I/O open routine.

Output:

INTEGER typecode Typecode for the record. Will be -1 for the end of the file.

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

record_end_rw ( chan )

Description:

Complete the read or complex write of a record in the record I/O file.

Input:

INTEGER chan Channel from the record I/O open routine.

Output:

105Chapter 3: Basic FunctionsIntrinsic Functions

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

106

record_write_rechead ( chan, format, count )

Description:

Start the next field in writing a complex record to the Record I/O file.

Input:

INTEGER chan Channel from the record I/O open routine.

INTEGER format Datatype that will be written. Types defined are: 1=integer, 2=real, 3=char, 4=double real (not from PCL), 5=half integer, 6=byte integer, 7=4bit integer, 8=1bit integer, 9=logical, 10=pointer.

INTEGER count Number of items of the specified format that will make up the data field.

Output:

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

record_read_rechead ( chan, format, count )

Description:

Start the read of the next field from the current record of the Record I/O file.

Input:

INTEGER chan Channel from the record I/O open routine.

Output:

INTEGER format Datatype that is available next. Types defined are: 1=integer, 2=real, 3=char, 4=double real (not from PCL), 5=half integer, 6=byte integer, 7=4bit integer, 8=1bit integer, 9=logical, 10=pointer.

INTEGER count Number of items of the specified format that are available in the field.

INTEGER <Return Value> Zero for success, else error message code.

Error Conditions:

None.

107Chapter 3: Basic FunctionsIntrinsic Functions

record_write_ints ( chan, numitems, i_buffer )

record_write_reals ( chan, numitems, r_buffer )

record_write_chars ( chan, numitems, c_buffer )

record_write_halfints ( chan, numitems, h_buffer )

record_write_int8bits ( chan, numitems, i8_buffer )

record_write_int4bits ( chan, numitems, i4_buffer )

record_write_intbits ( chan, numitems, i1_buffer )

record_write_logicals ( chan, numitems, l_buffer )

record_write_pointers ( chan, numitems, p_buffer )

Description:

Start the read of the next field from the current record of the Record I/O file.

Input:

INTEGER chan Channel from the record I/O open routine.

INTEGER numitems Number of items that will be written from the buffer given.

INTEGER() i_buffer Data of integers to write.

REAL() r_buffer Data of reals to write.

STRING c_buffer String data to write.

INTEGER() h_buffer Data of half integers, one per integer, to write.

INTEGER() i8_buffer Data of 8 bit integers, one per integer, to write.

INTEGER() i4_buffer Data of 4 bit integers, one per integer, to write.

INTEGER() i1_buffer Data of 1 bit integers, one per integer, to write.

LOGICAL() l_buffer Data of logicals to write.

INTEGER() p_buffer Data of pointers, one per integer, to write.

Output:

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

108

record_read_ints ( chan, numitems, i_buffer )

record_read_reals ( chan, numitems, r_buffer )

record_read_chars ( chan, numitems, c_buffer )

record_read_halfints ( chan, numitems, h_buffer )

record_read_int8bits ( chan, numitems, i8_buffer )

record_read_int4bits ( chan, numitems, i4_buffer )

record_read_intbits ( chan, numitems, i1_buffer )

record_read_logicals ( chan, numitems, l_buffer )

record_read_pointers ( chan, numitems, p_buffer )

Description:

Read all or part of the current field of the current record of the record I/O file.

Input:

INTEGER chan Channel from the record I/O open routine.

INTEGER numitems Number of items to read into the specified buffer.

Output:

INTEGER() i_buffer Integer data read in.

REAL() r_buffer Real data read in.

STRING c_buffer String data read in.

INTEGER() h_buffer Half integer data read in, one per integer.

INTEGER() i8_buffer Eight bit integer data read in, one per integer.

INTEGER() i4_buffer Four bit integer data read in, one per integer.

INTEGER() i1_buffer One bit integer data read in, one per integer.

LOGICAL() l_buffer Logical data read in.

INTEGER() p_buffer Pointer data read in, one per integer.

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

109Chapter 3: Basic FunctionsIntrinsic Functions

record_get_position ( chan, position )

Description:

Get a pointer value for the current position in the record I/O file.

Input:

INTEGER chan Channel from the record I/O open routine.

Output:

INTEGER position Pointer value in internal format.

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

record_set_position ( chan, position )

Description:

Set the current position in the record I/O file using either a previous pointer value or the special value of zero or minus one.

Input:

INTEGER chan Channel from the record I/O open routine.

INTEGER position Start of record pointer from previous record_get_position call or zero for start of the file or minus one for end of the file.

Output:

INTEGER <Return Value> Zero for success, else error message code.

Error Conditions:

None.

record_get_header ( chan, cdatetime, mdatetime )

Description:

Get creation/modification dates for the record I/O file.

Input:

INTEGER chan Channel from the record I/O open routine.

Output:

PCL and CustomizationIntrinsic Functions

110

Stream I/O File Utility FunctionsThe stream input/output package provides a method of reading and writing a binary file treating it as a stream of bytes and words with no record format imposed on it. Support exists for integer, real, and character data. The stream concept implies that whether 2 integer words are written 100 times, or 100 integer words 2 times, the same result is received.

Generally, a file is opened with stream_open, write to it with stream_write_int, stream_write_real, or stream_write_char, read from it with stream_read_int, stream_read_real, or stream_read_char, and close it with stream_close. Data can be skipped with stream_skip_int, stream_skip_real, or stream_skip_char. Some kinds of random access can be performed using stream_get_position and stream_set_position. The stream_update call is used to flush data to disk. File header information, which includes the filecode, description, creation and modification dates can be read and possibly modified with stream_get_header and stream_set_header.

STRING cdatetime Creation date of file in format: yyyymmddhhmmss.

STRING mdatetime Modify date of file in format: yyyymmddhhmmss.

INTEGER <Return Value> Zero for success, else error message code.

Error Conditions:

None.

record_update ( chan )

Description:

Attempt to force the disk file to be up to date for the record I/O file.

Input:

INTEGER chan Channel from the record I/O open routine.

Output:

INTEGER <Return Value> Zero for success, else error message code.

Error Conditions:

None.

111Chapter 3: Basic FunctionsIntrinsic Functions

stream_open ( filename, options, chan )

Description:

Create or open a new or existing stream I/O file.

Input:

STRING filename Name of file to open/create.

STRING options Open options of N, O, R, W, P, or V. See File Utility Functions, 81.

Output:

INTEGER chan Channel number to use for subsequent stream I/O operations on this file.

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

stream_close ( chan, options )

Description:

Close a file opened for stream I/O.

Input:

INTEGER chan Channel from a previous call to stream_open.

STRING options Close options. Use “D” to delete the file after closing or else use an empty string.

Output:

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

stream_get_name ( chan, fspec, lenfspec )

Description:

Get the name of a file that is open for stream I/O.

PCL and CustomizationIntrinsic Functions

112

Input:

INTEGER chan Channel from a previous call to stream_open.

Output:

STRING fspec Name of the file.

INTEGER lenfspec Length of the file specification returned.

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

113Chapter 3: Basic FunctionsIntrinsic Functions

stream_get_header ( chan, filetype, description, createdate, modifydate, recordinfo )

Description:

Get header information associated with an open stream I/O file.

Input:

INTEGER chan Channel from a previous call to stream_open.

Output:

INTEGER filetype Filetype integer set from a stream_set_header call.

STRING description Description string from a stream_set_header call.

STRING createdate Creation date in format: yyyymmddhhmmss.

STRING modifydate Modify date in format: yyyymmddhhmmss.

INTEGER(5) recordinfo Application use data words.

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

stream_set_header ( chan, filetype, description, recordinfo )

Description:

Set some header information for a stream I/O file.

Input:

INTEGER chan Channel from a previous call to stream_open.

INTEGER filetype Filetype integer, application defined.

STRING description Description string, application defined.

INTEGER(5) recordinfo Application defined data words.

Output:

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

stream_get_position ( chan, position )

PCL and CustomizationIntrinsic Functions

114

Description:

Get the current position in the stream I/O file.

Input:

INTEGER chan Channel from a previous call to stream_open.

Output:

INTEGER position Position returned in internal format.

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

115Chapter 3: Basic FunctionsIntrinsic Functions

stream_set_position ( chan, position )

Description:

Set current position in the stream file to the beginning of the file or to a previously saved position.

Input:

INTEGER chan Channel from a previous call to stream_open.

INTEGER position Zero for beginning of file or a value returned from a previous call to stream_get_position.

Output:

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

stream_read_int ( chan, numtoread, buffer )

Description:

Read integers from the stream I/O file.

Input:

INTEGER chan Channel from a previous call to stream_open.

INTEGER numtoread Number of integers to read.

Output:

INTEGER() buffer Integer data read in by the call.

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

stream_read_real ( chan, numtoread, buffer )

Description:

Read reals from the stream I/O file.

Input:

INTEGER chan Channel from a previous call to stream_open.

PCL and CustomizationIntrinsic Functions

116

INTEGER numtoread Number of reals to read.

Output:

REAL() buffer Real data read in by the call.

INTEGER <Return Value> Zero for success, else error message code.

Error Conditions:

None.

117Chapter 3: Basic FunctionsIntrinsic Functions

stream_read_char ( chan, numtoread, buffer )

Description:

Read characters from the stream I/O file.

Input:

INTEGER chan Channel from a previous call to stream_open.

INTEGER numtoread Number of characters to read.

Output:

STRING buffer Character data read from stream I/O file.

INTEGER <Return Value> Zero for success, else error message code.

Error Conditions:

None.

stream_write_int ( chan, numtowrite, buffer )

Description:

Write integers to the stream I/O file.

Input:

INTEGER chan Channel from a previous call to stream_open.

INTEGER numtowrite Number of integers to write out.

INTEGER() buffer Data to write out to the file.

Output:

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

stream_write_real ( chan, numtowrite, buffer )

Description:

Write reals to the stream I/O file.

Input:

INTEGER chan Channel from a previous call to stream_open.

INTEGER numtowrite Number of reals to write out.

PCL and CustomizationIntrinsic Functions

118

REAL() buffer Data to write out to the file.

Output:

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

119Chapter 3: Basic FunctionsIntrinsic Functions

stream_write_char ( chan, numtowrite, buffer )

Description:

Write character data to the stream I/O file.

Input:

INTEGER chan Channel from a previous call to stream_open.

INTEGER numtowrite Number of characters to write out.

STRING buffer Character data to write.

Output:

INTEGER <Return Value> Zero for success, else error message code.

Error Conditions:

None.

stream_skip_int ( chan, numtoskip )

Function;

Skip over integers in the stream I/O file.

Input:

INTEGER chan Channel from a previous call to stream_open.

INTEGER numtoskip Number of integers to skip.

Output:

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

stream_skip_real ( chan, numtoskip )

Description:

Skip over reals in the stream I/O file.

Input:

INTEGER chan Channel from a previous call to stream_open.

INTEGER numtoskip Number of reals to skip.

PCL and CustomizationIntrinsic Functions

120

String I/O Conversion Utility FunctionsThe string input/output routines are used when complex formatting of data to or from a character string is needed. A string of data with a format specifier can be passed to string_read to convert the character

Output:

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

stream_skip_char ( chan, numtoskip )

Description:

Skip over character data in the stream I/O file.

Input:

INTEGER chan Channel from a previous call to stream_open.

INTEGER numtoskip Number of characters to skip.

Output:

INTEGER <Return Value> Zero for success, else error message code.

Error Conditions:

None.

stream_update ( chan )

Description:

Attempt to force all output to be up to date on disk.

Input:

INTEGER chan Channel from a previous call to stream_open.

Output:

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

121Chapter 3: Basic FunctionsIntrinsic Functions

data to a list of integers, reals, and character strings. A set of integers, reals, and character strings can be converted to a string using string_write.

Output Format Strings

Below is a description of output format strings, that is format strings that are used to convert integer, real, and string data to a formatted output. The format string is a simple character string which contains both raw text to output, and format specifiers, enclosed by a set of percent characters, which control how data items are formatted and output. Following is a description of each type of format specifier. The percent and upper case characters in the format specifiers are treated literally. The lowercase letters, “r”, “m”, “n”, or “p” are to be replaced with an unsigned integer constant, or an asterisk, and are always optional. An asterisk denotes that the value for the operation should be taken from the next element of the integer data array. The lowercase letter “f” is replaced by single uppercase letters for options, and is also optional. Currently defined is “L” for left justified, “R” for right justified(default), and “C” for compressed (E and G format only).

%% The simplest form of format specifier is a double percent to produce a single percent in the final output.

%rIm.nf% Integer specifier. This format specifier takes the next integer value from the integer data array for formatting. The value of “m” is the minimum number of characters to produce from the format. If “m” is omitted, then the exact number of characters necessary to hold the integer is used. The value of “n” is used to specify that many digits should be produced at a minimum, using leading zeros if necessary. The value of “r” is a repeat count which causes the specifier to be used that number of times with successive values from the integer data array. If “r” is greater than one, and “m” is omitted, then one blank will be inserted between each conversion. The exact format produced is an optional minus sign followed by one or more digits.

%rXm.nf% Integer hex specifier. This format specifier takes the next integer value from the integer data array for formatting as a hexadecimal number. The value of “m” is the minimum number of characters to produce from the format. If “m” is omitted, then the exact number of characters necessary to hold the conversion is used. The value of “n” is used to specify that many digits should be produced at a minimum, using leading zeros if necessary. The value of “r” is a repeat count which causes the specifier to be used that number of times with successive values from the integer data array. If “r” is greater than one, and “m” is omitted, then one blank will be inserted between each conversion. The exact format produced is one or more hexadecimal digits.

PCL and CustomizationIntrinsic Functions

122

%rFm.nf% Fixed float specifier. This format specifier takes the next real value from the real data array for formatting in fixed point notation. The value of “m” is the minimum number of characters to produce from the format. If “m” is omitted, then the exact number of characters necessary to hold the conversion is used. The value of “n” is the number of decimal digits to produce. If omitted, then all significant digits will be produced. The value of “r” is a repeat count which causes the specifier to be used that number of times with successive values from the real data array. If “r” is greater than one, and “m” is omitted, then one blank will be inserted between each conversion. The exact format produced is an optional minus sign followed by zero or more digits, a decimal point, and zero or more digits. At least one digit will precede or follow the decimal point.

%rEm.n.pf% Exponential float specifier. This format specifier takes the next real value from the real data array for formatting in scientific exponential notation. The value of “m” is the minimum number of characters to produce from the format. If “m” is omitted, then the exact number of characters necessary to hold the conversion is used. The value of “n” is the number of decimal digits to produce. If omitted, then all significant digits will be produced. The value of “r” is a repeat count which causes the specifier to be used that number of times with successive values from the real data array. If “r” is greater than one, and “m” is omitted, then one blank will be inserted between each conversion.

%rGm.n.pf% General float specifier. This format specifier takes the next real value from the real data array for formatting in either F or E format. The format used depends on the value of the number to convert. In general, if the exponent is small, the F format will be used, otherwise the E format is used. See the descriptions of the F and E formats.

%rAmf% String specifier. This format specifier takes the next string value from the character data array for formatting. The value of “m” is the minimum number of characters to produce from the format. If “m” is omitted, then the exact number of characters in the string is used. The value of “r” is a repeat count which causes the specifier to be used that number of times with successive values from the character data array. If “r” is greater than one, and “m” is omitted, then one blank will be inserted between each conversion. Use the “L” option for “f” for left justification of the string.

%rW% White space specifier. This format specifier causes a blank character to be output. The value of “r” is a repeat count for multiple blanks.

123Chapter 3: Basic FunctionsIntrinsic Functions

Input Format Strings

Input format strings, that is format strings that are used to convert formatted input to integer, real, and string data are very similar to output format strings. The format string is a simple character string which contains format specifiers, enclosed by a set of percent characters, which control how data items are formatted and output. Text outside of the format specifiers is ignored. Following is a description of each type of format specifiers. The percent and upper case characters in the format specifiers are treated literally. The lowercase letters, “r”, “m”, or “n” are to be replaced with an unsigned integer constant, or an asterisk, and are always optional. An asterisk denotes that the value for the operation should be taken from the next element of the integer data array.

%rN% New Line specifier. This format specifier causes a new line to be started. The previous line is output as is, and formatting starts at column one of the new line. The value of “r” is a repeat count for skipping multiple lines. If output is to a string, then newline characters will be written to the string.

%r(xxx)% Repeat specifier. Enclosed within the parentheses is a secondary format string, complete with its own percent characters, which is repeated the number of times specified in the “r” repeat count. Repeat specifiers can be nested as desired.

g %rIm% Integer specifier. This format specifier converts input to an integer value and stores it in the next element of the integer data array. The value of “m” is the length of the field to process. If “m” is omitted, then the conversion will take place up to the next space, comma, or end of line. The value of “r” is a repeat count which causes the specifier to be used that number of times.

%rXm% Integer hex specifier. This format specifier converts input of a hexadecimal representation to an integer value and stores it in the next element of the integer data array. The value of “m” is the length of the field to process. If “m” is omitted, then the conversion will take place up to the next space, comma, or end of line. The value of “r” is a repeat count which causes the specifier to be used that number of times.

%rFm% Fixed float specifier. This format specifier converts input of a floating point representation to a real value and stores it in the next element of the real data array. This conversion will accept both fixed and exponential format numbers. The value of “m” is the length of the field to process. If “m” is omitted, then the conversion will take place up to the next space, comma, or end of line. The value of “r” is a repeat count which causes the specifier to be used that number of times.

%rEm% Exponential float specifier. Same as the fixed float specifier.

%rGm% General float specifier. Same as the fixed float specifier.

PCL and CustomizationIntrinsic Functions

124

The INTS, REALS, and CHARS parameters to the formatting routines are somewhat flexible. If only passing a single value, it can be passed directly instead of having to use an array. If not using the parameter at all, pass a constant for the parameter.

%rAm% String specifier. This format specifier converts input to sting value and stores it in the next element of the string data array. The value of “m” is the length of the field to process. If “m” is omitted, then the conversion will take place up to the next space, comma, or end of line. The value of “r” is a repeat count which causes the specifier to be used that number of times.

%rW% White space specifier. This format specifier causes the next character of the input to be skipped and ignored. The value of “r” is a repeat count for multiple blanks.

%rN% New Line specifier. This format specifier causes a new line to be started for input. Any remaining input on the previous line is ignored. The value of “r” is a repeat count for skipping multiple lines.

%Of% Option specifier. The value of “f” is a single character option to set. Currently defined options are “F” for fixed Fortran- style inputting or “V” for variable style inputting. The initial default is “V.” The setting remains for the remainder of the call unless overridden with another %O%. With fixed style formatting, blank fields are interpreted as zeros, and input will not continue to the next line during this call unless a %N% occurs.

%r(xxx)% Repeat specifier. Enclosed within the parentheses is a secondary format string, complete with its own percent characters, which is repeated the number of times specified in the “r” repeat count.

string_read ( string, fmt, ints, reals, chars )

Description:

Read formatted record of mixed data from a string variable.

Input:

STRING string Character string from which the conversion takes place.

STRING fmt Format string governing how conversion is done. See Input Format Strings, 123 for details.

Output:

INTEGER() ints Integer array of data filled in by the read.

REAL() reals Real array of data filled in by the read.

STRING[]() chars Character array of data filled in by the read.

INTEGER <Return Value>

Zero for success, else error message code.

125Chapter 3: Basic FunctionsIntrinsic Functions

ngs,

Example:

INTEGER stat, ints(3); REAL reals(3); STRING chars[10](3)

stat = string_read( “20 30,40 1.75 22 3E-1 Test one two three”, @

%3I%%3F%%3A%”, ints, reals, chars )

Yields:ints = 20, 30, 40

reals = 1.75, 22, .3

chars = “Test”, “one”, “two”

Example:

Error Conditions:

None.

string_write ( fmt, ints, reals, chars, string )

Description:

Write formatted records of mixed data into a string variable.

Input:

STRING fmt Format string governing how conversion is done. See Output Format Stri121 for details.

INTEGER() ints Integer array of data to convert.

REAL() reals Real array of data to convert.

STRING[]() chars String array of data to convert.

Output:

STRING string Character string which receives converted data.

INTEGER <Return Value> Zero for success, else error message code.

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

126

INTEGER stat, ints(2) = 100, 200; STRING out[80]stat = string_write( “Test ival is %I% and rval is %F% for %A% # %I%”, @ints, 3.17, “Trial”, out )Yields:out = “Test ival is 100 and rval is 3.17 for Trial # 200”

INTEGER stat, ints(9) = 2, 4, 6, 3, 3, 1, 2, 3, 2REAL reals(5) = 1., 2., 3., 4., 5. ; STRING out[80]stat = string_write( “%2(That’s %*I% and %*G%.)%”, @ints, reals, “”, out )Yields:out = “That’s 4 6 and 1.0 2.0 3.0.That’s 1 2 3 and 4.0 5.0.”

Text File I/O Utility FunctionsThe text input/output routines are used to create or read operating system readable text files. Use text_open to open/create the file by filename, and a “channel” number is returned which is used for all subsequent calls pertaining to that file. Read or write simple string records with text_read_string and text_write_string. Read or write more complex formatted records with text_read and text_write. A limited amount of random access of the file can be done by using text_get_position and text_set_position. Lastly, get the name of the open file using text_get_name.

127Chapter 3: Basic FunctionsIntrinsic Functions

text_open ( filespec, options, lrecl, maxrecs, chan )

Description:

Open a text file for the Text I/O package.

Input:

STRING filespec Filename of file to open.

STRING options Open options of N, O, A, R, W, P, or V. See File Utility Functions, 81.

INTEGER lrecl Maximum record length for the file if known. Use zero if not known.

INTEGER maxrecs Maximum number of records that the file will contain if known. Use zero if not known.

Output:

INTEGER chan Channel value to use for subsequent text I/O operations.

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

text_close ( chan, options )

Description:

Close a text file that was previously opened with text_open.

Input:

INTEGER chan Channel from a previous call to text_open.

STRING options Close options. Use “D” to delete the file after closing or an empty string otherwise.

Output:

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

text_flush ( chan )

PCL and CustomizationIntrinsic Functions

128

Description:

Attempt to flush any output to the disk for the specified text I/O file.

Input:

INTEGER chan Channel from a previous call to text_open.

Output:

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

129Chapter 3: Basic FunctionsIntrinsic Functions

text_get_name ( chan, fspec, lenfspec )

Description:

Get the filename associated with an open text I/O file.

Input:

INTEGER chan Channel from a previous call to text_open.

Output:

STRING fspec File specification associated with text I/O file.

INTEGER lenfspec Length of string returned in fspec.

INTEGER <Return Value> Zero for success, else error message code.

Error Conditions:

None.

text_read_string ( chan, line, lenline )

Description:

Read a single record into a string from a text I/O file.

Input:

INTEGER chan Channel from a previous call to text_open or zero to read from standard input (xterm window).

Output:

STRING line Line read in from the text file.

INTEGER lenline Length of the line that was read in.

INTEGER <Return Value>

Zero for success, minus one for end of file, else error message code.

Error Conditions:

None.

text_write_string ( chan, line )

Description:

Write a single record from a string to a text I/O file.

Input:

PCL and CustomizationIntrinsic Functions

130

See Input Format Strings, 123 for more information.

INTEGER chan Channel from a previous call to text_open or zero to write to standard output (xterm window).

STRING line Line to write to the text file.

Output:

INTEGER <Return Value> Zero for success, else error message code.

Error Conditions:

None.

131Chapter 3: Basic FunctionsIntrinsic Functions

text_read ( chan, fmt, ints, reals, chars )

Description:

Read formatted records of mixed data from an open text I/O file.

Input:

INTEGER chan Channel from a previous call to text_open or zero to write to standard output (xterm window).

STRING fmt Format string governing how conversion is done.

Output:

INTEGER() ints Integer data converted from the read.

REAL() reals Real data converted from the read.

CSTRING[]()

chars String data converted from the read.

INTEGER <Return Value>

Zero for success, minus one if end of file, else error message code.

Error Conditions:

None.

text_write ( chan, fmt, ints, reals, chars )

Description:

Write formatted records of mixed data to a text I/O file.

Input:

INTEGER chan Channel from a previous call to text_open or zero to write to standard output (xterm window).

STRING fmt Format string governing how conversion is done.

INTEGER() ints Integer data to convert for the write.

REAL() reals Real data to convert for the write.

CSTRING[]()

chars String data to convert for the write.

Output:

INTEGER <Return Value>

Zero for success, else error message code.

PCL and CustomizationIntrinsic Functions

132

Error Conditions:

None.

133Chapter 3: Basic FunctionsIntrinsic Functions

text_get_position ( chan, position )

Description:

Get the current position in the text file for later use with text_set_position.

Input:

INTEGER chan Channel from a previous call to text_open.

Output:

INTEGER position Internal representation of the current position in the text I/O file.

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

text_set_position ( chan, position )

Description:

Set the current position in the text file to the beginning of the file, the end of the file, or to a position previously saved with text_get_position.

Input:

INTEGER chan Channel from a previous call to text_open.

INTEGER position Zero for beginning of file, minus one for end of file, or a value previously returned by a call to text_get_position.

Output:

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

text_truncate ( chan )

PCL and CustomizationIntrinsic Functions

134

Description:

Truncate the text file at the current position thereby deleting any records that follow this position. The file must have been opened for write access.

Input:

INTEGER chan Channel from a previous call to text_open.

Output:

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

135Chapter 3: Basic FunctionsIntrinsic Functions

text_get_file_size ( chan, bytesize )

Description:

Return the size of the file in bytes.

Input:

INTEGER chan Channel from a previous call to text_open.

Output:

INTEGER bytesize Size of the file in bytes.

INTEGER <Return Value> Zero for success, else error message code.

Error Conditions:

None.

text_file_query ( filnam, options, recnum, startc, endc, lowval, hival )

Description:

Determine if a file contains character text when it is known that a portion of a record of the file contains a text representation of an integer value.

Input:

STRING filnam File to check.

STRING options Open options of P, or V. See File Utility Functions, 81.

INTEGER recnum Record of the file which contains the known integer value where record 1 is the first record of the file.

INTEGER startc Starting character position in the record for the known integer value where 1 is the first position.

INTEGER endc Ending character position in the record for the known integer value.

INTEGER lowval Lowest acceptable value for the integer.

INTEGER hival Highest acceptable value for the integer.

Output:

LOGICAL <Return Value>

TRUE if the file exists, can be read, and has a text representation of an integer in the specified record and columns that is within the specified bounds. Otherwise the result is returned FALSE.

PCL and CustomizationIntrinsic Functions

136

Virtual I/O Scratch File Utility FunctionsThe virtual I/O routines are used when large amounts of working storage is needed and performance is important. If an application always tries to allocate virtual memory for its algorithm, it is limited by the amount of memory and swap space allocated on the particular machine. The virtual file package attempts to work around this problem by automatically spilling data onto disk as necessary while still maintaining as much of the work area in memory as makes sense. To accomplish this, the virtual file package treats the work area as a stream file made up of integers, reals, and characters. The calls to the virtual file package are almost identical to those in the stream file package.

Error Conditions:

None.

virtual_open_scratch ( chan )

Description:

Create and open a virtual scratch file.

Input:

None.

Output:

INTEGER chan Channel number to be used for subsequent operations on the virtual file.

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

virtual_close ( chan )

Description:

Close a virtual scratch file.

Input:

INTEGER chan Channel number returned by a previous call to virtual_open_scratch.

Output:

INTEGER <Return Value>

Zero for success, else error message code.

137Chapter 3: Basic FunctionsIntrinsic Functions

Error Conditions:

None.

virtual_write_int ( chan, numtowrite, buffer )

Description:

Write integers to a virtual file.

Input:

INTEGER chan Channel number returned by a previous call to virtual_open_scratch.

INTEGER numtowrite Number of integers to write from the buffer.

INTEGER() buffer Buffer containing integers to write.

Output:

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

138

virtual_write_real ( chan, numtowrite, buffer )

Description:

Write reals to a virtual file

Input:

INTEGER chan Channel number returned by a previous call to virtual_open_scratch.

INTEGER numtowrite Number of reals to write from the buffer.

REAL() buffer Buffer containing reals to write.

Output:

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

139Chapter 3: Basic FunctionsIntrinsic Functions

virtual_write_char ( chan, numtowrite, buffer )

Description:

Write characters to a virtual file.

Input:

INTEGER chan Channel number returned by a previous call to virtual_open_scratch.

INTEGER numtowrite Number of characters to write from the buffer.

STRING buffer Buffer containing characters to write.

Output:

INTEGER <Return Value> Zero for success, else error message code.

Error Conditions:

None.

virtual_read_int ( chan, numtoread, buffer )

Description:

Write integers from a virtual file.

Input:

INTEGER chan Channel number returned by a previous call to virtual_open_scratch.

INTEGER numtoread Number of integers to read into the buffer.

Output:

INTEGER() buffer Area to read integers into.

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

virtual_read_real ( chan, numtoread, buffer )

Description:

Read real data from a virtual file.

Input:

PCL and CustomizationIntrinsic Functions

140

INTEGER chan Channel number returned by a previous call to virtual_open_scratch.

INTEGER numtoread Number of reals to read into the buffer.

Output:

REAL() buffer Area to read reals into.

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

141Chapter 3: Basic FunctionsIntrinsic Functions

virtual_read_char ( chan, numtoread, buffer )

Description:

Read character data from a virtual file.

Input:

INTEGER chan Channel number returned by a previous call to virtual_open_scratch.

INTEGER numtoread Number of characters to read into the buffer.

Output:

STRING buffer Area to read characters into.

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

virtual_skip_int ( chan, numtoskip )

Description:

Skip over integer data in a virtual file.

Input:

INTEGER chan Channel number returned by a previous call to virtual_open_scratch.

INTEGER numtoskip Number of integers to skip over.

Output:

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

virtual_skip_real ( chan, numtoskip )

Description:

Skip over real data in a virtual file.

PCL and CustomizationIntrinsic Functions

142

Input:

INTEGER chan Channel number returned by a previous call to virtual_open_scratch.

INTEGER numtoskip Number of reals to skip over.

Output:

INTEGER <Return Value>

Zero for success, else error message code.

Error Conditions:

None.

143Chapter 3: Basic FunctionsIntrinsic Functions

virtual_skip_char ( chan, numtoskip )

Description:

Skip over character data in a virtual file.

Input:

INTEGER chan Channel number returned by a previous call to virtual_open_scratch.

INTEGER numtoskip Number of characters to skip over.

Output:

INTEGER <Return Value> Zero for success, else error message code.

Error Conditions:

None.

virtual_get_position ( chan, position )

Description:

Get the current position in the virtual scratch file for later use with virtual_set_position.

Input:

INTEGER chan Channel number returned by a previous call to virtual_open_scratch.

Output:

INTEGER position Internal position to use in a later call to virtual_set_position.

INTEGER <Return Value> Zero for success, else error message code.

Error Conditions:

None.

virtual_set_position ( chan, position )

Description:

Set the current position in the virtual scratch file to the beginning of the file or to a position previously retrieved with a call to virtual_get_position.

Input:

INTEGER chan Channel number returned by a previous call to virtual_open_scratch.

PCL and CustomizationIntrinsic Functions

144

Console I/O FunctionsThe console I/O functions are used to display messages to the terminal window, history window, and session file.

INTEGER position Zero to set position to the beginning of the file or a position previously returned by virtual_get_position.

Output:

INTEGER <Return Value> Zero for success, else error message code.

Error Conditions:

None.

145Chapter 3: Basic FunctionsIntrinsic Functions

.

xf_error_start ( mess )

Description:

Start the reporting of an error message.

Input:

STRING mess First line of error message to report.

Output:

None.

Error Conditions:

None.

xf_error_continue ( mess )

Description:

Continue reporting an error message after xf_error_start has been called.

Input:

STRING mess Additional line of error message to report.

Output:

None.

Error Conditions:

None.

xf_error_end ( )

Description:

End the reporting of an error message after xf_error_start has been called.

Input:

None.

Output:

None.

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

146

xf_write_comment ( mess )

Description:

Write a comment to the history window/session file.

Input:

STRING mess Comment to write out.

Output:

None.

Error Conditions:

None.

147Chapter 3: Basic FunctionsIntrinsic Functions

xf_write_command ( mess )

Description:

Write a command to the history window/session file.

Input:

STRING mess Command to write out.

Output:

None.

Error Conditions:

None.

xf_write_query ( mess )

Description:

Write a query to the history window/session file.

Input:

STRING mess Query to write out.

Output:

None.

Error Conditions:

None.

xf_write_print ( mess )

Description:

Write a “print” message to the history window/session file.

Input:

STRING mess Message to write out.

Output:

None.

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

148

xf_write_stdout ( mess )

Description:

Write a line to standard output, usually the terminal window.

Input:

STRING mess Line to write out.

Output:

None.

Error Conditions:

None.

xf_write_stderr ( mess )

Description:

Write a line to standard error, usually the terminal window.

Input:

STRING mess Line to write out.

Output:

None.

Error Conditions:

None.

xf_read_from_user ( inmess )

Description:

Read a response from the command line.

Input:

None.

Output:

STRING inmess Line entered by the user.

INTEGER <Return Value> Zero for success, else error message code.

Error Conditions:

None.

149Chapter 3: Basic FunctionsIntrinsic Functions

xf_read_stdin ( inmess )

Description:

Read a response from standard input (xterm window).

Input:

None.

Output:

STRING inmess Line read in from standard input.

INTEGER <Return Value>

Zero for success, minus one for end of file, else error message code.

Error Conditions:

None.

write ( expr, ... )

PCL and CustomizationIntrinsic Functions

150

Example:

ok = ui_read_logical( “Do you want to continue?” )

io_write ( expr, ... )

ui_write ( expr, ... )

Description:

Write out a set of expressions, one per line, to the history window (or tty if no history window).

Input:

ANY expr General PCL expression to write out.

Output:

None.

Error Conditions:

None.

ui_read_logical ( prompt[, hotread] )

Description:

Display a form to the user requesting a yes/no response.

Input:

STRING prompt Prompt to display in the form.

LOGICAL hotread Optional and ignored.

Output:

LOGICAL <Return Value> True if YES button, False otherwise.

Error Conditions:

None.

151Chapter 3: Basic FunctionsIntrinsic Functions

Example:

option = ui_read_integer( “1. Decrease, 2. Increase, 3. Quit”, 1, 3 )

Example:

scale = ui_read_real( “Enter a scale factor for the operation” )

ui_read_integer ( prompt[, minval][, maxval] )

Description:

Display a form to the user requesting an integer response.

Input:

STRING prompt Prompt to display in the form.

INTEGER minval Optional lower bound for response.

INTEGER maxval Optional upper bound for response.

Output:

INTEGER <Return Value>

Integer value that user entered or zero if aborted.

Error Conditions:

abort Value returned is zero even if outside of range specified.

ui_read_real ( prompt[, minval][, maxval] )

Description:

Display a form to the user requesting a real response.

Input:

STRING prompt Prompt to display in the form.

REAL minval Optional lower bound for response.

REAL maxval Optional upper bound for response.

Output:

REAL <Return Value> Value entered by user or zero for abort.

Error Conditions:

abort Value returned is zero even if outside of range specified.

PCL and CustomizationIntrinsic Functions

152

Example:

username = ui_read_string( “What is your name?” )

Example:

ui_read_string ( prompt[, option] )

Description:

Display a form to the user requesting a string response.

Input:

STRING prompt Prompt to display in the form.

INTEGER option Optional and ignored.

Output:

STRING return Value entered by user.

Error Conditions:

None.

ui_answer_message ( msgcode, answer )

Description:

Let PCL function supply answer to a user interface message prompt. The ui_answer_message call must occur BEFORE the user interface message appears.

Input:

INTEGER msgcode Integer code of message that response belongs to. This code is most easily found by first interactively generating the message and then looking in the resultant session file to see what code was generated. If -1 is used for the message code then the answer will apply to any message.

STRING answer Answer for the message. For normal user interface prompts, the valid strings are “YES”, “NO”, YESFOR ALL”, “NOFORALL”, and “ABORT”.

Output:

STRING return Value entered by user.

Error Conditions:

None.

153Chapter 3: Basic FunctionsIntrinsic Functions

/* Supply YES answer to next message no matter what it is */ui_answer_message( -1, “YES” )

Example:

/* Supply YES answer always to the message: * Do you wish to delete the original patches? */ui_override_message( 1000030, “YES” )

ui_override_message ( msgcode, answer )

Description:

Let PCL function supply permanent answer to a user interface message prompt. The ui_override_message call must occur BEFORE the user interface message appears. The override stays in effect until it is cancelled with an empty answer string.

Input:

INTEGER msgcode Integer code of message that response belongs to. This code is most easily found by first interactively generating the message and then looking in the resultant session file to see what code was generated.

STRING answer Answer for the message. For normal user interface prompts, the valid strings are “YES”, “NO”, YESFOR ALL”, “NOFORALL”, and “ABORT”. An empty string, ““, is used to turn off the override.

Output:

STRING return Value entered by user.

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

154

write_line ( expr, ... )

io_write_line ( expr, ... )

ui_write_line ( expr, ... )

Description:

Write out a set of expressions trying to fit as much as possible into an 80 character output line, to the history window (or tty if no history window).

Input:

ANY expr General PCL expression to write out.

Output:

None.

Error Conditions:

None.

io_writec ( format, args... )

ui_writec ( format, args... )

Description:

Perform a limited C style format output to the history window. This routine is obsolete but exists for special purposes. Look at the TEXT_WRITE routine instead.

Input:

STRING format C Format string with handling of \n, \r, \t, %d, %f, %e, %g, %x, %s, %c, and %%.

unknown args Appropriate datatype for format specifiers. Incorrect specifications may cause a crash.

Output:

None.

Error Conditions:

None.

155Chapter 3: Basic FunctionsIntrinsic Functions

Message System FunctionsThe Patran messaging system allows PCL to access and display text strings. These text strings may be used for displaying messages or miscellaneous text (e.g. text strings that appear on forms - buttons, labels, etc.). Messages may either be written to the history window or displayed in a form which may require a user response (YES or NO). Additionally, messages may either be directly embedded in PCL or retrieved by a “message code”. Miscellaneous text is always retrieved by a message code.

The accessing routines fall into two categories; a simple interface that displays an embedded PCL message string in one of the message forms, and a rigorous interface that uses a numeric message code to retrieve general text strings and/or display a message in one of the message forms. This rigorous interface allows these strings to be customized by defining these strings in a user modifiable file.

For many customization activities, the simple interface (USER_MESSAGE) will be sufficient. In situations where text strings need to be externalized (defined outside of the code), the rigorous interface functions (MSG_xxx) must be used. These MSG_xxx functions (which are also used by Patran internally) allow for the retrieval and display of messages based on message codes (an integer). As these codes are also used during session file playback to validate message answers, they should be unique. MSC has reserved the values zero to 1 billion minus 1 (0 - 999,999,999) for internal use. While customers are free to use numbers beyond this range, PCL code should be written to allow these numbers to be changed in the case where multiple customizations will be combined that use the same set of numbers. For this reason, it is suggested that the C preprocessor be used extensively so that any required changes in numbering can be performed easily.

io_writef ( format, args... )

ui_writef ( format, args... )

Description:

Perform a limited FORTRAN style format output to the history window. This routine is obsolete but exists for special purposes. Look at the TEXT_WRITE routine instead.

Input:

STRING format FORTRAN format string with handling of /, 'string', X, I, F, E, G, and A formats.

unknown args Appropriate datatype for format specifiers. Incorrect specifications may cause a crash. Array arguments are allowed.

Output:

None.

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

156

The MSG_xxx functions retrieve messages from either a primary or secondary file. The primary file (a read-only file that is delivered with Patran) is a specially processed file named “messages.database” that contains the text strings required by Patran. Any message code that is not in this primary file will be looked up in a secondary, user created message file. This file will be either the contents of the environment variable P3_USER_MESSAGES, or if not set, will be named user_messages.database and must exist on the PCL path. The format of the user message file requires each message code to begin in column 1 with the message text spanning as many lines as necessary. Blank lines and lines beginning with a # are ignored (to support the C preprocessor). A special symbol should be used as the base of a customization section to identify the application class.

Sample user_messages.database

This file assigns the application code (appcode) 1,000,000,000 to the application named “Some customization”. There are 2 form labels defined in this range (1,000,000,001 and 1,000,000,002), although the range of these numbers is completely unimportant as long as it is greater than one billion and unique. A single message numbered 1,000,000,100 is defined. It is a formatting string that requires a single string to be substituted in place of %A%. When this message is displayed, the first sentence will be terminated with a newline. Note the number 143 on the second message line. As long as a number does not appear in column 1, it is not considered a message number, and is therefore part of the message (number 1,000,000,100).

The routines USER_MESSAGE, MSG_TO_FORM and MSG_TO_TEXT require an argument (msgtype) that specifies the message severity. For USER_MESSAGE and MSG_TO_FORM, this value also controls the available buttons and determines the range of possible return values. Besides the ABORT button (which appears with all message forms), there are up to four (4) additional buttons that can appear with a CRITICAL or QUERY message and a selectable default value. The possible buttons are YES, NO, YES FOR ALL (YFA) and NO FOR ALL (NFA). The return message status code indicates how the user answered the question (for CRITICAL and QUERY messages).The possible return values are MSG_STAT_YES, MSG_STAT_NO, MSG_STAT_YESALL, MSG_STAT_NOALL, and MSG_STAT_ABORT. The following table lists these different combinations for both the simple and rigorous interfaces.

<start of file>

1000000000 Some customization

#define form text labels

1000000001 Custom pick 1

1000000002 Custom string

#define messages

1000000100 An error was detected while attempting to perform a 143 type operation on %A%.\nDo you wish to continue?

<end of file>

157Chapter 3: Basic FunctionsIntrinsic Functions

Sample usage:

status = MSG_TO_FORM(1000000100, MSG_CRITICAL_YN_NDEFAULT, 1000000000, 0, 0.0, “this entity”)IF ( status == MSG_STAT_YES ) THEN<do something>ENDIF

In this example, the application code (1,000,000,000) will cause the string “Critical Decision requested from application Some customization” to be displayed as the header of the Patran modal message form. The form text box will contain the string:

“An error was detected while attempting to perform a 143 type operation on this entity.Do you wish to continue?”

Additionally, the YES, NO and ABORT buttons will be available, with NO being the default button.

USER_MESSAGE

MSG_TO_FORM description or

(msgtype - string) (msgtype - integer) available buttons

INFO MSG_INFO Informative message

WARN MSG_WARNING Warning message

ERROR MSG_FATAL Error/Fatal message

ACK MSG_ACKNOWLEDGE Acknowledgment message

x_YN MSG_xxx_YN YES, NO

x_YN_Y MSG_xxx_YN_YDEFAULT YES, NO, YES default

x_YN_N MSG_xxx_YN_NDEFAULT YES, NO, NO default

x_YNY MSG_xxx_YNY YES, NO, YES FOR ALL (YFA)

x_YNY_Y MSG_xxx_YNY_YDEFAULT YES, NO, YFA, YES default

x_YNY_N MSG_xxx_YNY_NDEFAULT YES, NO, YFA, NO default

x_YNYN MSG_xxx_YNYN YES, NO, YFA, NO FOR ALL (NFA)

x_YNYN_Y MSG_xxx_YNYN_YDEFAULT YES, NO, YFA, NFA, YES default

x_YNYN_N MSG_xxx_YNYN_NDEFAULT YES, NO, YFA, NFA, NO default

where: x is either C (for CRITICAL) or Q (for QUERY).

xxx is either CRITICAL or QUERY.

See the include file pdamsg.h for constant values.

Important:It is expected that all constants actually be define symbols that will be resolved by the C preprocessor.

PCL and CustomizationIntrinsic Functions

158

The MSG_TO_xxx functions will operate on a formatting string determined by the message code. This string will be retrieved from the primary or the secondary message file. See String I/O Conversion Utility Functions, 120 for detailed information about string formatting.

user_message ( type, appcode, appname, message )

Description:

Display a user message with the MSC.Patran user interface and possibly wait for and return a reply. The “type” determines whether the message is displayed in a form or simply output to the history window. The “type” also determines what buttons are available in the form. The “appcode” is a number assigned by the programmer which can be used in conjunction with ui_answer_message and ui_override_message to supply the message response during session file playback. Use of duplicate application codes will not generally cause problems but it is better if they are unique.

Input:

STRING type[] Type of message format desired. May be:“Info” Informative message“Warn” Warning message“Error” Error/Fatal message“Ack” Acknowledgment message“Q_YN” -Yes/No Query w/o default“Q_YN_Y” -Yes/No Query Yes default“Q_YN_N” -Yes/No Query No default“Q_YNY” -Yes/No/YesAll Query w/o default“Q_YNY_N” -Yes/No/YesAll Query No default“Q_YNYN” -Yes/No/YesAll/NoAll Query w/o default“Q_YNYN_Y” -Yes/No/YesAll/NoAll Query Yes default“Q_YNYN_N” -Yes/No/YesAll/NoAll Query No default“C_YN” -Yes/No Critical w/o default“C_YN_Y” -Yes/No Critical Yes default“C_YN_N” -Yes/No Critical No default“C_YNY” -Yes/No/YesAll Critical w/o default“C_YNY_N” -Yes/No/YesAll Critical No default“C_YNYN” -Yes/No/YesAll/NoAll Critical w/o default“C_YNYN_Y” -Yes/No/YesAll/NoAll Critical Yes default“C_YNYN_N” -Yes/No/YesAll/NoAll Critical No default

INTEGER appcode Application message code, unique value.

STRING appname[] Name of the application generating the message.

INTEGER message[] Message to display.

Output:

INTEGER <Return Value> 1=Yes, 2=No, 3=Yes All, 4=Abort, 5=No All.

159Chapter 3: Basic FunctionsIntrinsic Functions

Example:

Please see user_message (p. 342) in the MSC Acumen Toolkit - Code Examples.

msg_get_string ( msgcode, string )

Description:

Retrieve a message string from the message file.

Input:

INTEGER msgtype Message code.

Output:

STRING string String retrieved from message file.

INTEGER <Return Value>

Length of retrieved message string.

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

160

msg_to_form ( msgcode, msgtype, appcode, ints, reals, chars )

Description:

Display a message in either a user interface form or in the history window.

Input:

INTEGER msgcode Message code to look up in message file.

INTEGER msgtype Message type value.

INTEGER appcode Application code reporting error. Use zero for general.

INTEGER() ints Integer data for message formatting.

REAL*() reals Real data for message formatting.

STRING[]() chars String data for message formatting.

Output:

INTEGER <Return Value> Message return code (MSG_STAT_YES, ...).

Error Conditions:

None.

161Chapter 3: Basic FunctionsIntrinsic Functions

Event ManagerThe “em_” routines interact with the user through the event manager, which allows the user to abort PCL programs and interact with the graphics systems similar to the way the delivered PCL performs.

msg_to_text ( msgcode, msgtype, appcode, ints, reals, chars, maxout, chan )

Description:

Write a message to a text I/O file.

Input:

INTEGER msgcode Message code to look up in message file.

INTEGER msgtype Message type value.

INTEGER appcode Application code reporting error.

INTEGER() ints Integer data for message formatting.

REAL*() reals Real data for message formatting.

STRING[]() chars String data for message formatting.

INTEGER maxout Maximum size of each output record.

INTEGER chan Channel from a text_open call or zero to write to standard output (xterm window).

Output:

INTEGER <Return Value> Should normally be 2.

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

162

em_proceed_normal ( )

Description:

This function returns FALSE if the user wants to abort and TRUE if the user does not want to abort. The user signals his abort request by clicking the Abort button and confirming the abort request on the Abort Confirmation form. This function also gives the system a chance to update the forms and the Patran viewports.

Input:

None.

Output:

LOGICAL return TRUE - Continue processing.

FALSE - Abort processing.

Error Conditions:

None.

em_proceed_quick ( )

Description:

This function returns FALSE if the user wants to abort and TRUE if the user does not want to abort. This function is identical to em_proceed_normal except it does not allow the system to update the Patran viewports.

Input:

None.

Output:

LOGICAL return TRUE - Continue processing.

FALSE - Abort processing.

Error Conditions:

None.

em_synchronize ( )

Description:

Synchronize events and graphics, making sure everything is up to date.

163Chapter 3: Basic FunctionsIntrinsic Functions

Session File FunctionsThe following set of routines support session file recording and playback.

Input:

None.

Output:

None.

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

164

.

sf_record_default ( filename, rotations )

Description:

Define the default recording session file name. Typically, only the base name should be specified. The complete file name will be <basename>.ses.<version>. If an existing session file is specified, a higher version number will be automatically created. This command should only appear in the system startup file p3epilog.pcl.

Input:

STRING filename New name of recording session file.

LOGICAL rotations Write all rotation command to FILENAME.

Output:

None.

Error Conditions:

None.

sf_play_default ( filename, single_step )

Description:

Define the session file to be played after system initialization has completed. The complete filename <basename>.<extension>.<version> should always be used to eliminate any ambiguity that may arise from using the same recording and playing file basename.This command should only appear in the system startup file p3epilog.pcl.

Input:

STRING filename Name of session file to play.

LOGICAL single_step Play back the session file one line at a time.

Output:

None.

Error Conditions:

None.

sf_play ( filename )

Description:

Define a session file to be played. This command is typically used from inside a session file to play nested session files.

165Chapter 3: Basic FunctionsIntrinsic Functions

Input:

STRING filename Name of session file to play.

Output:

None.

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

166

sf_commit ( commit_all )

Description:

Specify if each command played back from a session file should be committed to the database. This command is normally entered in the command line.

Input:

LOGICAL commit_all Commit every session file command.

Output:

None.

Error Conditions:

None.

sf_pause ( )

Description:

Allow the playing of a session file to be paused. This will stop/pause the current session file being played and bring up the form. This command is normally edited into a session file for future playback.

Input:

None.

Output:

None.

Error Conditions:

None.

sf_verbose ( write_sys_ms )

Description:

Define if system informational messages should be written to the recording session file.

Input:

LOGICAL write_sys_msg Write system messages to the session file

Output:

None.

167Chapter 3: Basic FunctionsIntrinsic Functions

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

168

sf_write ( string )

Description:

Write a string to the recording session file. This command is not normally used.

Input:

STRING string String to write to the recording session file.

Output:

None.

Error Conditions:

None.

sf_write_disable ( status )

Description:

This function provides control over the mechanism used to write PCL function call information to session files.

Input:

LOGICAL status This value when set to TRUE will disable, and when set to FALSE will enable, the writing of PCL function call information to the session file.

Output:

None.

Error Conditions:

None.

sf_force_write ( string )

Description:

Write a string to the recording session file, even if recording is paused. This command is mainly used for debugging purposes.

Input:

STRING string String to write to the recording session file.

Output:

None.

169Chapter 3: Basic FunctionsIntrinsic Functions

Example:

sf_rotation()> gm_rot_x(value)

Obsolete File I/O FunctionsThe following set of I/O routines are still supported but are considered obsolete. See the File Utility Functions and Text File I/O Utility Functions for the new routines.

Error Conditions:

None.

sf_rotation ( )

Description:

Define if the next command to be recorded is a rotation command. This will allow the rotation commands to be recorded only if the record rotations flag is TRUE. This command is normally used in compiled PCL.

Input:

None.

Output:

None.

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

170

fio_openr ( filename, channel )

Description:

Open a text file for read only.

Input:

STRING filename File to open.

INTEGER channel Channel value to use for subsequent operations.

Output:

INTEGER <Return Value> Zero for success, otherwise error status.

Error Conditions:

None.

fio_openw ( filename, channel, overwrite )

Description:

Open a text file for write access.

Input:

STRING filename File to open.

FALSE overwrite Do not overwrite file if exists.

TRUE Overwrite file if exists.

INTEGER channel Channel value to use for subsequent operations.

Output:

INTEGER <Return Value> Zero for success, otherwise error status.

Error Conditions:

None.

fio_opena ( filename, channel )

Description:

Open a text file for write access at end of file for appending.

Input:

STRING filename File to open.

INTEGER channel Channel value to use for subsequent operations.

171Chapter 3: Basic FunctionsIntrinsic Functions

Output:

INTEGER <Return Value> Zero for success, otherwise error status.

Error Conditions:

None.

PCL and CustomizationIntrinsic Functions

172

fio_close ( channel )

Description:

Close a file opened with one of the FIO_OPENx routines.

Input:

INTEGER channel Channel value from the FIO_OPENx routine.

Output:

INTEGER <Return Value> Zero for success, otherwise error status.

Error Conditions:

None.

fio_delete ( filename )

Description:

Delete a file from the operating system.

Input:

STRING filename File to delete.

Output:

INTEGER <Return Value> Zero for success, otherwise error status.

Error Conditions:

None.

fio_rewind ( channel )

Description:

Set the file read/write position back to the start of the file.

Input:

INTEGER channel Channel value from the FIO_OPENx routine.

Output:

INTEGER <Return Value> Zero for success, otherwise error status.

Error Conditions:

None.

173Chapter 3: Basic FunctionsIntrinsic Functions

fio_read ( channel, string )

Description:

Read a string from a file.

Input:

INTEGER channel Channel value from the FIO_OPENx routine.

Output:

STRING string String read from the file. Must be at least two characters larger than the line being read.

INTEGER <Return Value> Zero for success, otherwise error status.

Error Conditions:

None.

fio_write ( channel, string )

Description:

Write a string to a file.

Input:

INTEGER channel Channel value from the FIO_OPENx routine.

STRING string String to write to the file.

Output:

INTEGER <Return Value> Zero for success, otherwise error status.

Error Conditions:

None.

fio_writec ( channel, format, args... )

Description:

Perform a limited C style format output to the file.

Input:

INTEGER channel Channel value from the FIO_OPENx routine.

STRING format C Format string with handling of \n, \r, \t, %d, %f, %e, %g, %x, %s, %c, and %%.

PCL and CustomizationIntrinsic Functions

174

unknown args Appropriate datatype for format specifiers. Incorrect specifications may cause a crash.

Output:

None.

Error Conditions:

None.

fio_writef ( channel, format, args... )

Description:

Perform a limited FORTRAN style format output to the file.

Input:

INTEGER channel Channel value from the FIO_OPENx routine.

STRING format FORTRAN format string with handling of /, 'string', X, I, F, E, G, and A formats.

unknown args Appropriate datatype for format specifiers. Incorrect specifications may cause a crash. Array arguments are allowed.

Output:

None.

Error Conditions:

None.

fio_save_vars ( channel, var, var, ... )

Description:

Write out PCL variable definitions to a file.

Input:

INTEGER channel Channel value from the FIO_OPENx routine.

ANY var Variable definition to write out to file.

Output:

INTEGER <Return Value>

Zero for success, otherwise error status.

Error Conditions:

None.

175Chapter 3: Basic FunctionsGraphics Functions

Graphics Functions

Graphics ManagerPatranPatran provides a set of PCL callable routines which can be used to draw graphical primitives into the graphics windows. These routines were developed so programmers can provide graphical feedback to the user.

The graphics routines were written at a high level to free the developer from having to worry about the current view or which viewport to draw the graphics (there is a way to direct graphics to a specific viewport). All coordinates to the graphical routines are specified in world space.

Retained GraphicsThe graphical primitives generated from the graphics routines can either be stored in the display list or drawn only to the viewports and not stored. For more information about primitives, see Graphics Primitives, 178.The advantage of stored (retained) graphics is that when the view changes, the primitives will automatically be redrawn in the current view orientation. Unretained graphics would not be redrawn when the view changes. The application would have to take care of redrawing the graphics.

The method by which the graphical primitives can be stored in the display list is through the use of segments. Any number of segments can be created in the graphics manager. Each segment can contain thousands of graphical primitives (lines, text, markers). Segment Routines, 176 contain the routines necessary for creating segments. When drawing graphics into a segment, the graphics will automatically show up in all viewports that contain the current group. As an example, if the user currently has two viewports posted, one for the top view and one for a side view of a group, any graphical feedback that is generated from within a segment will automatically be drawn to both viewports.

Example

Here is an example PCL showing how to draw a red box into a viewport. The box is placed in a segment:

REAL corner1(3), corner2(3), corner3(3), corner4(3)INTEGER segment_id, colorcolor = 1corner1(1) = 0.0corner1(2) = 0.0corner1(3) = 0.0corner2(1) = 5.0corner2(2) = 0.0corner2(3) = 0.0corner3(1) = 5.0corner3(2) = 5.0corner3(3) = 0.0corner4(1) = 0.0corner4(2) = 5.0corner4(3) = 0.0/** Create segment. Segment ID is returned from graphics manager.

PCL and CustomizationGraphics Functions

176

*/gm_segment_create( segment_id )/** Draw lines. Lines will be retained in segment.*/

gm_draw_line( segment_id, color, corner1, corner2 )gm_draw_line( segment_id, color, corner2, corner3 )gm_draw_line( segment_id, color, corner3, corner4 )gm_draw_line( segment_id, color, corner4, corner1 )/** Make sure all graphics have been flushed to the screen.*/

gm_segment_flush()

Segment Routines

These are the routines used to create, delete, and flush segments (PCL syntax shown):

177Chapter 3: Basic FunctionsGraphics Functions

gm_segment_create ( id )

Description:

To create a segment of graphics primitives (lines, text, etc. ).

Input:

None.

Output:

INTEGER id Created segment ID.

INTEGER <Return Value> Status of operation. 0 = Successful.

Error Conditions:

None.

gm_segment_delete ( id )

Description:

To delete a segment and remove all graphics primitives (lines, text, etc. ) in the segment from out of the graphics windows.

Input:

INTEGER id Segment ID to delete.

Output:

INTEGER <Return Value>

Status of operation. 0 = Successful.

Error Conditions:

None.

gm_segment_flush ( )

Description:

To flush all graphics primitives to the screen. All primitives, regardless of segment, will be flushed.

Input:

None.

Output:

INTEGER <Return Value> Status of operation. 0 = Successful.

Error Conditions:

None.

PCL and CustomizationGraphics Functions

178

Graphics Primitives

These are the routines used to draw graphics to the viewports. The graphics primitives can optionally be placed into a segment (PCL syntax shown):

179Chapter 3: Basic FunctionsGraphics Functions

gm_draw_line ( segment_id, color_id, start, end )

Description:

Draw a line in segment or current viewport.

Input:

INTEGER segment_id Segment ID created from gm_segment_create.

INTEGER color_id Color of line (0-15).

REAL[3] start Starting location of line in world coord.

REAL[3] end Ending location of line in world coord.

Output:

INTEGER <Return Value> Status of operation. 0 = Successful.

Error Conditions:

None.

gm_draw_text ( segment_id, color_id, location, text )

Description:

Draw a string in segment or current viewport.

Input:

INTEGER segment_id Segment ID created from gm_segment_create.

INTEGER color_id Color of text (0-15).

REAL[3] location Location of line in world coord.

STRING text Text string. Currently limited to 31 characters.

Output:

INTEGER <Return Value>

Status of operation. 0 = Successful.

Error Conditions:

None.

gm_draw_marker ( segment_id, color_id, location, type, size )

Description:

Draw a marker in a segment or current viewport.

PCL and CustomizationGraphics Functions

180

Input:

INTEGER segment_id Segment ID created from gm_segment_create.

INTEGER color_id Color of marker (0-15).

REAL[3] location Location of marker in world coord.

INTEGER type Type of marker (1-dot, 2-circle, 3-X, 4-+, 5-filled circle, 6-square, 7-filled square, 8-triangle, 9-filled tri, 10-diamond, 11-filled diamond).

INTEGER size Size of marker (in pixels).

Output:

INTEGER <Return Value> Status of operation. 0 = Successful.

Error Conditions:

None.

181Chapter 3: Basic FunctionsGraphics Functions

gm_draw_result_arrow (segment_id, color_id, loc, direction, size, anchor_style, string )

Description:

Draw a result arrow at the specified location in the segment or current viewport.

Input:

INTEGER segment_id Segment ID created from gm_segment_create.

INTEGER color_id Color of arrow.

REAL[3] loc Location of arrow in world coord.

REAL[3] direction Direction of arrow in world coord.

REAL size Size of arrow (percentage of model size).

INTEGER anchor_style Anchor style (1-base, 2-tip, 3-middle).

STRING string Text string.

Output:

None.

Error Conditions:

None.

Note:

The various anchor styles for the “anchor_style” argument are shown below.

Base: 0-------->

Tip: -------->0

Middle: -----0---->

where the location value is marked as "0"

gm_draw_arrow ( segment_id, color_id, base, tip, head_size )

Description:

Draw an arrow at the specified base and tip in the segment or current viewport.

Input:

INTEGER segment_id Segment ID created from gm_segment_create.

INTEGER color_id Color of arrow (0-15).

PCL and CustomizationGraphics Functions

182

Viewport Routines

REAL[3] base Base location of arrow in world coord.

REAL[3] tip Tip location of arrow in world coord.

REAL head_size Arrow head size (percentage of arrow length).

Output:

INTEGER <Return Value> Status of operation. 0 = Successful.

Error Conditions:

None.

Note: The head size is a percentage of the arrow length with a value between 0.0 and 1.0.

gm_conv_world_to_device ( vp_id, world_pt, dev_pt )

Description:

Gets the min/max x, y, z coordinate values of the bounding box that encloses the entities displayed in the current viewport. The coordinate values returned are in the global (world) coordinate system.

Input:

vp_id. integer viewport id

world_pt real (3) xyz world coordinate

Output:

dev_pt real (3) xyz device coordinate

INTEGER <Return Value> Status of operation. 0 = Successful.

Error Conditions:

15000025 Error in finding the viewport in the graphics manager display list

Note: The device coordinates are returned in floats (real). The z-value in device coordinates is to allow depth differentiation of points that map to the same x,y location on the screen. Larger z-values are in front of smaller z-values.

183Chapter 3: Basic FunctionsGraphics Functions

gm_viewports_refresh ( )

Description:

Refresh all of the viewports.

Input:

None.

Output:

None.

Error Conditions:

None.

gm_viewport_refresh ( )

Description:

Refresh current viewport.

Input:

None.

Output:

None.

Error Conditions:

None.

gm_viewport_center_get ( center )

Description:

Calculate the center of the current viewport.

Input:

None.

Output:

REAL center Center of the model.

Error Conditions:

None.

PCL and CustomizationGraphics Functions

184

gm_viewport_world_limits_get ( limits )

Description:

Get the x, y and z minimum/maximum values of the model in world space.

Input:

None.

Output:

REAL(6) limits Returns 5% less than the minimum and 5% more than the maximum x, y and z coordinates of the model in world space.

Error Conditions:

None.

gm_viewport_subject_get ( persp_off, center, zoom )

Description:

Calculate the center of the current viewport.

Input:

None.

Output:

INTEGER persp_off If TRUE, this skips perspective. If FALSE, the perspective setting in the current viewport will be used.

REAL[2] center Center of subject space for the viewport.

REAL ZOOM Zoom factor for the subject space.

Error Conditions:

None.

Chapter 4: System and Utility FunctionsPCL and Customization

4 System and Utility Functions

Spawning a Process

Database Locking

System Functions

PCL and CustomizationSpawning a Process

186

Spawning a ProcessApplication developers may have the need to execute other programs in order to perform certain operations. Programs that execute other programs are said to be “spawning a process.” The following sections provide details for spawning a process from inside Patranwww.ebay, how a database can be locked to prevent access during the spawning process, and how to add entries to the Status Database in order track the status of a spawned process.

Spawning a remote process is one method of performing customized functionality. The PCL function utl_process_spawn is used by Patran to spawn a process. See The PATRAN Command Language (PCL) Introduction (Ch. 2) for a summary of the related PCL functions.

Example: An application developer has an executable (script or program) called mytranslator that requires the database name and a count. The developer’s executable, mytranslator, should reside somewhere along the PCL path, as defined by the PCL directive, !!PATH in either the p3prolog.pcl file or the p3epilog.pcl file. See The p3prolog.pcl and p3epilog.pcl Files (p. 54) in the Patran Reference Manual.

FUNCTION start_mytrans(dbname, count)string dbname[]integer countinteger statusstring mytrans[256], cmd[512]

/* Find where mytranslator is - we should check for errors */status = file_get_filespec(“mytranslator,” ”OP,” mytrans)

/* Format the argument string required by mytranslator */str_formatc(cmd,”%s -db %s -cnt %d,” mytrans, dbname, count)

/* Spawn the process and continue; do not wait for completion. *//* If a process spawning error occurs, display it as severity 2 (WARNING) */status = utl_process_spawn(cmd, FALSE)IF ( utl_process_error( status ) ) THENutl_display_error( status, 2)ENDIFEND FUNCTION /* start_mytrans */The PCL call:start_mytrans(“my.db,”542)will invoke the following from the bourne shell:mytranslator -db my.db -cnt 542

Note: For portability reasons, all scripts should be written for the bourne shell.

187Chapter 4: System and Utility FunctionsDatabase Locking

Database LockingHaving more than one process access a database simultaneously can damage the database. In order to prevent this, Patran locks the database while it is in use. Any executable that uses a database (translator, solver, etc.) should also perform a file lock to guarantee secure access of that database. If a database is locked, a message will be relayed indicating that the database is in use.

The stand-alone utility lockfile gives an application developer the ability to lock databases. If this utility is run for a database that is already locked, it will wait five minutes and retry. It will not lock a database until an existing database lock has been cleared.

The lockfile utility requires the name of the database to lock and a command string to execute. The lock will remain active as long as the command executes. The syntax for the lockfile utility is as follows:

lockfile <dbname> <cmd> <cmd_arg1> <cmd_arg2> . . .

Example: Modify the executable start_mytrans (shown in the Example in Spawning a Process, 186) to support database locking.

FUNCTION start_mytrans(dbname, count)< same as previous example >/* CHANGED: Format the argument string required by mytranslator */str_formatc(cmd,”lockfile %s %s -db %s -cnt %d,” @dbname, mytrans, dbname, count)

/* Spawn the process and continue; do not wait for completion. *//* If a process spawning error occurs, display it as severity 2 (WARNING) */status = utl_process_spawn(cmd, FALSE)IF ( utl_process_error( status ) ) THENutl_display_error( status, 2)ENDIFEND FUNCTION /* start_mytrans */

Using the previous example, this will execute the following command:

lockfile my.db mytranslator -db my.db -cnt 542

PCL and CustomizationSystem Functions

188

System FunctionsSystem functions have varied functions and can be useful for getting system information or accessing special operations in the PCL environment

Example:

REAL value = 3.14159INTEGER bitssys_move_raw( value, bits )$ Bits is now the integer representation of the floating point number. $ The value contained in bits will be completely machine dependent

sys_move_raw (source, destination)

Description:

Move raw data from one PCL variable to another. This function is not generally used but can occasionally be useful if data in one format needs to be accessed in another format.

Input:

ANY source The source variable to move information from.

Output:

ANY destination The destination variable to which to copy the source variable.

Error Conditions:

None.

189Chapter 4: System and Utility FunctionsSystem Functions

sys_product ( )

Description:

Return a string representing the name of the product/application being executed.

Input:

None.

Output:

STRING <Return Value> Product name, such as “Patran”.

Error Conditions:

None.

sys_release ( )

Description:

Return a string representing the release/version of the product/application being executed.

Input:

None.

Output:

STRING <Return Value> Release/Version string.

Error Conditions:

None.

PCL and CustomizationSystem Functions

190

sys_date ( )

Description:

Return a string with the current date in dd-mm-yy format.

Input:

None.

Output:

STRING <Return Value> String representing date such as “25-Feb-92.”

Error Conditions:

None.

sys_time ( )

Description:

Return a string with the current time in hh:mm:ss format.

Input:

None.

Output:

STRING <Return Value>

String representing time such as “12:52:22.”

Error Conditions:

None.

sys_clock ( )

Description:

Return the current time in seconds since midnight.

Input:

None.

Output:

191Chapter 4: System and Utility FunctionsSystem Functions

REAL <Return Value>

Current time in seconds since midnight expressed as a REAL.

Error Conditions:

None.

PCL and CustomizationSystem Functions

192

sys_cputime ( )

Description:

Return a cpu time value in seconds on a machine dependent base. It is recommended to use this value by taking the difference between two calls to the function in the same session. This routine returns the sum of the user and system time.

Input:

None.

Output:

REAL <Return Value> CPU time in seconds from unknown base.

Error Conditions:

None.

sys_allocate_array (array, lb1, hb1 [, lb2, hb2 [, lb3, hb3 [, lb4, hb4 ]]] )

Description:

Allocate memory for a PCL virtual array variable. This function is more completely described in the virtual arrays section of the PCL manual

Input:

INTEGER lb1 Lower bound for first dimension.

INTEGER hb1 Higher bound for first dimension.

INTEGER lb2 Optional lower bound for a second dimension.

INTEGER hb2 Optional upper bound for a second dimension.

INTEGER lb3 Optional lower bound for a third dimension.

INTEGER hb3 Optional upper bound for a third dimension.

INTEGER lb4 Optional lower bound for a fourth dimension.

INTEGER hb4 Optional upper bound for a fourth dimension.

Output:

ANY(VIRTUAL) array Virtual array with storage allocated if available.

INTEGER <Return Value> Zero for success, else error code.

Error Conditions:

None.

193Chapter 4: System and Utility FunctionsSystem Functions

Remarks:

This function can only be used to increase the size of the array. An attempt to reduce the size of the array will not return an error value and will not reduce the size of the array.

This function will not reorder the data in original array. If a two-dimensional virtual array is reallocated so that the number of offsets in the second or column dimension are increased, the contents of the entries of the first or row dimension will be modified. See the example listed below.

Example:FUNCTION reallocate_demonstration() INTEGER row_count INTEGER column_count INTEGER test_array(VIRTUAL) INTEGER row_size

sys_reallocate_array (array, lb1, hb1 [, lb2, hb2 [, lb3, hb3 [, lb4, hb4 ]]] )

Description:

Re-allocate memory for a PCL virtual array variable. This function is more completely described in Virtual Arrays, 15.

Input:

ANY(VIRTUAL)

array Original virtual array.

INTEGER lb1 Lower bound for first dimension.

INTEGER hb1 Higher bound for first dimension.

INTEGER lb2 Optional lower bound for a second dimension.

INTEGER hb2 Optional upper bound for a second dimension.

INTEGER lb3 Optional lower bound for a third dimension.

INTEGER hb3 Optional upper bound for a third dimension.

INTEGER lb4 Optional lower bound for a fourth dimension.

INTEGER hb4 Optional upper bound for a fourth dimension.

Output:

ANY(VIRTUAL)

array Virtual array with storage reallocated if available.

INTEGER <Return Value>

Zero for success, else error code.

Error Conditions:

None.

PCL and CustomizationSystem Functions

194

INTEGER column_size INTEGER return_value INTEGER array_value

/* * Set up the initial array sizes */ column_size = 5 row_size = 5

/* * Do the initial array allocation */ return_value = sys_allocate_array ( test_array, 1, row_size, 1, column_size ) IF (return_value != 0 ) THEN write(" ") write("Calling sys_allocate_array() has failed.") write(" ") dump return_value END IF

write(" ") write("Initialize the array.") write(" ") array_value = 1 FOR (row_count = 1 TO row_size) FOR (column_count = 1 TO column_size) test_array (row_count, column_count) = array_value array_value = array_value + 1 END FOR END FOR dump test_array

write(" ") write("Increase the row size.") write(" ") row_size = 10 return_value = sys_reallocate_array ( test_array, 1, row_size, 1, column_size ) IF (return_value != 0 ) THEN write(" ") write("Calling sys_allocate_array() has failed.") write(" ") dump return_value END IF dump test_array

write(" ") write("Decrease the row size.") write(" ") column_size = 5 row_size = 10 return_value = sys_reallocate_array ( test_array, 1, row_size, 1, column_size ) IF (return_value != 0 ) THEN write(" ") write("Calling sys_allocate_array() has failed.") write(" ") dump return_value END IF dump test_array

write(" ") write("Deallocate, reallocate and reinitialize the original array.") write(" ") column_size = 5 row_size = 5 return_value = sys_free_array ( test_array )

195Chapter 4: System and Utility FunctionsSystem Functions

IF (return_value != 0 ) THEN write(" ") write("Calling sys_free_array() has failed.") write(" ") dump return_value END IF

return_value = sys_allocate_array ( test_array, 1, row_size, 1, column_size ) IF (return_value != 0 ) THEN write(" ") write("Calling sys_allocate_array() has failed.") write(" ") dump return_value END IF

array_value = 1 FOR (row_count = 1 TO row_size) FOR (column_count = 1 TO column_size) test_array (row_count, column_count) = array_value array_value = array_value + 1 END FOR END FOR dump test_array

write(" ") write("Increase the column size.") write(" ") column_size = 10 return_value = sys_reallocate_array ( test_array, 1, row_size, 1, column_size ) IF (return_value != 0 ) THEN write(" ") write("Calling sys_allocate_array() has failed.") write(" ") dump return_value END IF dump test_array

END FUNCTION

END FUNCTION

PCL and CustomizationSystem Functions

196

sys_free_array ( array )

Description:

Free memory for a PCL virtual array variable. This function is more completely described in Virtual Arrays, 15.

Input:

ANY(VIRTUAL) array Virtual array.

Output:

ANY(VIRTUAL) array Virtual array now deallocated

INTEGER <Return Value> Zero for success, else error code.

Error Conditions:

None.

sys_allocate_string ( string, size )

Description:

Allocate memory for a PCL virtual string variable. This function is more completely described in Virtual Arrays, 15.

Input:

INTEGER size New maximum size for the virtual string variable.

Output:

STRING string Virtual string with storage allocated if available.

INTEGER <Return Value> Zero for success, else error code.

Error Conditions:

None.

sys_reallocate_string ( string, size )

Description:

Re-allocate memory for a PCL virtual string variable. This function is more completely described in Virtual Arrays, 15.

Input:

STRING string Original virtual string.

197Chapter 4: System and Utility FunctionsSystem Functions

INTEGER size New maximum size for the virtual string variable.

Output:

STRING string Virtual string with storage allocated if available.

INTEGER <Return Value>

Zero for success, else error code.

Error Conditions:

None.

sys_free_string ( string )

Description:

Free memory for a PCL virtual array variable. This function is more completely described in Virtual Arrays, 15.

Input:

STRING string Virtual string.

Output:

STRING string Virtual string now deallocated.

INTEGER <Return Value>

Zero for success, else error code.

Error Conditions:

None.

sys_array_hbound ( array, dim )

Description:

Return the upper bound for a dimension of an array.

Input:

ANY() array Array to return upper bound for.

INTEGER dim Dimension number to return bound for, one for first dimension.

Output:

INTEGER <Return Value> Upper bound of specified dimension of specified array.

Error Conditions:

None.

PCL and CustomizationSystem Functions

198

sys_array_lbound ( array, dim )

Description:

Return the lower bound for a dimension of an array.

Input:

ANY() array Array to return lower bound for.

INTEGER dim Dimension number to return bound for, one for first dimension.

Output:

INTEGER <Return Value> Lower bound of specified dimension of specified array.

Error Conditions:

None.

sys_array_nbound ( array )

Description:

Return the number of bounds/dimensions for an array.

Input:

ANY() array Array to return number of dimensions for.

Output:

INTEGER <Return Value> Number of dimensions of specified array or zero if not an array.

Error Conditions:

None.

sys_class_get ( classname, varname )

Description:

This function will return the value of a classwide variable from a class of PCL functions.

Input:

STRING class_name[32] This value specifies the name of the PCL function class from which the variable value will be retrieved.

STRING variable_name[32]

This value specifies the name of the variable which will have its value retrieved.

Output:

199Chapter 4: System and Utility FunctionsSystem Functions

Remarks:

This function assumes that the caller already knows the data type of the variable whose contents will be returned.

Example:

None.

DYNAMIC_ILRSW

<Return Value> This function returns the value from the specified variable which is a member of the specified class.

Error Conditions:

None.

PCL and CustomizationSystem Functions

200

sys_class_set ( classname, varname, newvalue )

Description:

Set the contents of a class variable.

Input:

STRING classname Class name specified as a string.

STRING varname Variable name specified as a string.

UNKNOWN newvalue New value for the class variable. The value must be of the correct type.

Output:

None.

Error Conditions:

None.

Side Effects:

Unknown. Be cautious with this routine. Most class functions do not expect their variables to change from accesses outside of the class definition.

sys_hash_stat ( tablename )

Description:

Output internal hash table statistics for various parts of the Patran system. This routine is primarily for performance tuning and is not expected to be used by the typical user.

Input:

STRING tablename Name of a system hash table.

Output:

STRING tablename Name of a system hash table.

LOGICAL <Return Value> True if hash table found, FALSE otherwise.

Error Conditions:

None.

sys_eval (pcl_expression)

Description:

This function will execute a PCL expression contained in a string.

201Chapter 4: System and Utility FunctionsSystem Functions

Input:

STRING pcl_expression This value provides the PCL expression that will be evaluated. This expression is evaluated in a global context where it will be assumed that any variables in the PCL expression will have a global scope. This global context prevents the use of any local variables in the PCL expression.

Output:

DYNAMIC_ILRS <Return Value> This function will return the results of the evaluated PCL expression. The type of the data returned will be defined by the evaluated PCL expression.

Error Conditions:

None.

sys_func_where ( func [, options] )

Description:

Search for type and existence of a PCL function.

Input:

STRING func Name of PCL function to search for.

INTEGER options Optional argument which if set to one causes a faster search to take place which might miss changes made to library lists.

Output:

INTEGER <Return Value> Result of check. If function does not exists, the value is zero. If the function is an intrinsic function, the value is one. If the function exists and is currently loaded into memory, the value is two. If the function exists, but is currently not in memory, the value is three.

Error Conditions:

None.

PCL and CustomizationSystem Functions

202

sys_sf_callopt ( options )

Description:

Set options for session file “>” processing lines. This routine is not normally expected to be used by users.

Input:

INTEGER options One to suppress all session, two to suppress next, zero to enable.

Output:

INTEGER <Return Value> Previous value of the options.

Error Conditions:

None.

sys_sf_argopt ( argnum, options )

Description:

Set options for session file “>” processing lines. This routine is not normally expected to be used by users.

Input:

INTEGER argnum Argument number to affect.

INTEGER options Sum of 1 for use variable instead of value, 2 for output declaration, and 4 for output class declaration.

Output:

INTEGER <Return Value> Previous value of the options.

Error Conditions:

None.

sys_sf_write ( string )

Description:

Write string to session file under control of SYS_SF_CALLOPT. This routine is not normally expected to be used by users.

Input:

STRING string String to write to the session file.

Output:

203Chapter 4: System and Utility FunctionsSystem Functions

None.

Error Conditions:

None.

PCL and CustomizationSystem Functions

204

sys_sf_vwclear ( )

Description:

Clear variable written list. This routine is not normally expected to be used by users.

Input:

None.

Output:

None.

Error Conditions:

None.

sys_sf_commit ( )

Description:

Commit variable written list. This routine is not normally expected to be used by users.

Input:

None.

Output:

None.

Error Conditions:

None.

sys_sf_undo ( )

Description:

Undo variable written list up to last commit. This routine is not normally expected to be used by users.

Input:

None.

Output:

None.

Error Conditions:

None.

205Chapter 4: System and Utility FunctionsSystem Functions

sys_poll_option ( option )

Description:

Set polling options for PCL compiler/interpreter for checking aborts, events, and graphics updates. This routine is not normally expected to be used by users but can speed up operations by minimizing graphics updates if used correctly.

Input:

INTEGER option Zero for full check, one for quick check, two for no check.

Output:

INTEGER <Return Value> Previous value of the options.

Error Conditions:

None.

sys_trace ( options )

Description:

Allow setting of tracing options during runtime execution. See !!TRACE (p. 9) for details.

Input:

STRING options String with any of blank separated keywords of “CALLS”, “LINES”, “EXITS”, “STDOUT”, “NOCALLS”, “NOLINES”, “NOEXITS”, “NOSTDOUT”, “NONE”.

Output:

STRING <Return Value> Previous value of the options.

Error Conditions:

None.

sys_traceback ( )

Description:;

Output a PCL error call traceback.

Input:

None.

Output:

None.

PCL and CustomizationSystem Functions

206

Error Conditions:

None.

207Chapter 4: System and Utility FunctionsSystem Functions

sys_input ( filename [,noerror ] )

Description:

Allow setting of an input file during execution. See !!INPUT (p. 9) for details. Note: This routine will often work differently than expected as the inputted file is queued for execution and won't actually execute until PCL returns control to the user interface.

Input:

STRING FILENAME Name of operating system file to input.

LOGICAL NOERROR Optional flag which if set TRUE will suppress any error if the specified file does not exist.

Output:

LOGICAL <Return Value> True if input queued successfully.

Error Conditions:

None.

sys_stop_input ( )

Description:

Attempt to stop !!INPUT file during runtime execution.

Input:

None.

Output:

None.

Error Conditions:

None.

sys_library ( operation, args )

Description:

Allow setting of library options during runtime execution. See !!LIBRARY (p. 9) for details.

Input:

STRING operation String with operation keyword of either “”, “ADD”, “CREATE”, “DELETE”, “KEEPOPEN”, “LIST”, “MERGE”, “NONE”, “REHASH”, “REMOVE”, or “SORT”.

PCL and CustomizationSystem Functions

208

STRING args Filename(s) or function name(s) depending on operation specified.

Output:

None.

Error Conditions:

None.

209Chapter 4: System and Utility FunctionsSystem Functions

sys_path ( operation, paths )

Description:

Allow setting of path options during runtime execution. See !!PATH (p. 9) for details.

Input:

STRING operation String with operation keyword of either “ ”, “NONE”, or “REMOVE”.

STRING paths Pathname(s) for operations.

Output:

None.

Error Conditions:

None.

sys_get_env ( ename, result )

Description:

Look up a system environment variablt name.

Input:

STRING ename Name of environment variable to look up. Note that this name is case sensitive on unix systems.

Output:

STRING result String result of environment definition if environment variable is defined.

INTEGER <Return Value> Zero for success, else error code if environment variable is not defined.

Error Conditions:

None.

sys_get_errno_msg ( enoval, result )

Description:

Translate a system “errno” value to a string.

Input:

INTEGER enoval System “errno” value.

Output:

PCL and CustomizationSystem Functions

210

STRING result String with message for specified errno.

Error Conditions:

None.

211Chapter 4: System and Utility FunctionsSystem Functions

sys_get_info ( infotype, result )

Description:

Get various kind of “system” information.

Input:

INTEGER infotype Type of information desired, currently only 1=Machine Name.

Output:

STRING result Returned information as a string. For infotype=1, the possible returns are: SUNS, SGI5, RS6K, HP700, HPIPF, WINNT and LX86 with possible others in the future.

INTEGER <Return Value>

Zero for success, else error.

Error Conditions:

None.

sys_get_user ( uname )

Description:

Get operating system user name for currently logged in user.

Input:

None.

Output:

STRING uname Login name of user logged in.

Error Conditions:

None.

utl_get_cust_info ( custnumber, custname )

Description:

Get customer information.

Input:

STRING custnumber Customer number string.

STRING custname Customer name string.

Output:

PCL and CustomizationSystem Functions

212

INTEGER <Return Value> Status, 0=success.

Error Conditions:

None.

213Chapter 4: System and Utility FunctionsSystem Functions

utl_get_host_name ( host )

Description:

Retrieve name of operating system network host.

Input:

None.

Output:

STRING host Network host name.

Error Conditions:

None.

utl_get_product ( product )

Description:

Return Patran product name (same as sys_product).

Input:

None.

Output:

STRING product Product name string.

Error Conditions:

None.

utl_get_user_name ( user )

Description:

Retrieve name of operating system user.

Input:

None.

Output:

STRING user User name.

LOGICAL <Return Value> True for successful retrieval.

PCL and CustomizationSystem Functions

214

Error Conditions:

None.

215Chapter 4: System and Utility FunctionsSystem Functions

utl_get_version ( version )

Description:

Return Patran version number (same as sys_release).

Input:

None.

Output:

STRING version Version number string.

Error Conditions:

None.

utl_process_spawn ( command, wait )

Description:

The program will execute a “fork” system call (or “vfork”, depending on the specific machine implementation) followed by an “execvp” system call with the “command” specified by the caller as its argument. The spawned command becomes a “process group leader.” This allows all processes created by this spawned process to be killed via the abort button or UTL_PROCESS_KILL. Redirection cannot be used in subprocess commands entered via utl_process_spawn. If redirection is required for the subprocess it is recommended that a bourne shell script be created which accepts the redirected input and output files as arguments and then issues the actual command of interest, including the redirection. This bourne shell script is what should be input to the utl_process_spawn function in this case.

Input:

STRING command Command string to execute.

LOGICAL wait True to wait for completion before continuing. False to execute command asynchronously.

Output:

INTEGER <Return Value> If WAIT is TRUE, then a return code is returned which needs to be checked by utl_process_error. If WAIT is FALSE, then the process group ID of the subprocess is returned. On Windows NT if WAIT is FALSE, then zero is returned.

Error Conditions:

None.

PCL and CustomizationSystem Functions

216

Example:stat = utl_process_spawn( “lpr results.out”, TRUE )IF( utl_process_error( stat ) ) THEN utl_display_process_error( stat, 3 )END IF

Important: The spawned process must not return the value 253. This value is reserved for MSC internal use.

217Chapter 4: System and Utility FunctionsSystem Functions

utl_process_wait ( pid )

Description:

Wait for an asynchronous command to finish completion.

Input:

INTEGER pid Process ID returned from a previous call to utl_process_spawn with WAIT as FALSE.

Output:

INTEGER <Return Value> Status code that can be checked with utl_process_error.

Error Conditions:

None.

utl_display_process_error ( errcode, severity )

Description:

Display an error message based on a status code from one of the utl_process commands.

Input:

INTEGER errcode Status from utl_process_spawn or utl_process_wait.

INTEGER severity Type of form to use for display. 1=Info, 2=Warning, 3=Acknowlege, 4=Fatal.

Output:

None.

Error Conditions:

None.

utl_process_error ( errcode )

Description:

Check status of utl_process_spawn or utl_process_wait.

Input:

PCL and CustomizationSystem Functions

218

INTEGER errcode Status from utl_process_spawn or utl_process_wait.

Output:

LOGICAL <Return Value> TRUE if error occurred, FALSE otherwise.

Error Conditions:

None.

utl_process_kill ( pid )

Description:

To kill a spawned subprocess and all child processes created on its behalf.

Input:

INTEGER pid PID returned from UTL_PROCESS_SPAWN

Output:

None.

Error Conditions:

None.

Chapter 5: User Interface and List Processor FunctionsPCL and Customization

5 User Interface and List Processor Functions

Introduction 220

General Form Style 225

Creating Forms and Widgets Using PCL 246

widget Function Descriptions 256

List Processor 258

User Interface Functions 297

PCL and CustomizationIntroduction

220

Introduction Nearly all of the forms and widgets that are contained in Patran were created using PCL. Users can customize the Patran interface by adding a menu to the main form and by adding items to that menu. Adding a PCL function called a “callback” which is referenced by the user defined menu can then bring up forms and widgets in any way the user desires.

Customization of the interface occurs through PCL programs. The PCL Class was specifically designed to manage Forms and widgets. Each Class contains a reserved set of PCL Functions called init, display and refresh which are used to define, display and update the form and all the widgets contained in the form, respectively. The Class structure is as follows.

CLASS classname

CLASSWIDE declarations...

hheader initwidget definitionsEND FUNCTION

hheader displayui_form_display(classname)END FUNCTION

hheader refreshdb_get_item(...)ui_wid_get(...)ui_wid_set(...)END FUNCTIONfunctions (see Structure of a PCL Function, 26END CLASS

The Init Function

The init function contains PCL functions which define the form and the individual widgets. An example of a built-in to create a button widget looks like this:

/* * Create the “Apply” button */

apply_button = ui_button_create( @ /* parent */ form_id, @ /* callback */ “apply_cb”, @ /* x */ 0.136, @ /* y */ y_loc, @ /* width */ 1.0, @ /* height */ 0.0, @ /* label */ “Apply”, @ /* labelinside */ TRUE, @ /* highlight */ TRUE )

widget Hierarchy

Widgets are created in a hierarchical manner. Every widget has a parent except for a form. In the previous example which is the built-in to create an “Apply” button, the parent widget was a form and its id was “form_id”. “form_id” is a PCL variable that is declared as widget and returned as a value from a widget creation call similar to the way the PCL variable “apply_button” is assigned a value from the call to “ui_button_create” in the previous button example. When creating widgets, the parent

221Chapter 5: User Interface and List Processor FunctionsIntroduction

widget must be identified, usually as the first argument in the call to the create function. A parents widgets are referred to as its children.

Events

If the user “clicks” on a widget with the mouse button, an event is generated. Events are handled by the event manager which, in general performs the appropriate operation to respond to the user. If the user provides customized forms and widgets, it is necessary to inform the event manager that he is “listening” for events that occur regarding any of the user supplied widgets. The resulting response to a user supplied widget is a PCL function called a Callback which the user must write and identify when he creates a widget.

Callbacks

A Callback is a PCL function. If an event occurs for a user supplied widget which requires an action, a Callback must be specified at the time the widget is created to handle the event. The second argument in the widget creation call is normally a string which contains the function name as the Callback. In the “Button” example, “apply_cb” is the Callback function for the “Apply” button. The Callback function must exist in the Class in which the widget is created. In our example, the Callback looks like this:

apply_cb()/** Add all the elements with shape element_shape into the group* specified in the group_name_box list box*/

STRING group_name[32] STRING element_shape[5]

ui_wid_get(group_name_box, “VALUE”, group_name) ui_wid_get(el_shape_switch, “VALUE”, element_shape) put_element_in_group(element_shape, group_name)ui_wid_refresh()

END FUNCTION /* apply_cb end function */

The “Apply” button for our example takes all the elements of a certain shape as specified in a switch and adds them to a group which was typed into a databox. The widget id for the switch is “el_shape_switch” and the widget id for the databox is “group_name_box”. The function “ui_wid_get” gets information or parameters as specified in the second argument from the identified widget. The form might look something like this:

PCL and CustomizationIntroduction

222

Locating and Sizing Widgets

When creating a widget, the widget location is always specified relative to its parent. The position is given in inches. The only exception is a form which is positioned relative to the graphics display and can be positioned relative to the upper-left, lower-left, upper-right or lower-corner of the display.

Each widget is sized in inches, usually as a x and y dimension. In some cases, a value of zero can be input so that the size is based on the font size contained in the widget.

Tailoring Widgets

Each widget has a number of resources or parameters which can be set or changed to modify the look and response of the widget. The functions ui_wid_set and ui_wid_get allow changing the widget resources. A typical call looks like:

ui_wid_set(apply_button, “ENABLE”, FALSE)

This results in the button whose id is apply_button to be ghosted as in the following example.

223Chapter 5: User Interface and List Processor FunctionsIntroduction

The Display Function

Once the widget are defined in the init function in the Class, the display function is used to make them visible. An example of a display function is:

FUNCTION DISPLAY()

ui_form_display(“group_elements”)

END FUNCTION

The function ui_form_display has one argument which is a Class name. Any form defined in the init function for the given class is displayed along with all of its children widgets. Individual widgets on the form may be set to invisible by calling ui_wid_set(widget_id, “DISPLAY”, FALSE).

Displaying a Form, “ui_exec_function (class_name, “display”)”

To actually make the form appear it is necessary to invoke a special function called ui_exec_function. This function is specifically designed to execute a PCL function defined in the named Class so that, if the init function hasn’t been previously called, it will be prior to executing the named function in the Class, otherwise, it just executes the named function. It is important that the init function is called only once during a Patran session since this is the function which defines all of the widget attributes and saves it in memory. If the init function were to be called more than once during a session, the data would be duplicated in memory and the program would produce unexpected results.

During the development of a PCL program where forms and widgets are being created, it might be convenient to remove the definition of the widgets from memory. This can be accomplished by a call to

PCL and CustomizationIntroduction

224

ui_form_delete(class_name). Any form defined in the given Class is deleted from memory as well as all of its children widgets. After modifying the PCL Class and re-compiling use ui_exec_function to re-display the form with the revised widgets (which in turn invokes the init function).

When putting the code into “production”, ui_form_delete should be replaced with ui_form_hide(class_name) to un-display the form but not delete its resources and widget definitions.

Refreshing a form

Once a form is defined and displayed, it may display information which can change while it is being displayed. An example might be the contents of a group on the group modify form. If the user were to delete one of the entities contained in the group while the form was displayed, the form would become out-of-date if some mechanism wasn’t provided to “refresh” the form. In Patran, the function ui_wid_refresh() performs that function. When ui_wid_refresh() is called (no arguments), the User Interface Management system is invoked to determine the Class name of all forms currently displayed. For every Class whose form is displayed, the refresh function is called in that Class to update the form. An example of a refresh function is:

/*$$ callback FUNCTION refresh( ) * * Purpose: * Get the current analysis code * * Input: * <none> * * Output: * <none> * */ FUNCTION refresh( )

INTEGER db_status STRING current_analysis_code[32]

db_status = db_get_default_anal_code( current_analysis_code )

IF( db_status != 0 ) RETURN

ui_wid_set( analysis_code, “LABEL”, current_analysis_code )

END FUNCTION /* refresh */

In the above example, a label is displayed which shows the current analysis code, the call db_get_default_anal_code(current_analysis_code) returns the current analysis code in a string. the call to ui_wid_set for the label whose id is analysis_code changes the label to indicate the new analysis code.

225Chapter 5: User Interface and List Processor FunctionsGeneral Form Style

General Form StyleDefine Strings are provided to size and position forms and widgets for a consistent “look and feel”.

Use of Include Files in Creating Patran Forms

There are two include files delivered with Patran in the $P3_HOME/customization directory which are very helpful in creating forms. They are appforms.p and uiforms.p. In order to include these files in any PCL source use the C preprocessor “#include” command, for example:

#include “appforms.p”

The contents of these files are described later in this chapter.

Whenever these include files are used in PCL source code the source file must be sent through a C preprocessor and the resulting preprocessed file used in the PCL compilation. The PCL compiler does not understand C preprocessor commands and they will cause errors if the source file is not first preprocessed.

See The C Preprocessor, 31 for more about use of the C preprocessor in PCL and other language source files.

General FormsIf these values are used it is recommended that “UL” is used for the fourth argument in the ui_form_create() call, position, to reference the upper left corner. The diagram below shows the sizes provided.

PCL and CustomizationGeneral Form Style

226

Standard Form Widths

FORM_WID_SML Use for Application Forms and forms where a SINGLE column of widgets is desired.

FORM_WID_MED Use for forms where a DOUBLE column of widgets is desired or where wide widgets are needed.

FORM_WID_LRG Use for forms where a TRIPLE column of widgets is desired or where extra wide widgets are needed.

Special Form Width

FORM_WID_SPL Use for forms that are 1.5 times a normal or small form width. This form size is good for file forms and forms that include a color bar.

Standard Form Heights

FORM_HGT_TALL FULL height is for forms that extend from the top menu to the bottom of the screen and Application Forms.

FORM_HGT_3_QTRS

3_QTRS height is for forms 3/4 of a full height form.

FORM_HGT_5_8THS 5_8THS height is for forms 5/8 of a full height form.

FORM_HGT_HALF HALF height is for forms half of a full height form.

227Chapter 5: User Interface and List Processor FunctionsGeneral Form Style

FORM_HGT_3_8THS 3_8THS height is for forms 3/8 of a full height form.

FORM_HGT_QTR QTR height is for forms one quarter of a full height form.

Important:Other form heights may be obtained by adding heights together.

Form Margins

FORM_L_MARGIN Left margin for placing frame widgets.

FORM_R_MARGIN Right margin between frame and right side of form.

FORM_T_MARGIN Top margin for placing widgets on form.

FORM_B_MARGIN Bottom margin for placing widgets on form.

Form Placement X Locations

FORM_X_LOC Normal form x location.

FORM_X_LOC_SML Normal form x location (same as FORM_X_LOC).

FORM_X_LOC_SPL Normal special (1.5 times small) form x location.

FORM_X_LOC_MED Normal medium width form location.

FORM _X_LOC_LRG Normal large width form location.

FORM_X_LOC_SML_NX2_SML Place a small form next to a small form.

FORM_X_LOC_2ND_SML_NX2_SML Place a second small form next to a small form (result is three small forms).

FORM_X_LOC_SPL_NX2_SML Place a special (1.5 times small) form next to a small form.

FORM_X_LOC_MED_NX2_SML Place a medium form next to a small form.

FORM_X_LOC_LRG_NX2_SML Place a large form next to a small form.

FORM_X_LOC_SML_NX2_MED Place a small form next to a medium form.

FORM_X_LOC_SPL_NX2_MED Place a special (1.5 times small) form next to a medium form.

FORM_X_LOC_MED_NX2_MED Place a medium form next to a medium form.

FORM_X_LOC_SML_NX2_LRG Place a small form next to a large form.

FORM_X_LOC_SML_CEN Center a small form.

FORM_X_LOC_SPL_CEN Center a special (1.5 times small) form.

FORM_X_LOC_MED_CEN Center a medium form.

FORM_X_LOC_LRG_CEN Center a large form.

PCL and CustomizationGeneral Form Style

228

Keeping Track of Y Location for Widgets

Y locations are relative to the form. Keep in mind the form margins, label heights and the height of each widget.

Once a form is placed, the y location of the widgets inside the form are relative to the form. The total height of the items inside each form and the top and bottom form margins need to be added to the variable that keeps track of position on the form.

Form Placement Y Locations

FORM_Y_LOC Place a form under the main menu bar.

FORM_Y_LOC_HALF_CEN Center a half of full height form between the main menu bar and the command line.

FORM_Y_LOC_3_8THS_CEN Center a 3/8 of full height form between the main menu bar and the command line.

FORM_Y_LOC_QTR_CEN Center a quarter of full height form between the main menu bar and the command line.

Other Form Variables

The following variables are the widths of the colored areas outside the form.

FORM_L_BORDER The width of the dark border at the left side of the form.

FORM_R_BORDER The width of the dark border at the right side of the form.

FORM_T_BORDER The width of the dark border at the top of the form.

FORM_B_BORDER The width of the dark border at the bottom of the form.

Spacing Between Widgets

Spacing is based on the height of the font being used for widget labels. Try to use at least a HALF_SPACE between widgets. The spacing variables listed below are listed in order of size.

QTR_SPACE 1/4 of a single font height.

HALF_SPACE 1/2 of a single font height.

INTER_WIDGET_SPACE 3/4 of a font height.

FONT_HGT Font height in inches.

SINGLE_SPACE A font height in inches.

ONE_AND_HALF_SPACE 1.5 times a font height.

DOUBLE_SPACE 2.0 times a font height.

TEXT_FONT_HEIGHT Font height of Text Widget in inches.

Create spacing variables by multiplying any of the variables above by other variables or by numbers (i.e., 2 * DOUBLE_SPACE).

229Chapter 5: User Interface and List Processor FunctionsGeneral Form Style

In PCL, it is a good idea to define a real variable as follows:

Use y_loc to keep track of location on the form. For example:

General WidgetsThere are general widgets such as

REAL y_loc

y_loc = y_loc + INTER_WIDGET_SPACE

PCL and CustomizationGeneral Form Style

230

Select Frame

Select Frames Select frames are used to group select databoxes.

Buttons Buttons may be used to bring up additional forms or to select an action such as Go, Cancel, Reset, Abort, etc. Buttons that bring up forms should have an ellipsis, (...), included with the button label.

Label Labels are not selectable; they provide information.

Functions Select frames are thicker and shadowed compared to ordinary frames. They are used to visually and functionally group select databoxes.

The command to create a select frame has an option to place a toggle over the select frame. This is an Automatic Execute toggle. When the toggle is selected, Patran will automatically traverse to the “next” select databox and will optionally execute a button callback after the last select databox is satisfied.

The select frame is used to contain select databoxes. Select databoxes are databoxes that offer the ability to filter the types of entities that may be processed.

Select databoxes may have input focus cycled by setting the logical parameter recycle to TRUE. When “recycle” is set to TRUE, the first databox in the select frame regains input focus after the last databox in the select frame loses input focus. When “recycle” is set to FALSE, the default button is activated after the last databox in the select frame loses input focus.

Restrictions • There should be margins separating the select frame from the parent form.

• Only select databoxes may be contained within a select frame.

• Select databoxes inside the select frame are positioned relative to the upper left corner of the select frame.

Placement Select frames are placed with respect to the upper left hand corner of their parent form. The following variables have been provided to help place select frames.

Select Frame Widths:

SFRAME_WID_SINGLE Use for small forms and for select frames in single columns of larger forms.

SFRAME_WID_SPECIAL Use for special forms (1.5 times small) and for select frames that span 1.5 columns of larger forms.

231Chapter 5: User Interface and List Processor FunctionsGeneral Form Style

SFRAME_WID_DOUBLE Use for medium forms and for double width select frames that span 2 columns of a medium or a large form.

SFRAME _WID_TRIPLE Use for large forms for select frames that span 3 columns of a large form.

Select Frame Height

Select frames contain only select databoxes. The following variables have been provided to determine the height needed for a select frame depending upon the number of select databoxes it contains and whether the select databoxes have labels or not.

SFRAME_nSDB_HGT_LABOVE Height of a select frame that contains n labeled select databoxes.*

SFRAME_nSDB_HGT_NO_LABOVE

Height of a select frame that contains n select databoxes without labels.*

SFRAME_HGT_LABOVE_INCR Increment for computing the height of a select frame with more than 5 labeled select databoxes in it.

SFRAME_HGT_NO_LABOVE_INCR

Increment for computing the height of a select frame with more than 5 unlabeled select databoxes in it.

Select Frame X Locations

SFRAME_X_LOC_COL1 Location of a select frame that starts in the leftmost column of any size form.

SFRAME_X_LOC_COL2 Location of a select frame that starts in the second column from the left of a medium or large form.

SFRAME_X_LOC_COL3 Location of a select frame that starts in the third column from the left of a large form.

Select Frame Label

Select frames may have a toggle above the select frame.

SFRAME_LABEL_HGT Height of the Label and its associated toggle above a select frame.

Select Frame Margins

SFRAME_L_MARGIN Distance between select frame and left side of select databox.

PCL and CustomizationGeneral Form Style

232

Example 1: Create a Select Frame

ui_selectframe_create(parent_id, “go_button_callback”,@ SFRAME_X_LOC_COL1, y_loc,@SFRAME_WID_SIZE, SFRAME_nSDB_LABOVE,@“Auto Execute”, logical_recycle)

The y_loc for locating the next widget on the form is calculated by adding the height of the label of the select frame, the height of the select frame, the thickness of the select frame edge on top and bottom plus a spacing factor to the y_loc that was used to place the select frame.

y_loc = y_loc + SFRAME_LABEL_HGT + @SFRAME_nSDB_LABOVE +@SFRAME_2EDGE +@INTER_WIDGET_SPACE

If the select databoxes inside the select frame do not have labels, substitute SRAME_nSDB_NO_LABOVE in the above equation.

SFRAME_R_MARGIN Distance between select frame and right side of select databox.

SFRAME_T_MARGIN Distance between select frame and top of first select databox inside select frame.

SFRAME_B_MARGIN Distance between select frame and last select databox inside select frame.

Select Frame Thickness

SFRAME_1EDGE Thickness of a select frame edge.

SFRAME_2EDGE Thickness of two select frame edges (i.e., top and bottom or left and right).

*For select frames with additional select databoxes, add increments, n (from 1 to 5 only), select databoxes within a select frame.

233Chapter 5: User Interface and List Processor FunctionsGeneral Form Style

Labell

Example 1: Create a Label Widget

Use the following command to create a label widget without a frame.

label = ui_label_create( @ /* parent */ parent_form, @ /* callback */ EMPTY_STR, @ /* x */ UNFRAMED_MARGIN, @ /* y */ y_loc, @ /* label */ “label_text” )

/* Calculate the y location for the next widget */y_loc = y_loc + LABEL_HGT + INTER_WIDGET_SPACE

Function A Label widget is used to supply information to the user.

Restrictions • The first letter should be in upper case; rules for titles should be observed, that is, important words should be capitalized.

• Label text is left justified.

• Label widgets do not have callbacks. Use a blank ““ or EMPTY_STR for this parameter.

Placement Label widgets are placed with respect to the upper left corner of their parent form. The following variables have been provided to help place labels.

The x location for an unframed label widget is:

UNFRAMED_L_MARGIN

Use the variable:

LABEL_HGT

and a spacing variable such as INTER_WIDGET_SPACE or SINGLE_SPACE to calculate the y location for the next widget.

PCL and CustomizationGeneral Form Style

234

Button

Functions The Button widget is used to:

• Bring up another form.

• Put away a form.

• Perform an action.

Restrictions • Height of the buttons should be the letter height, i.e., when the button is created, let the height = 0.0 or ZERO to default to font height.

• The width of buttons should be the same for all buttons on a line, except for default buttons, which have a border around them.

• Buttons should be arranged from the most used to the least used, or “positive” to “negative,” or sequence of use.

• Default buttons.

When there is only one button on a form, that button should be set to be the default one. For example:

When a button is used frequently (or most likely to be used), then it should be defaulted.

If there is just “Apply” and “Cancel,” then “Apply” should be the default one. For example:

Try to have a default, usually the left-most button.

235Chapter 5: User Interface and List Processor FunctionsGeneral Form Style

The following variables have been provided to help size and place buttons:

• Combinations.

“Update” buttons should have “Reset” buttons on the same form.

Follow the sequence: “Create,” “Rename,” and “Delete” on a form that has such buttons.

• Buttons that bring up forms should have an ellipsis (...) after the label.

• Labels for buttons:

Yesindicates a positive response and closes form.

Noindicates a negative response and closes form.

Updateupdates any changes made to the form.

Resetresets any changes to the form when the form was last saved.

OKupdates and closes the form.

Cancelresets the form and closes; this should not undo the update.

Applyperforms the action specified by the label.

Keep labels for buttons to 1 word, usually a verb.

Placement • Buttons are placed with respect to their parent form.

Button Width:

BUTTON_WID_FULL This button is as wide as a single column databox. It is good for items with large labels and for buttons that bring up additional forms.

PCL and CustomizationGeneral Form Style

236

Default Buttons:Default buttons have a highlighted border around them to indicate that they are default buttons. The border to the left and right is deducted from the width of the button. The border above the default button is added above the location where the button is positioned.

BUTTON_WID_HALF Use this size for each button when two buttons are placed in a column.

BUTTON_WID_THIRD Use this size for each button when three buttons are placed in a column.

Button Height:

BUTTON_HGT Use for calculating y_loc for placement of next widget. Use 0.0 or ZERO for the button height in the PCL call so that the button height defaults to the font height of the button label.

BUTTON_DEFAULT_HGT Total height of the button including the height of the highlight border above and below.

BUTTON_DEFAULT_BORDER_WID The width of the highlight border at the left or right side of a default button.

BUTTON_DEFAULT_BORDER_HGT The height of the highlight border at the top or bottom of a default button.

Button Locations for First Column:

BUTTON_FULL_X_LOC1 Locates a full size button at left side of form.

BUTTON_HALF_X_LOC1 Locates the first half size button at left side of form.

BUTTON_HALF_X_LOC2 Locates the second half size button on the form.

BUTTON_THIRD_X_LOC1 Locates the first one third size button at left side of form.

BUTTON_THIRD_X_LOC2 Locates the second one third size button on the form.

BUTTON_THIRD_X_LOC3 Locates the third one third size button on the form.

Button Locations for Second Column:

BUTTON_FULL_X_LOC1_COL2 Locates a full size button at left side of column two on form.

BUTTON_HALF_X_LOC1_COL2 Locates a half size button at left side of column two on form.

BUTTON_HALF_X_LOC2_COL2 Locates a second half size button in column two on form.

BUTTON_THIRD_X_LOC1_COL2 Locates a one third size button at the first location of column two on form.

237Chapter 5: User Interface and List Processor FunctionsGeneral Form Style

BUTTON_THIRD_X_LOC2_COL2 Locates a second one third size button at the second location of column two on form.on form.

BUTTON_THIRD_X_LOC3_COL2 Locates a third one third size button in position 3 of column two on form.

Button Locations for Third Column:

BUTTON_FULL_X_LOC1_COL3 Locates a full size button at left side of column three on form.

BUTTON_HALF_X_LOC1_COL3 Locates a half size button at left side of column three on form.

BUTTON_HALF_X_LOC2_COL3 Locates a second half size button in column three on form.

BUTTON_THIRD_X_LOC1_COL3 Locates a one third size button at the first location of column three on form.

BUTTON_THIRD_X_LOC2_COL3 Locates a second one third size button at the second location of column three on form.on form.

BUTTON_THIRD_X_LOC3_COL3 Locates a third one third size button in position 3 of column three on form.

Button Center Location on a Small (Single Column) Form:

BUTTON_FULL_X_LOC_CEN Center a full size button on a small single column form.

BUTTON_HALF_X_LOC_CEN Center a half size button on a small single column form.

BUTTON_THIRD_X_LOC_CEN Center a one third size button on a small single column form.

Button Center Location on a Medium (Double Column) Form:

BUTTON_FULL_X_LOC_CEN_MED Center a full size button on a medium double column form.

BUTTON_HALF_X_LOC_CEN_MED Center a half size button on a medium double column form.

BUTTON_THIRD_X_LOC_CEN_MED Center a one third size button on a medium double column form.

Button Center Location on a Large (Triple Column) Form:

BUTTON_FULL_X_LOC_CEN_LRG Center a full size button on a large triple column form.

BUTTON_HALF_X_LOC_CEN_LRG Center a half size button on a large triple column form.

BUTTON_THIRD_X_LOC_CEN_LRG Center a one third size button on a large triple column form.

PCL and CustomizationGeneral Form Style

238

Example 1: Center a Button on a Form

ui_button_create( @ /* parent */ “parent”, @ /* callback */ "callback", @ /* x */ BUTTON_SIZE_X_LOC_CEN, @ /* y */ y_loc, @ /* width */ BUTTON_WID_SIZE, @ /* height */ 0.0, @ /* label */ “button_label” @ /* labelinside */ TRUE, @ /* highlight */ FALSE )

where SIZE is FULL, HALF or THIRD. Add _COL2 or _COL3 to BUTTON_SIZE_X_LOC_CEN to center a button on a medium 2 column form or on a large 3 column form.

Example 2: Create Three Buttons in a Column

Create three buttons on a small form. The button on the left is a default button. Use one third size buttons.

When a default button is used, add a default border height to the y location before placing the set of button widgets. The highlight border of the default button goes above the y location used to position the buttons. This occurs so that default buttons and plain buttons on the same line are aligned with one another.

y_loc = y_loc + BUTTON_DEFAULT_BORDER_HGT

Create the first button and make it the default button. Note that the button height parameter in the ui_button_create() call is set to 0.0 or ZERO. This is done to let the button height default to the font height.

ui_button_create( /* parent */ form-id,@/* callback */ “callback”, @ /* x */ BUTTON_THIRD_X_LOC1, @ /* y */ y_loc, @ /* width */ BUTTON_WID_THIRD, @ /* height */ 0.0,@/* label */ “button_label1”, @ /* labelinside */ TRUE,@/* highlight */ TRUE ) Create the second button. ui_button_create( /* parent */ form-id,@/* callback */ “callback”, @ /* x */ BUTTON_THIRD_X_LOC2, @ /* y */ y_loc, @ /* width */ BUTTON_WID_THIRD @ /* height */ ZERO,@/* label */ “button_label2”, @ /* labelinside */ TRUE,@/* highlight */ FALSE ) Create the third button. ui_button_create( /* parent */ form-id,@/* callback */ “callback”, @ /* x */ BUTTON_THIRD_X_LOC3, @ /* y */ y_loc, @ /* width */ BUTTON_WID_THIRD @ /* height */ ZERO,@/* label */ “button_label3”, @ /* labelinside */ TRUE,@/* highlight */ FALSE ) @

Compute the next y location considering the border at the bottom of the default button. y_loc = y_loc + BUTTON_HGT @

239Chapter 5: User Interface and List Processor FunctionsGeneral Form Style

+ BUTTON_DEFAULT_BORDER_HGT @ + INTER_WIDGET_SPACE

Add _COL2 or _COL3 to BUTTON_THIRD_X_LOCn to create buttons in the second column of a medium 2 column form or a large 3 column form or to create buttons in the third column of a large 3 column form.

Example 3: Unique Buttons

If fewer than the maximum number of buttons that will fit across a form is used, keep the standard positions as much as possible.

If dividing the form into columns, keep the odd button centered to the column to which it relates.

Box WidgetsThere are box type widgets such as:

PCL and CustomizationGeneral Form Style

240

DataBox

databox Databoxes are used for entering data. Labels may be placed above or to the left of the databox. A label to the left of a databox has an equal sign “=” included.

select databox The select databox provides an opportunity to enter either typed input data or graphical data. Select databoxes must be enclosed in a select data frame. A select databox is labeled but no equal signs or colons are allowed.

Function Databoxes are used for entering data.

Restrictions • Labels are only placed above or to the left of the databox.

• Labels above the databox cannot have equal signs or any symbols following the label. For example:

• Labels to the left must have an equal sign following the label and nothing else.

Placement Databoxes are placed with respect to the upper left hand corner of their parent form. The following variables have been provided to help place databoxes.

Databox Width:

DBOX_WID_SINGLE A single column width databox.

DBOX_WID_SPECIAL A 1 1/2 column width databox.

DBOX_WID_DOUBLE A two column width databox.

DBOX_WID_TRIPLE A three column width databox.

Databox Height:

DBOX_HGT_LABOVE The height of one databox with a label above.

DBOX_HGT_NO_LABOVE The height of one databox without a label.

241Chapter 5: User Interface and List Processor FunctionsGeneral Form Style

The width of the databox next to the label is calculated as follows:

wid =DBOX_WID_SIZE - @ DBOX_LABEL_LEN_SIZE - @ DBOX_LABEL_X_OFFSET where SIZE = SINGLE, SPECIAL, DOUBLE or TRIPLE

Example 1: Place a databox on a form

ui_databox_create( /* parent */ “parent_frame”, @ /* callback */ EMPTY_STR, @ /* x */ UNFRAMED_L_MARGIN, @ /* y */ y_loc, @ /* label_length */ ZERO, @ /* box_length */ DOUBLE_WID_SINGLE, @ /* label */ "label”, @ /* value */ initial_value, @ /* label_above */ TRUE, @ /* datatype */ "STRING", @ /* num_vals */ num_values )

Calculate the y location for the next databox on the form by adding the databox height and spacing factor together.

y_loc = y_loc + DBOX_HGT_LABOVE + INTER_WIDGET_SPACE

Databox Label Width for Databoxes that are Labeled on the Left:

Use these parameters when “label_above” is FALSE.

DBOX_LABEL_LEN_SINGLE Default label length for a single width databox when label is on left.

DBOX_LABEL_LEN_SPECIAL Default label length for a special (1 1/2 column) width databox when label is on left.

DBOX_LABEL_LEN_DOUBLE Default label length for a double width databox when label is on left.

DBOX_LABEL_LEN_TRIPLE Default label length for a triple width databox when label is on left.

DBOX_LABEL_X_OFFSET Distance between end of label and start of databox.

PCL and CustomizationGeneral Form Style

242

Select Databox

Functions The select databox provides an opportunity to enter either typed input data or graphical data.

Restrictions All select databoxes require a select data frame.

• Labels should be above the select databox. No Equal signs or colons are allowed.

If it is a coordinate frame select databox and the coordinate frame is used for geometric construction purposes only, the label should be:

Refer. Coordinate Frame

If a nodal coordinate system is defined for the purpose of analysis, it should be referred to as:

Analysis Coordinate Frame

Likewise, the material coordinate frame should be referred to as:

Material Coordinate FrameThe same principle applies for other types of coordinate frames.

Placement Select databoxes are placed with respect to the upper left hand corner of their parent select frame. The following variables have been provided to help place databoxes.

Select Databox Width:

SDBOX_WID_SINGLE A single column width select databox.

SDBOX_WID_SPECIAL A 1 1/2 column width select databox.

SDBOX_WID_DOUBLE A two column width select databox.

SDBOX_WID_TRIPLE A three column width select databox.

Select Databox Height:

SDBOX_HGT_LABOVE The height of one select databox with a label above.

SDBOX_HGT_NO_LABOVE The height of one select databox without a label.

Select Databox Placement Y Location:

SDBOX_Y_LOCn _LABOVE Place a select databox with a label above inside a select frame.*

SDBOX_Y_LOCn _NO_ABOVE Place an unlabeled select databox inside a select frame.*

243Chapter 5: User Interface and List Processor FunctionsGeneral Form Style

The width of the select databox next to the label is calculated as follows:

wid = SDBOX_WID_SIZE @ - SDBOX_LABEL_LEN_SIZE @ - SDBOX_LABEL_X_OFFSETwhere SIZE = SINGLE, SPECIAL, DOUBLE or TRIPLE

Example 1: Place Two Select Databoxes within a Select Frame

The first step is to create the select frame. The size of the select frame depends upon the number of labeled select databoxes within the select frame. The height of n databoxes inside a select frame using the standard interwidget space is:

SFRAME_nSDB_HGT_LABOVE

where n may be 1 through 5.

To put n more labeled select databoxes inside the frame, add n select frame increments to a five select databox height:

n * (SFRAME_HGT_LABOVE_INCR)

Place two labeled select databoxes inside a select frame.

sframe_height = SFRAME_2SDB_HGT_LABOVEui_selectframe_create (/* parent */ parent_form, @ /* callback */ “callback”, @

*To calculate the location of each additional select databox, add the increment, n (from 1 to 5 only), to each select databox location.

SDBOX_Y_LABOVE_INCR Increment for creating the y location for more than 5 select databoxes with labels inside a select frame.

SDBOX_Y_NO_LABOVE_INCR Increment for creating the y location for more than 5 select databoxes without labels inside a select frame.

Label Width for Select Databoxes Labeled on the Left:

Use these parameters when “label_above” is FALSE.

SDBOX_LABEL_LEN_SINGLE Default label length for a single width select databox when label is on left.

SDBOX_LABEL_LEN_SPECIAL Default label length for a special width (1 and 1/2 column) select databox when label is on left.

SDBOX_LABEL_LEN_DOUBLE Default label length for a double width select databox when label is on left.

SDBOX_LABEL_LEN_TRIPLE Default label length for a triple width select databox when label is on left.

SDBOX_LABEL_X_OFFSET Distance between end of label and start of select databox.

PCL and CustomizationGeneral Form Style

244

/* x */ FORM_L_MARGIN, @ /* y */ y_loc, @ /* width */ SFRAME_WID_SINGLE, @ /* height * sframe_height, @ /* label */ “toggle_label”, @ /* recycle */ logical_recycle ) The command to use to place the first select databox inside a select frame is:/* x */ SFRAME_L_MARGIN, @ /* y */ SDBOX_Y_LOC1_LABOVE, @/* label_length */ ZERO, @ /* box_length */ SDBOX_WID_SINGLE, @ /* label */ “label”, @/* value */ initial_value, @/* label_above */ TRUE, @ /* datatype */ “acceptable_datatype”, @/* prompt */ “prompt” ) Create the second select databox. /* x */ SFRAME_L_MARGIN, @ /* y */ SDBOX_Y_LOC2_LABOVE, @/* label_length */ ZERO, @ /* box_length */ SDBOX_WID_SINGLE, @ /* label */ “label”, @/* value */ initial_value, @/* label_above */ TRUE, @ /* datatype */ “acceptable_datatype”,/* prompt */ “prompt” )

After all the select databoxes have been placed in the select frame, to place the next new widget, calculate the y location by adding the height of the toggle of the select frame, the height of the select frame, the thickness and an interwidget spacing factor:

sframe_height + SFRAME_2EDGE + INTER_WIDGET_SPACE

Switch

The ncolumns parameter does not work intuitively for most values. The number of switch items is divided by the number of columns. One is added if a remainder was truncated. The result is used as the number of rows. The items are then added to the switch in row-major format. For example, if ncolumns is three and four switch items are supplied, the following will appear:

item1item3

Functions Switches are used for grouping items which allow only one of its items to be selected.

Restrictions • Positioned relative to the parent form.

• Switch items appear in the order in which they are created.

Placement Switches are placed with respect to the upper left hand corner of their parent form. A switch contains an arbitrary number of item widgets. Only one of the item widgets may be set to ON at any given time; setting an item ON automatically sets all other items in the switch OFF. If one item is set to FALSE, clicking on an ON item may set it to OFF depending on the value of the always_one in the ui_switch_create() call. Items in switches are organized vertically.

245Chapter 5: User Interface and List Processor FunctionsGeneral Form Style

item2item 4

The following variables have been provided to help place switches.

Switch Width:The width of a switch is determined by the number of columns and the length of the text strings that represent the items.

To calculate the height of each additional row, take the difference of a three and a four row switch and add it to the four row switch.

Switch Height:

SWITCH_1R_HGT_LABEL The height of a one row switch with a label.

SWITCH_2R_HGT_LABEL The height of a two row switch with a label.

SWITCH_3R_HGT_LABEL The height of a three row switch with a label.

SWITCH_4R_HGT_LABEL The height of a four row switch with a label.

Switch Height Unlabeled:

SWITCH_1R_HGT_NO_LABEL The height of a one row switch without a label.

SWITCH_2R_HGT_NO_LABEL The height of a two row switch without a label.

SWITCH_3R_HGT_NO_LABEL The height of a three row switch without a label.

SWITCH_4R_HGT_NO_LABEL The height of a four row switch without a label.

additional_row = SWITCH_4R_HGT_LABEL - SWITCH_3R_HGT_LABEL

PCL and CustomizationCreating Forms and Widgets Using PCL

246

Creating Forms and Widgets Using PCLAs an example of using PCL to create a form and some widgets, the PCL Class uil_list_boolean is shown. The purpose of this Class is to display the form and all the widgets which appear when the “Boolean...”pick is selected under List in the Main Menu. Actually, three forms come up, the “List A” form, the “List B” form and the “Boolean List” form. The uil_list_boolean Class controls the “List Boolean” form. The form contains an icon switch with four icons, a list box, five buttons and a separator. The form looks like this:

The Class uil_list_boolean contains nine functions which are:

1. init - Creates all the widgets displayed on the form and the form itself.

2. display - Displays the form and all its widgets.

3. bool_cb - Callback for boolean switch, calls uil_list_boolean.create.

4. create - performs boolean operation on the list.

5. save_cb - Callback from “Add to Group...” button.

6. repa_cb - Callback for “Replace A” button.

7. repb_cb - Callback for “Replace B” button.

8. hilight_cb - Callback for “Highlight” button.

9. cancel_cb - Callback for “Cancel” button.

247Chapter 5: User Interface and List Processor FunctionsCreating Forms and Widgets Using PCL

To display the form type ui_exec_function(“uil_list_boolean”,“display”) in the command line.

Style and Externalization

Add the start of the uil_list_boolean Class are three lines as follows:

#include “appforms.p”#include “appstrings.p”#include “msg_list.i”

These are references to files which are used in conjunction with the C pre-processor or cpp.

See The C Preprocessor, 31for more about use of the C preprocessor in PCL and other language source files.

The first file “appforms.p” can be found in the delivery directory along with p3. It contains define strings which look like:

#define TBOX_WID_SINGLE uil_form_sizes.tbox_wid( 1 )#define TBOX_WID_DOUBLE uil_form_sizes.tbox_wid( 2 )#define TBOX_WID_TRIPLE uil_form_sizes.tbox_wid( 3 )#define TBOX_WID_SPECIAL uil_form_sizes.tbox_wid( 4 )(Excerpt from appforms.p)

and are used to position and size widgets on the form which is described in the section General Form Style, 225. The second file, “appstrings.p”, also contains define strings but are used to externalize the displayed text for internationalization. The last file, “msg_list.i” contains the define strings for defining the unique error codes used by the message facility, i.e., msg_to_form() for displaying error messages.

uil_list_boolean.init

The init function contains all of the PCL calls to create the forms and widgets. The call to create the form itself is:

bool_form = ui_form_create( @ /* callback */ ““, @ /* x */ FORM_X_LOC_SML, @ /* y */ FORM_Y_LOC, @ /* position */ “UL”, @ /* width */ FORM_WID_SML, @ /* height */ FORM_HGT_HALF, @ /* label */ “Boolean List”, @ /* iconname */ ““)

The define strings FORM_X_LOC_SML, FORM_Y_LOC, FORM_WID_SML and FORM_HGT_HALF can all be found in “appforms.p”. The List Boolean form is a small form located in the standard position to the far right of the display directly beneath the Main Menu. The call to ui_form_create returns the widget id which was declared as classwide:

CLASSWIDE widget bool_form,boolean_switch,text_box,save_btn,sdbox,sframe

Note that there is no callback for a form and that the label on the title bar at the top of the form says “Boolean List”.

PCL and CustomizationCreating Forms and Widgets Using PCL

248

Next, we create a selectframe and selectdatabox which will be used to highlight all the resulting entities in the list after the boolean operation (‘listc‘). These widgets will never be made visible. This is necessary since the call gm_hilight_widget takes a widget id of a selectdatabox to highlight the entities contained within. To hide the widgets we make a call to ui_wid_set as and set the “DISPLAY” parameter as follows:

ui_wid_set(sdbox,“DISPLAY”,False)ui_wid_set(sframe,“DISPLAY”,False)

Now, we create the icon switch. We begin be creating the switch itself:

boolean_switch = ui_switch_create @/* parent */ (bool_form, @ /* callback */ “bool_cb”, @ /* x */ .01, @ /* y */ y_pos,@ /* cols */ 4, @ /* label */ “Operation:”, @ /* alwayson */ TRUE)

Its parent is the form and the callback is “bool_cb”. The switch has four columns, one for each of the boolean icons (only one row). The title of the switch is “Operation” and one of the items must always be selected.

Once the switch is created, we can add item icons as follows:

ui_itemicon_create @ ( boolean_switch, “and”, “and_bool.icon”, TRUE ) ui_itemicon_create @ ( boolean_switch, “or”, “or_bool.icon”, FALSE ) ui_itemicon_create @ ( boolean_switch, “a-b”, “minus_bool.icon”,FALSE ) ui_itemicon_create @ ( boolean_switch, “b-a”, “b_minus_a_bool.icon”,FALSE )

Each icon is given a name which is returned in the callback argument bool_cb(name) to indicate which switch was selected. The third argument to ui_itemicon_create is the file name which contains the bitmap for the icon. The file must exist in the PCL path, otherwise the “bart” icon will appear in its place. In our example, the “and” boolean is selected by default. To create icon files, use the UNIX or Windows NT utility bitmap.

Once all the widgets are created and placed on the form, the form is re-sized to just fit the last widget. The pcl variable, y_pos, contains the current location just beneath the last widget created (The apply button). By setting the “HEIGHT” parameter for the form with a call to ui_wid_set and passing y_pos, the form will be properly resized.

/** Set the form height*/

ui_wid_set(bool_form, “HEIGHT”, y_pos)ui_set_focus(text_box)select_focus.exit()

The display function

The display function displays both the List Boolean form and the List A and List B forms. Try to always use ui_exec_function to display forms so that the init function only gets called once. The

249Chapter 5: User Interface and List Processor FunctionsCreating Forms and Widgets Using PCL

function ui_register_help is used to provide context sensitive help to the form so that when the cursor is on the form and the F1 key is pressed, the help for the boolean form appears.

FUNCTION display

ui_exec_function( “uil_list_a”, “display” )ui_exec_function( “uil_list_b”, “display” )ui_form_display( “uil_list_boolean” )

ui_register_help(bool_form,“uil_list_boolean”)

END FUNCTION /* display */

The icon switch callback: bool_cb

If the user selects any of the boolean icons on the switch, the callback function bool_cb is called. It has two arguments (see Callbacks, 221 the first is the name of the icon item selected or unselected and the second is a string indicating if it was selected or unselected, “ON” or “OFF” respectively. bool_cb is only concerned if an icon was selected, so the test for “ON” is only checked. The function uil_list_boolean.create actually performs the boolean operation which is shown later. Note that the reason a separate routine was needed to perform the operation was because it stand alone to be valid in the session file. The “>” at the beginning of the line indicates that the PCL command appears in the session file when executed.

FUNCTION bool_cb( boolean, onoff )

GLOBAL STRING listc[VIRTUAL] STRING boolean[],onoff[]

IF (onoff == “ON”) THEN

> uil_list_boolean.create(boolean)

ui_wid_set( text_box, “VALUE”, listc )

END IF

END FUNCTION /* bool_cb */After the boolean operation is performed, the contents of the databox is updated with the global PCL variable listc. uil_list_boolean.create modifies the contents of listc based on the selected boolean operation./****************************************************************/ FUNCTION create(boolean) GLOBAL String listc[VIRTUAL],lista[VIRTUAL],listb[VIRTUAL] STRING boolean[] INTEGER status status = list_create_boolean_list(lista,listb,boolean,listc) END FUNCTION /* create *//****************************************************************/

uil_list_boolean listing

A listing of the contents of the Class follows:

/*$$ UIL List Boolean Form (uil_list_boolean) * * Purpose: * Create the List boolean form* * Side effects:

PCL and CustomizationCreating Forms and Widgets Using PCL

250

* A small form is created (List Boolean) in the third column(panel) * which contains a icon switch, a list contents textbox, an * “Add to Group...” button, a “Enumerate...” button, a “Done” button and * a “Cancel” button. * * The icon switch determines which operation applies to the * contents of two related forms, “List A’ and List B”. See * PCL Classes uil_list_a and uil_list_b for further details. * In each of the other forms is a text box with a list defined * in them. The switch determines which boolean operation is to * apply to both and applies it and places the result in the textbox * “List Contents”. * * Note: * To properly display this form call uil_list_save.load. Do * not call uil_list_save.display * */

#include “appforms.p”#include “appstrings.p”#include “msg_list.i”

CLASS uil_list_boolean

CLASSWIDE WIDGET bool_form,boolean_switch,text_box,save_btn,sdbox,sframe CLASSWIDE WIDGET hilight_btn,repa_btn,repb_btn,cancel_btn

/*$$ FUNCTION init * * Purpose: * Initialize the LIST CREATE GRID ATTRIBUTE form panel * * Input: * <none> * * Output: * <none> */

FUNCTION init

/* * Local Declarations: */

REAL x_pos, y_pos

/* * Create the “List A” form */

bool_form = ui_form_create( @ /* callback */ ““, @ /* x */ FORM_X_LOC_SML, @ /* y */ FORM_Y_LOC, @ /* position */ “UL”, @ /* width */ FORM_WID_SML, @ /* height */ FORM_HGT_HALF, @ /* label */ “Boolean List”, @ /* iconname */ ““)

/* * Create the operation option menu. */

y_pos = FORM_T_MARGIN

251Chapter 5: User Interface and List Processor FunctionsCreating Forms and Widgets Using PCL

sframe = ui_selectframe_create @ /* parent */( bool_form, @ /* callback */ ““, @ /* x */ FORM_L_MARGIN, @ /* y */ y_pos, @ /* width */ SFRAME_WID_SINGLE, @ /* height */ SFRAME_1SDB_HGT_LABOVE, @ /* label */ ““, @ /* recycle */ FALSE )

sdbox = ui_selectdatabox_create @ /* parent */ ( sframe, @ /* callback */ ““, @ /* x */ FORM_L_MARGIN, @ /* y */ y_pos, @ /* label len*/ 0.0, @ /* width */ SDBOX_WID_SINGLE, @ /* label */ ““, @ /* value */ ““, @ /*label_above*/ FALSE, @ /*datatype */ “ANY”, @ /* prompt */ ““ )

ui_wid_set(sdbox,“DISPLAY”,False) ui_wid_set(sframe,“DISPLAY”,False)

boolean_switch = ui_switch_create @ /* parent */ ( bool_form, @ /* callback */ “bool_cb”, @ /* x */ .01, @ /* y */ y_pos,@ /* cols */ 4, @ /* label */ “Operation:”, @ /* alwayson */ TRUE )

ui_itemicon_create @ ( boolean_switch, “and”, “and_bool.icon”, TRUE ) ui_itemicon_create @ ( boolean_switch, “or”, “or_bool.icon”, FALSE ) ui_itemicon_create @ ( boolean_switch, “a-b”, “minus_bool.icon”,FALSE ) ui_itemicon_create @ ( boolean_switch, “b-a”, “b_minus_a_bool.icon”,FALSE )

y_pos += 40. * PIXEL_WID + 5. * INTER_WIDGET_SPACE

/* * Create the list contents text box. */

text_box = ui_text_create( @ /* parent */ bool_form, @ /* callback */ ““, @ /* x */ UNFRAMED_L_MARGIN, @ /* y */ y_pos, @ /* width */ TBOX_WID_SINGLE, @ /* Num. Cols*/ 6, @ /* Label */ “‘listc‘ contents:”, @ /* contents */ ““, @ /* edit? */ FALSE )

y_pos += TBOX_5L_HGT_LABOVE + INTER_WIDGET_SPACE + @ TBOX_1L_HGT_NO_LABOVE

/* * Create the Add To Group... button.

PCL and CustomizationCreating Forms and Widgets Using PCL

252

*/

save_btn = ui_button_create( @ /* parent */ bool_form, @ /* callback */ “save_cb”, @ /* x */ BUTTON_HALF_X_LOC1, @ /* y */ y_pos, @ /* width */ BUTTON_WID_FULL, @ /* height */ 0., @ /* label */ “Add To Group...”, @ /* labelinside */ TRUE, @ /* highlight */ FALSE )

x_pos = 0.0 y_pos += BUTTON_HGT + INTER_WIDGET_SPACE

repa_btn = ui_button_create( @ /* parent */ bool_form, @ /* callback */ “repa_cb”, @ /* x */ BUTTON_HALF_X_LOC1, @ /* y */ y_pos, @ /* width */ BUTTON_WID_HALF, @ /* height */ 0., @/* label */ “Replace A”, @/* labelinside */ TRUE, @/* highlight */ FALSE )

/* * Create the Cancel button. */

repb_btn = ui_button_create( @ /* parent */ bool_form, @ /* callback */ “repb_cb”, @ /* x */ BUTTON_HALF_X_LOC2, @ /* y */ y_pos, @ /* width */ BUTTON_WID_HALF, @ /* height */ 0., @ /* label */ “Replace B”, @ /* labelinside */ TRUE, @ /* highlight */ FALSE )

y_pos += BUTTON_HGT + INTER_WIDGET_SPACE

/* * Add a separator */

ui_separator_create( @ /* parent */ bool_form, @ /* callback */ ““, @ /* x */ x_pos, @ /* y */ y_pos, @ /* length */ FORM_WID_SML, @ /* horizontal */ TRUE )

y_pos += LINE_THICKNESS + INTER_WIDGET_SPACE

/* * Create the Hilight button. */

hilight_btn = ui_button_create( @ /* parent */ bool_form, @ /* callback */ “hilight_cb”, @

253Chapter 5: User Interface and List Processor FunctionsCreating Forms and Widgets Using PCL

/* x */ BUTTON_HALF_X_LOC1, @ /* y */ y_pos, @ /* width */ BUTTON_WID_HALF, @ /* height */ 0., @ /* label */ “Highlight”, @ /* labelinside */ TRUE, @ /* highlight */ FALSE )

/* * Create the Cancel button. */

cancel_btn = ui_button_create( @ /* parent */ bool_form, @ /* callback */ “cancel_cb”, @ /* x */ BUTTON_HALF_X_LOC2, @ /* y */ y_pos, @ /* width */ BUTTON_WID_HALF, @ /* height */ 0., @ /* label */ “Cancel”, @ /* labelinside */ TRUE, @ /* highlight */ FALSE )

y_pos += BUTTON_HGT + FORM_B_MARGIN

/* * Set the form height */

ui_wid_set( bool_form, “HEIGHT”, y_pos) ui_set_focus(text_box) select_focus.exit()

END FUNCTION /* init */

/*$$ FUNCTION display * * Purpose: * Display the List Boolean form * * Input: * <None> * * Output: * <None> * * Log: * * Notes: * * */ FUNCTION display

ui_exec_function( “uil_list_a”, “display” ) ui_exec_function( “uil_list_b”, “display” ) ui_form_display( “uil_list_boolean” )

ui_register_help(bool_form,“uil_list_boolean”)

END FUNCTION /* display */

/*$$ callback FUNCTION bool_cb * * Purpose: * Combines the lists contained in list A and List B by the * specified boolean operation. *

PCL and CustomizationCreating Forms and Widgets Using PCL

254

* Input: * boolean string[] Item selected from icon switch * onoff string[] not used. * * Output: * <None> * * */ FUNCTION bool_cb( boolean, onoff )

GLOBAL STRING listc[VIRTUAL] STRING boolean[],onoff[]

IF (onoff == “ON”) THEN

> uil_list_boolean.create(boolean)

ui_wid_set( text_box, “VALUE”, listc )

END IF

END FUNCTION /* bool_cb */

/****************************************************************/ FUNCTION create(boolean) GLOBAL String listc[VIRTUAL],lista[VIRTUAL],listb[VIRTUAL] STRING boolean[] INTEGER status status = list_create_boolean_list(lista,listb,boolean,listc) END FUNCTION /* create *//****************************************************************//*$$ FUNCTION save_cb * * Purpose: * Displays the form to save the contents of the list. * * Input: * <None> * * Output: * <None> * * */ FUNCTION save_cb

/* * Get the list and display the save list form */

uil_list_save.load( “listc” )

END FUNCTION /* save_cb *//****************************************************************/ FUNCTION repa_cb

/* * Replace contents of lista with listc */

> uil_list_a.replace()uil_list_a.load()

255Chapter 5: User Interface and List Processor FunctionsCreating Forms and Widgets Using PCL

END FUNCTION /* repa_cb *//****************************************************************/ FUNCTION repb_cb

/* * Replace contents of listb with listc */

> uil_list_b.replace() uil_list_b.load()

END FUNCTION /* repb_cb *//****************************************************************/ FUNCTION hilight_cb

GLOBAL String listc[VIRTUAL]

gm_hilight_widget(sdbox,0)ui_wid_set(sdbox,“VALUE”,listc)gm_hilight_widget(sdbox,-1)

END FUNCTION/****************************************************************//*$$ FUNCTION cancel_cb * * Purpose: * Displays the modal form to evaluate the contents of the list * and display it. * * Input: * <None> * * Output: * <None> * * */ FUNCTION cancel_cb

/* * reset the widget parameters and exit the form */ ui_wid_restore( “uil_list_boolean” ) ui_form_hide( “uil_list_boolean” )

END FUNCTION /* cancel_cb */

END CLASS

PCL and Customizationwidget Function Descriptions

256

widget Function DescriptionsWidgets provide the user an opportunity to interact with Patran. User interaction with a widget is called an event. Widget callback functions in PCL will be called for a variety of widget events. The data passed to PCL for each widget type is described here. See User Interface Functions, 297 for a discussion of the events that lead to the widget callbacks. The arguments passed to the PCL callback function must be declared with the below datatype to avoid a runtime error.

Table 5-1

Widget Type Data Type Description of Callback Data

button No arguments are passed.

buttonicon No arguments are passed.

cascade item Does not register events.

databox string[ ] “GAIN”, “LOSE”, “CR”, or “WIDSET” (if appropriate ui_wid_set ( ) call has been made) depending on which event instigated the callback.

file string[ ]

string[ ]

Complete pathname of file.

“OPEN” or “CANCEL”

form Does not register events.

frame Does not register events.

graph Does not register events.

item Does not register events.

itemicon Does not register events.

label Does not register events.

labelicon Does not register events.

listbox integer

string[ ]()

The number of selected items.

Label of the selected items in the listbox.

menu string[ ] Name of the selected menu item.

modalform Does not register events.

option menu string[ ] Name of the currently selected item.

popup menu string[] Name of the selected item.

scroll frame Does not register events.

select databox string[ ] “GAIN”, “LOSE”, “CR”, “VALUE_CHANGED”or “WIDSET” ( if a call to ui_wid_set 'VALUE' has been made), depending on which event initiated the callback.

select frame No arguments are passed.

257Chapter 5: User Interface and List Processor Functionswidget Function Descriptions

separator Does not register events.

slide bar real

string[ ]

Current value of the slide bar.

“VALUE_CHANGED” or “DRAG”

spread sheet string[ ]

integer

integer

integer

integer

integer

“SELECTED”. To be expanded.

Starting selected column.

Starting selected row.

Ending selected column.

Ending selected row.

Selected layer.

switch string[ ]

string[ ]

Name of the switch item changed.

“ON” or “OFF”, depending on whether the named switch item, argument #1, has just been turned on or off.

text Does not register events.

toggle logical Value of toggle, TRUE or FALSE.

toggleicon logical Value of toggleicon, TRUE or FALSE.

color bar widget

integer

integer

Widget ID of the color bar.

User data specified in the widget creation call.

Selected item.

color menu widget

integer

integer

Widget ID of the color bar.

User data specified in the widget creation call.

New color value.

Table 5-1

Widget Type Data Type Description of Callback Data

PCL and CustomizationList Processor

258

List ProcessorA set of PCL utilities are provided which parse Picklists. Picklists are the character strings which appear in selectdataboxes as a result of cursor selection or the user typing in data. Examples of these strings are:

point 1:8solid 3.2element 1:7:2

The system which supports the Picklist parsing is called the list processor. The list processor evaluates the strings listed above for information that the application can use. The PCL functions described in this section call the list processor. An include file is provided called lpenums.i (referenced by lpenums.p) on the delivery media which is helpful when writing PCL routines which call the list Processor. See The C Preprocessor, 31.

The PCL functions for parsing Picklists are grouped into two categories. The low-level, more flexible PCL functions which begin with the letters lp_ and the remaining routines which are a more “user friendly” interface to the same lp_ routines. Most list processor routines call the database to obtain information about the Picklist. Routines starting with fem_u_ are different in that they just evaluate for ids which don’t require querying the database. The result is improved performance. Note that not all the types of Picklist entities are supported by the higher level routines.

When the list processor evaluates a string such as the ones above, it returns to the user a handle, which points to the beginning of a list of items. Each item (or sublist) has a type, and attributes associated with that type. Some attributes such as label and id will be associated with most sublist types, and others such as the LP_ATTRIBUTE_COORDINATE_FRAME_TYPE attribute will only be associated with one particular item type (in this case a coordinate frame).

The list processor is also capable of evaluating strings such as “1:101:5.” In this case the list processor returns a handle which points at a list of tokens. In this case a token is merely a generic term for the integers (items) that the list contains.

259Chapter 5: User Interface and List Processor FunctionsList Processor

File lpenums.iThe include file lpenums.i contains #define strings used by the list processor functions. The first section of lpenums.i contains encoded integer numbers used by lp_eval() to determine evaluation methods. The second section of lpenums.i contains sublist type filters used by the functions lp_sublist_type() and lp_sublist_count(). The third section of lpenums.i is used by lp_sublist_attribute_get_*() to parse for attributes contained within the sublist.

Evaluation Methods

There are currently eleven different evaluation methods. The different evaluation methods generate different types of lists. The LP_EVAL_PARSE_AND_EXPAND method prepares a list which can be parsed for the number, type and label of all entities in the list. Other evaluation methods can return more specific information such as the location of points or nodes.

/* Evaluation methods for LpEval */ #define LP_EVAL_BARE_PARSE 1 (internal use only) #define LP_EVAL_PARSE_AND_EXPAND 2 (label only) #define LP_EVAL_FOR_TOKENS 3 (tokens only) #define LP_EVAL_FOR_ID 4 (label and id) #define LP_EVAL_FOR_LABEL 5 (label only) #define LP_EVAL_FOR_GEOMETRY 6 (geometric information) #define LP_EVAL_FOR_FEM_DEFINITION 7 (topology, node count, etc...) #define LP_EVAL_FOR_PICKLIST_ENUMERATION 8 (entity type ex.point, curve, node) #define LP_EVAL_FOR_PICKLIST_NORMALIZATION 9 (internal use only) #define LP_EVAL_FOR_PICKLIST_ADD 10 (internal use only) #define LP_EVAL_FOR_PICKLIST_DELETE 11 (internal use only) (Excerpt from lpenums.i)

Sublist Types and Filters

Depending on the Picklist, lp_eval() will prepare different types (sublists) of items. Each type will have different attributes. The SublistType filters are used by the PCL function lp_sublist_type() to verify the type of sublist referenced by the handle. Depending on how the picklist was parsed, each type of sublist will have different attributes associated with it. The filters are also used by lp_sublist_count() to count the number of entities of the specified type in the Picklist.

If a picklist has multiple points, lines and nodes, and the current application only needs to count the number of points and lines, use a geometry filter. Using only LP_SUBLIST_CURVE will count the number of lines whereas using LP_SUBLIST_GEOMETRY will count the number of lines and points and LP_SUBLIST_ANY will count the number of entities in the entire Picklist (points, lines and nodes).

/* SublistType filters for LpSublistType */ #define LP_SUBLIST_POINT_IMMEDIATE 1 #define LP_SUBLIST_VECTOR_IMMEDIATE 2 #define LP_SUBLIST_POINT 4 #define LP_SUBLIST_CURVE 8 #define LP_SUBLIST_SURFACE 16 #define LP_SUBLIST_SOLID 32 #define LP_SUBLIST_GEOMETRY (LP_SUBLIST_POINT_IMMEDIATE + \ LP_SUBLIST_VECTOR_IMMEDIATE + \ LP_SUBLIST_POINT + \

Note: Some evaluation methods are for internal use only.

PCL and CustomizationList Processor

260

LP_SUBLIST_CURVE + \ LP_SUBLIST_SURFACE + \ LP_SUBLIST_SOLID) #define LP_SUBLIST_COORD_FRAME 64 #define LP_SUBLIST_VECTOR 128 #define LP_SUBLIST_AXIS 256 #define LP_SUBLIST_NODE 512 #define LP_SUBLIST_ELEMENT 1024 #define LP_SUBLIST_MPC 2048 #define LP_SUBLIST_FINITE_ELEMENT (LP_SUBLIST_NODE + \ LP_SUBLIST_ELEMENT + \ LP_SUBLIST_MPC) #define LP_SUBLIST_TOKEN_NULL 4096 #define LP_SUBLIST_TOKEN_INT 8192 #define LP_SUBLIST_TOKEN_FLOAT 16384 #define LP_SUBLIST_TOKEN_STRING 32768 #define LP_SUBLIST_TOKEN_FIELD 65536 #define LP_SUBLIST_TOKEN_MATERIAL 131072 #define LP_SUBLIST_TOKEN (LP_SUBLIST_TOKEN_NULL + \ LP_SUBLIST_TOKEN_INT + \ LP_SUBLIST_TOKEN_FLOAT + \ LP_SUBLIST_TOKEN_STRING + \ LP_SUBLIST_TOKEN_FIELD + \ LP_SUBLIST_TOKEN_MATERIAL) #define LP_SUBLIST_ANY

Sublist Attributes

Different Sublists have different attributes. Some sublists have no attributes while others can have many (more than 10). The number and type of attributes associated with each sublist depends on the method used for lp_eval() and the type of the sublist.

#define LP_ATTRIBUTE_ID1 (internal id of entity)#define LP_ATTRIBUTE_LABEL2 (External visible label)#define LP_ATTRIBUTE_GEOMETRY3 (Coefficients)#define LP_ATTRIBUTE_GEOMETRY_TYPE4 (type code)#define LP_ATTRIBUTE_GEOMETRY_FORMAT5 (Format)#define LP_ATTRIBUTE_GEOMETRY_COMPANY_OF_ORIGIN6 (Company of origin)#define LP_ATTRIBUTE_ORIGIN7 (origin of coord frame)#define LP_ATTRIBUTE_ROTATION_MATRIX8 (rotation matrix)#define LP_ATTRIBUTE_COORDINATE_FRAME_TYPE9 (type code)#define LP_ATTRIBUTE_LOCATION10(nodal location)#define LP_ATTRIBUTE_DISPLACEMENT11(displacement)#define LP_ATTRIBUTE_BASE12(base of axis)#define LP_ATTRIBUTE_TIP13(tip of axis)?#define LP_ATTRIBUTE_CLASS_NAME14#define LP_ATTRIBUTE_TOPOLOGY_ID15(topology code)#define LP_ATTRIBUTE_DIMENSIONALITY16(dimensionality)#define LP_ATTRIBUTE_FACE_NUMBER17(face number)#define LP_ATTRIBUTE_EDGE_NUMBER18(edge number)#define LP_ATTRIBUTE_VERTEX_NUMBER19(vertex number)#define LP_ATTRIBUTE_NODE_COUNT20(number of nodes)#define LP_ATTRIBUTE_NODE_LIST21(list of node data)#define LP_ATTRIBUTE_ORIGINAL_PARSE_CLASS22(internal use only)#define LP_ATTRIBUTE_ORIGINAL_PARSE_SUBCLASS23(internal use only)#define LP_ATTRIBUTE_ORIGINAL_PARSE_SUBCLASS_ID24(internal use only)#define LP_ATTRIBUTE_ORIGINAL_PARSE_SUBCLASS_TOPOLOGICAL_CONTEXT 25(internluseonly)#define LP_ATTRIBUTE_GEOMETRY_IN_NATIVE_FORM26(geometry data)#define LP_ATTRIBUTE_TOKEN_VALUE27(value of a token)#define LP_ATTRIBUTE_EVALUATED_POINT28#define LP_ATTRIBUTE_POINT_COUNT29#define LP_ATTRIBUTE_CURVE_COUNT30#define LP_ATTRIBUTE_SURFACE_COUNT31#define LP_ATTRIBUTE_SOLID_COUNT32

261Chapter 5: User Interface and List Processor FunctionsList Processor

#define LP_ATTRIBUTE_POINT_LIST33#define LP_ATTRIBUTE_CURVE_LIST34#define LP_ATTRIBUTE_SURFACE_LIST35#define LP_ATTRIBUTE_SOLID_LIST36#define LP_ATTRIBUTE_SIDE_NUMBER37

Example:

#include “lpenums.p”EXAMPLE INTEGER list_type = 0 INTEGER handle, status, coord_label STRING list[VIRTUAL] WIDGET sdbox . . . ui_wid_get_vstring(sdbox, “VALUE”, list) status = lp_eval(list, LP_EVAL_FOR_LABEL, handle) IF (status != 0) THEN RETURN status END IF WHILE(list_type != LP_SUBLIST_COORD_FRAME ) status = lp_sublist_type(handle, LP_SUBLIST_ANY, list_type) IF (status != 0) THEN RETURN status END IF /* now the list_type is LP_SUBLIST_COORD_FRAME */ END WHILE status = lp_sublist_attribute_get_int (handle, LP_ATTRIBUTE_LABEL, @ coord_label) IF (status != 0) THEN lp_eval_cleanup(handle) RETURN status END IF

PCL and CustomizationList Processor

262

List Processor Functions

Example:

#include “lpenums.p” . . . status = lp_eval (coord, LP_EVAL_FOR_GEOMETRY, handle1) IF (status = 0) THEN RETURN status END IF status = lp_sublist_attribute_get_int (handle1, LP_ATTRIBUTE_LABEL, @ coord_label) IF (status = 0) THEN lp_eval_cleanup(handle1) RETURN status END IF

lp_eval (list, method, handle )

Description:

Establish a new list processing anchor and handle.

Input:

STRING list Picklist from ui_wid_get_vstring on a select databox.

INTEGER method Code which indicates the evaluation method to use on the picklist. See lpenums.i

Output:

INTEGER handle Used by other lp utilities to parse the Picklist.

INTEGER <Return Value> Message facility code. See Message System Functions, 155. 0 indicates no error

Error Conditions:

None.

263Chapter 5: User Interface and List Processor FunctionsList Processor

List Processor Functions

Remarks:

Memory is allocated for the virtual string pvc_entity_ids. Typically the deallocation would occur in the PCL program in which the virtual string was defined: string out[VIRTUAL]. Otherwise one must account for deallocation to avoid memory leaks.

lp_sub_str_by_keyword (c_lp_str, c_keyword, case_sensitive, pvc_entity_ids )

Description:

Recover entity ids as they appear in the list processor string.

Input:

STRING[] c_lp_str Input string made with list processor

STRING[] c_keyword This value specifies the keyword for extracting entity ids. Ex: "Point", "Curve", "Surface", "Solid", "Node", "Element", "MPC" keyword_with_no_trailing_blank+" " will be used for the query.

INTEGER case_sensitive 0 if FALSE

1 (or not 0) if TRUE

Output:

STRING[] pvc_entity_ids Pointer to address of virtural string containing all the entities ids as they appear in the list processor string. It will at least be allocated a minimum size of 1 char and set to ““ if a no error condition occured.

INTEGER <Return Value> This function returns a value of 0 when executed successfully.

Error Conditions:

None.

PCL and CustomizationList Processor

264

List Processor Functions

Example:

#include “lpenums.i”INTEGER handle1,ent_type, countINTEGER status.../* Now check to make sure that sublist type is a solid */status = lp_sublist_type(handle1,LP_SUBLIST_ANY, ent_type)IF ( ( status != 0 ) ||( ent_type != LP_SUBLIST_SOLID ) )THENRETURN statusEND IF...

lp_sublist_type (handle, filter, type )

Description:

Indicates which type of sublist is referenced by the handle.

Input:

INTEGER handle Returned by call to lp_eval().

INTEGER filter Filter from lpenums.i, it is most common to use LP_SUBLIST_ANY, or one of the more generic filters as this parameter.

Output:

INTEGER type Actual sublist type. See lpenums.i, sublist types.

INTEGER <Return Value> Message facility code. See Message System Functions, 155. 0 indicates no error.

Error Conditions:

None.

265Chapter 5: User Interface and List Processor FunctionsList Processor

List Processor Functions

Example:

#include “lpenums.p” . . . status = lp_eval(list_str, LP_EVAL_FOR_LABEL, handle) IF (status != 0) THEN RETURN status END IF status = lp_sublist_count(handle, LP_SUBLIST_POINT, num_items) IF (status != 0) THEN RETURN status END IF sys_allocate_array(point_labels, 1, num_items) i = 0 REPEAT loop status = lp_sublist_type(handle, LP_SUBLIST_ANY, list_type) IF ( status != 0 ) THEN RETURN status ENDIF IF ( list_type == LP_SUBLIST_POINT) THEN status = lp_sublist_attribute_get_int(handle,LP_ATTRIBUTE_LABEL, @ label) IF (status == 0 ) THEN i += 1 point_labels(i) = label END IF IF ( i == num_items ) THEN break loop ENDIF lp_sublist_next(handle) UNTIL ( i > num_items ) lp_eval_cleanup(handle)

lp_sublist_count (handle, filter, count )

Description:

Count the number of items in a sublist.

Input:

INTEGER handle Returned by call to lp_eval().

INTEGER filter Filter from lpenums.i.

Output:

INTEGER count Number of items in sublist.

INTEGER <Return Value> Message facility code. See Message System Functions, 155. 0 indicates no error.

Error Conditions:

None.

PCL and CustomizationList Processor

266

List Processor Functions

Example:

FUNCTION list_get_id(handle1,ent_type,ent_list,count,ent_id)/* Get the ids from a list of entities in a picklist */

#include “lpenums.i”

INTEGER handle1,ent_type,ent_id(),count STRING ent_list[]

INTEGER actual,icount,next_id(1),status LOGICAL end_of_list=False

icount = 1 WHILE (!end_of_list)

status = lp_sublist_type(handle1, ent_type, actual) IF(status == 0) THEN status = lp_sublist_attribute_get_int(handle1, LP_ATTRIBUTE_ID,@ next_id) IF (status == 0) THEN ent_id(icount) = next_id icount += 1 END IF END IF status = lp_sublist_next(handle1) IF (status != 0) THEN end_of_list = True IF (icount > count) THEN BREAK

END WHILE RETURN 0END FUNCTION

lp_sublist_next (handle )

Description:

Set the list position to the next sublist.

Input:

INTEGER handle Returned by call to lp_eval().

Output:

INTEGER <Return Value> Message facility code. See Message System Functions, 155. 0 indicates no error.

Error Conditions:

None.

267Chapter 5: User Interface and List Processor FunctionsList Processor

List Processor Functions

Example:

#include “lpenums.p”...status = lp_eval(coord, LP_EVAL_FOR_GEOMETRY, handle1) IF (status != 0) THENRETURN status END IF status = lp_sublist_attribute_get_int @(handle1, LP_ATTRIBUTE_LABEL, @coord_label) IF (status != 0) THENlp_eval_cleanup(handle1) RETURN status END IF

lp_eval_cleanup (handle )

Description:

Free allocated memory for list processor operations.

Input:

INTEGER handle Returned by call to lp_eval().

Output:

INTEGER <Return Value> Message facility code. See Message System Functions, 155. 0 indicates no error.

Error Conditions:

None.

Note: Must be called after all calls to parse a particular picklist.

PCL and CustomizationList Processor

268

List Processor Functions

Example:

#include “lpenums.p”...status = lp_eval(list_str, LP_EVAL_FOR_TOKENS, handle) IF (status != 0) THEN

lp_sublist_attribute_get_int (handle, attribute, item )

Description:

Return an array of integer values from a Picklist with a specified attribute which has been previously evaluated by a call to lp_eval.

Input:

INTEGER handle Returned by call to lp_eval().

INTEGER attribute Attribute requested from sublist. See lpenums.i.

Output:

INTEGER ARRAY item Item parsed from Picklist of the specified attribute.

INTEGER <Return Value> Message facility code. See Message System Functions, 155. 0 indicates no error.

Error Conditions:

None.

lp_sublist_attribute_get_float (handle, attribute, item )

Description:

Return a real value of integer values from a Picklist with a specified attribute which has been previously evaluated by a call to lp_eval.

Input:

INTEGER handle Returned by call to lp_eval().

INTEGER attribute Attribute requested from sublist. See lpenums.i.

Output:

REAL item Item parsed from Picklist of the specified attribute.

INTEGER <Return Value> Message facility code. See Message System Functions, 155. 0 indicates no error.

Error Conditions:

None.

269Chapter 5: User Interface and List Processor FunctionsList Processor

RETURN status END IF

status = lp_sublist_count(handle, LP_SUBLIST_TOKEN, ntokens) IF (status != 0) THEN RETURN status END IF

END IF IF (status!=0 || ntokens<=0) THEN lp_eval_cleanup(handle)RETURN status END IF status = SYS_ALLOCATE_ARRAY(rlist_vals, 1, ntokens)IF (status==0) THEN FOR (itoken = 1 TO ntokens) IF (itoken>1) THEN status = lp_sublist_next(handle) IF (status!=0) THEN BREAK status = lp_sublist_attribute_get_float(handle, @ LP_ATTRIBUTE_TOKEN_VALUE, rlist_vals(itoken)) IF (status!=0) THEN BREAKEND FOR END IF

List Processor Functions

Example:

#include “lpenums.p”..

lp_sublist_attribute_get_string (handle, attribute, maxsize, item, size )

Description:

Return a string from a Picklist with a specified attribute which has been previously evaluated by a call to lp_eval.

Input:

INTEGER handle Returned by call to lp_eval().

INTEGER attribute Attribute requested from sublist. See lpenums.i.

INTEGER maxsize Size of output variable in bytes (use the following):

/* PCL interface help */

#define BYTES_PER_CHARACTER 1

Output:

STRING item Item parsed from Picklist of the specified attribute.

INTEGER size Actual return string size of item in bytes.

INTEGER <Return Value> Message facility code. See Message System Functions, 155. 0 indicates no error.

Error Conditions:

None.

PCL and CustomizationList Processor

270

.status = lp_eval(show_entities, LP_EVAL_FOR_GEOMETRY, handle1) WHILE (status == 0) /* * Check Data, If good data, show it on spreadsheet widget * (Dummy FOR structure allows breakout for errors) */ FOR(i = 1 TO 1) /* * Get id and label */ data_ck = lp_sublist_attribute_get_int @ (handle1, LP_ATTRIBUTE_ID, entity_id) IF(data_ck != 0) THEN BREAK

/* * Get geometry type */ data_ck = lp_sublist_attribute_get_string @ (handle1, @ LP_ATTRIBUTE_GEOMETRY_TYPE, @ BYTES_PER_CHARACTER * 64, @ type, size) IF (data_ck != 0) THEN BREAK

END FOR /* * If error found while checking data, print error message */ IF (status != 0) THEN RETURN data_ck END IF/* * Point to the next ID */ status = lp_sublist_next(handle1) END WHILE

271Chapter 5: User Interface and List Processor FunctionsList Processor

List Processor Functions

Example:

#include “lpenums.p”.../* get node count*/ IF (lp_sublist_attribute_get_int@ (handle1,LP_ATTRIBUTE_NODE_COUNT,node_count) != 0) THEN ui_writec(“Error in lp_sublist 2...”) RETURN -3 END IF

/* get nodes */ sys_allocate_array(nodes,1,20) IF (lp_sublist_attribute_get_inta@ (handle1,LP_ATTRIBUTE_NODE_LIST,node_count(1)*4,nodes,size) != 0) THEN ui_writec(“Error in lp_sublist 3...”) RETURN -3 ELSE FOR (count = 0 TO 19) node_ids(start+count)=nodes(count+1) END FOR start+=20 END IF sys_free_array(nodes)

lp_sublist_attribute_get_inta (handle, attribute, maxsize, item, size )

Description:

Return an array of integers from a Picklist with a specified attribute which has been previously evaluated by a call to lp_eval.

Input:

INTEGER handle Returned by call to lp_eval().

INTEGER attribute Attribute requested from sublist. See lpenums.i.

INTEGER maxsize Size of output variable in bytes (use the following):

/* PCL interface help */

#define BYTES_PER_INTEGER 4

Output:

INTEGER ARRAY item() Item parsed from Picklist of the specified attribute.

INTEGER size Actual array size returned in item in bytes.

INTEGER <Return Value> Message facility code. See Message System Functions, 155. 0 indicates no error.

Error Conditions:

None.

PCL and CustomizationList Processor

272

List Processor Functions

Example:

#include “lpenums.p”...

status = lp_eval(coord, LP_EVAL_FOR_GEOMETRY, handle1) IF (status != 0) THEN RETURN status END IF status = lp_sublist_attribute_get_floata @ (handle1, LP_ATTRIBUTE_ROTATION_MATRIX, @ BYTES_PER_REAL * 9, @ rmatrix, size) IF (status != 0) THEN lp_eval_cleanup(handle1) RETURN status END IFEND IF

lp_sublist_attribute_get_floata (handle, attribute, maxsize, item_array, size )

Description:

Return a real array from a Picklist with a specified attribute which has been previously evaluated by a call to lp_eval.

Input:

INTEGER handle Returned by call to lp_eval().

INTEGER attribute Attribute requested from sublist. See lpenums.i.

INTEGER maxsize Size of output variable in bytes (use the following):

/* PCL interface help */

#define BYTES_PER_REAL 4

Output:

REAL ARRAY item_array() Item parsed from Picklist of the specified attribute.

INTEGER size The size of the item_array in bytes.

INTEGER <Return Value> Message facility code. See Message System Functions, 155. 0 indicates no error.

Error Conditions:

None.

273Chapter 5: User Interface and List Processor FunctionsList Processor

List Processor Functions

Example:

#include “lpenums.p”...

status = lp_eval(coord, LP_EVAL_FOR_GEOMETRY, handle1)lp_print_list(handle1) IF (status != 0) THEN RETURN status END IF status = lp_sublist_attribute_get_int @ (handle1, LP_ATTRIBUTE_LABEL, @ coord_label) IF (status != 0) THEN lp_eval_cleanup(handle1) RETURN status END IF

lp_print_list (handle )

Description:

Print the entire Picklist from the anchor block to standard out (The invoking xterm).

Input:

INTEGER handle Returned by call to lp_eval().

Output:

INTEGER <Return Value> Message facility code. See Message System Functions, 155. 0 indicates no error.

Error Conditions:

None.

PCL and CustomizationList Processor

274

List Processor Functions

Example:

#include “lpenums.p”... status = lp_eval(ent_list,LP_EVAL_FOR_ID,handle1) IF (status != 0) THEN RETURN status IF (!em_proceed_quick()) THEN RETURN 0 db_count_curve(nbrae) IF(nbrae == 0) THENlp_eval_cleanup(handle1) RETURN 48000006 END IF SYS_ALLOCATE_ARRAY(eids,1,nbrae) FOR (iall = 1 to 4) ialloop

lp_print_sublist (handle )

Description:

Print the sublist prepared by lp_sublist_type from the anchor block to standard out (The invoking xterm).

Input:

INTEGER handle Returned by call to lp_eval().

Output:

INTEGER <Return Value> Message facility code. See Message System Functions, 155. 0 indicates no error.

Error Conditions:

None.

lp_sublist_reset (handle )

Description:

Reset the sublist parser to resume parsing the original Picklist.

Input:

INTEGER handle Returned by call to lp_eval().

Output:

INTEGER <Return Value> Message facility code. See Message System Functions, 155. 0 indicates no error.

Error Conditions:

None.

275Chapter 5: User Interface and List Processor FunctionsList Processor

Switch (iall) CASE (1) ent_type = LP_SUBLIST_POINT CASE (2) ent_type = LP_SUBLIST_CURVE CASE (3) ent_type = LP_SUBLIST_SURFACE CASE (4) ent_type = LP_SUBLIST_SOLID DEFAULT RETURN END SWITCH

status = lp_sublist_reset(handle1) status = lp_sublist_count(handle1,ent_type,lid) IF (status != 0) THEN lp_eval_cleanup(handle1) RETURN status END IFFOR (i = 1 To lid) Doloop...END FOREND FOR

PCL and CustomizationList Processor

276

List Processor Functions

List Processor Functions

lp_sublist_fetch (handle, maxsize, item, size )

Description:

Return the contents of a sublist.

Input:

INTEGER handle Returned by call to lp_eval().

INTEGER maxsize Size in bytes of “item”.

Output:

STRING item Contents of sublist.

INTEGER size Actual size returned.

INTEGER <Return Value> Message facility code. See Message System Functions, 155. 0 indicates no error.

Error Conditions:

None.

lp_keyword_text (keyword, family, text )

Description:

The purpose of this function is to return the keywords found in Patran that are used to describe objects, actions, etc.

NOTE: This function receives parameters in a nonintuitive fashion. The family is the first method of grouping, and the keyword is next. 1,3 yields point, and 2,3 yields grid. This should show that they keywords are organized by family, the second parameter. Below is shown all the families, and then a listing of the LpGEOMETRY family.

Input:

277Chapter 5: User Interface and List Processor FunctionsList Processor

INTEGER keyword Identifies the entity. From lpkeywords.i:

(SAMPLE for family LpGEOMETRY)

#define LpPOINT 1

#define LpGRID 2

#define LpCURVE 3

#define LpLINE 4

#define LpSURFACE 5

#define LpPATCH 6

#define LpSOLID 7

#define LpHYPERPATCH 8

#define LpPOINT_IMMEDIATE 9

#define LpSCREEN_PICK 10

#define LpCOORDINATE_FRAME 11

#define LpVECTOR 12

#define LpAXIS 13

#define LpVECTOR_IMMEDIATE 14

#define LpAXIS_IMMEDIATE 15

#define LpSIDE_NUMBER 16

PCL and CustomizationList Processor

278

Example:

#include “lpenums.p”.../*$$ FUNCTION refresh * * Purpose: * Update the Reference Coordinate Frame if the preference has been * changed. *

INTEGER family Identifies the group of entities keyword falls. From lpkeywords.i:

/* listing of possible families */

#define LpACTION 1

#define LpTECHNIQUE 2

#define LpGEOMETRY 3

#define LpFINITE_ELEMENT 4

#define LpDESIGNATOR 5

#define LpATTRIBUTE 6

#define LpGEOMETRY_TYPES 7

#define LpGEOMETRY_FORMATS 8

#define LpGEOMETRY_COOS 9

#define LpOPERATION 10

#define LpTOKEN_TYPES 11

#define LpELEMENT_TYPES 12

#define LpNUMERIC_STANDIN 13

Output:

STRING[32] item String alias for keyword.

INTEGER <Return Value> Message facility code. See Message System Functions, 155. 0 indicates no error.

Error Conditions:

None.

279Chapter 5: User Interface and List Processor FunctionsList Processor

*/ FUNCTION refresh STRING default_cid[NAME_LENGTH] STRING coord_frame_id[NAME_LENGTH]

INTEGER status

/* * Get the Preference Default Coordinate Frame */ default_cid = uil_group_transform.pref_cid()

/* * Get the List Processor’s nomenclature for Coordinate Frame */ status = lp_keyword_text(LpCOORDINATE_FRAME, LpGEOMETRY, coord_frame_id)IF (status != 0) THEN RETURN status

/* * Add the Id ... */ coord_frame_id = coord_frame_id// “ “ // default_cid

/* * ... and set the selectdatabox */ ui_wid_set(coord_dbox, “VALUE”, coord_frame_id)

END FUNCTION /* refresh */

PCL and CustomizationList Processor

280

List Processor Functions

Example:

#include “lpenums.p” CLASSWIDE WIDGET node_id STRING node_list[VIRTUAL]INTEGER status, nodes(VIRTUAL), pklist(VIRTUAL), nnodes... /* * Get the nodes from the node selectdatabox.

lp_picklist_string_creator_v (items, item_count, sort, vstring )

Description:

Create a valid Picklist in a virtual string from an array of ids.

Input:

INTEGER(item_count,6) items Each row consists of the following:

items(,1): entity Class (i.e. LpGEOMETRY)

items(,2): entity Type (i.e. LpSOLID)

items(,3): entity Identifier (i.e. 28, for label 28)

items(,4): entity SubIdentifier1 (i.e. 2, for solid 28; 0=N/A) face 2 of solid 28

items(,5): entitySubIdentifier2 (i.e. 1, for edge 1of surface 2 of solid 28; 0=N/A) edge 1 of surface 2 of solid 28

items(,6): entitySubIdentifier3 (i.e. 2, for vertex 2 of edge 1 of surface 2 of solid 28; 0=N/A) vertex 2 of edge 1 of surface 2 of solid 28

INTEGER item_count Number of items.

INTEGER sort If non zero, sort the items in ascending order, otherwise keep in original (Input) order.

Output:

STRING [VIRTUAL] vstr PCL virtual string to receive character list.

INTEGER <Return Value> Message facility code. See Message System Functions, 155. 0 indicates no error.

Error Conditions:

None.

281Chapter 5: User Interface and List Processor FunctionsList Processor

*/ ui_wid_get_vstring(node_id, “VALUE”, node_list) /* * Count the number of nodes in the node list. */ nnodes = app_count_id_list(LP_SUBLIST_NODE, node_list, @ FALSE, status)IF (status != 0) THEN RETURN status/* * Allocate a virtual array to store the node ids.

List Processor Functions*/ status = SYS_ALLOCATE_ARRAY(nodes, 1, nnodes) IF(status != 0) THEN RETURN 1/* * Allocate a virtual array to store the pick list information. */ status = SYS_ALLOCATE_ARRAY(pklist, 1, nnodes, 1, 6) IF(status != 0) THEN RETURN 1/* * Extract the node IDs from the selectdatabox string. */ status = fem_u_extract_node_ids(node_list, nnodes, nodes(1:)) IF(status != 0) THEN RETURN 1/* * Set the picklist array. */ FOR(i = 1 TO nnodes) pklist(i,1) = LpFINITE_ELEMENT pklist(i,2) = LpNODE pklist(i,3) = nodes(i) pklist(i,4) = 0 pklist(i,5) = 0 pklist(i,6) = 0 END FOR /* * Build a node list string from the node array. */ status = lp_picklist_string_creator_v(pklist(1:,1:), nnodes, @ 0, node_list) IF(status != 0) THEN RETURN 1

PCL and CustomizationList Processor

282

List Processor Functions

app_count_id_list (filter, lst, domesg, status )

Description:

Count the entities of a specified list processor type in a list using the picklist decoder routines.

Input:

INTEGER filter Filter from lpenums.i.

STRING lst Picklist from a selectdatabox.

LOGICAL domesg If TRUE, issue a message if error condition occurs.

Output:

INTEGER status Message facility code. See Message System Functions, 155. 0 indicates no error.

INTEGER <Return Value> Number of entities in the picklist of the specified type.

Error Conditions:

None.

app_count_token_list (lst, domesg, status )

Description:

Count the number of tokens that are contained in a Picklist.

Input:

STRING lst Picklist from a selectdatabox.

LOGICAL domesg If TRUE, issue a message if error condition occurs.

Output:

INTEGER status Message facility code. See Message System Functions, 155. 0 indicates no error.

INTEGER <Return Value> Number of tokens in the picklist.

Error Conditions:

None.

app_get_handle (lst, method, domesg, handle )

Description:

Open a list for processing.

283Chapter 5: User Interface and List Processor FunctionsList Processor

Input:

STRING lst Picklist from a selectdatabox.

INTEGER method Evaluation method from lpenums.i.

LOGICAL domesg If TRUE, issue a message if error condition occurs.

Output:

INTEGER handle List pointer.

INTEGER <Return Value> Number of tokens in the picklist.

Error Conditions:

None.

PCL and CustomizationList Processor

284

List Processor Functions

app_next_id (handle,filter, lst, domesg, eol, status )

Description:

Get the next id for a sublist (item) from a previously generated list.

Input:

INTEGER handle List pointer returned from app_get_handle.

INTEGER filter Filter from lpenums.i.

STRING lst Picklist from a selectdatabox.

LOGICAL domesg If TRUE, issue a message if error condition occurs.

LOGICAL eol Set to FALSE before making call. Returns TRUE when end of file encountered.

Output:

LOGICAL eol Returned as TRUE when end of file encountered.

INTEGER status Message facility error.

INTEGER <Return Value> ID of next item in Picklist.

Error Conditions:

None.

app_next_label (handle, filter, lst, domesg, eol, status )

Description:

Get the next label for a sublist item from a previously generated list.

Input:

INTEGER handle List pointer returned from app_get_handle.

INTEGER filter Filter from lpenums.i.

STRING lst Picklist from a selectdatabox.

LOGICAL domesg If TRUE, issue a message if error condition occurs.

LOGICAL eol Set to FALSE before making call. Returns TRUE when end of file encountered.

Output:

LOGICAL eol Returned as TRUE when end of file encountered.

INTEGER status Message facility error.

INTEGER <Return Value> Label of next item in Picklist.

285Chapter 5: User Interface and List Processor FunctionsList Processor

List Processor Functions

Side Effects:

• If DOMESG is true, a fatal error message will be written.If a database error, the following message will be written:

Database error during List Processing: [DB error message]

• If a list processor error, the following message will be written:

Unable to process list: “[contents of LIST]”

Error Conditions:

None.

app_lp_err_msg (domesg, lst, lp_routine, caller, status )

Description:

Handle a list processor error.

Input:

LOGICAL domesg If TRUE, issue a message if error condition occurs.

STRING lst Picklist from a selectdatabox.

STRING lp_routine Name of the list processor routine that detected the error.

STRING caller Name of the routine that called the list processor routine.

INTEGER status List processor status code.

Output:

None.

Error Conditions:

None.

PCL and CustomizationList Processor

286

List Processor Functions

fem_u_count_id_list (sublist_type, lst, domesg, status )

Description:

Count the entities of a specified list processor sublist type in a list using the picklist decoder routines.

Input:

INTEGER sublist_type Works only with following types from lpenums.p As follows:

LP_SUBLIST_FINITE_ELEMENT

LP_SUBLIST_NODE

LP_SUBLIST_ELEMENT

LP_SUBLIST_MPC

LP_SUBLIST_GEOMETRY

LP_SUBLIST_POINT

LP_SUBLIST_CURVE

LP_SUBLIST_SURFACE

LP_SUBLIST_SOLID

LP_SUBLIST_ANY

STRING lst Picklist from a selectdatabox.

LOGICAL domesg If TRUE, issue a message if error condition occurs.

Output:

INTEGER status Message facility code. See Message System Functions, 155. 0 indicates no error.

INTEGER <Return Value> Number of entities in the picklist of the specified type.

Error Conditions:

None.

Note: This does not work for all sub-list types. Use lp_sublist_count if the particular type of interest is not included here. In general, this routine performs better (Take less time) than lp_sublist_count.

287Chapter 5: User Interface and List Processor FunctionsList Processor

Example:

#include “lpenums.i” STRING ent_list[] INTEGER status INTEGER lidlid = fem_u_count_id_list(LP_SUBLIST_ELEMENT,ent_list,FALSE,status) IF ( status != 0 ) THEN RETURN status END IF IF (lid == 0) THENRETURN 48000004 END IF

List Processor Functions

Example:

CLASSWIDE WIDGET node_id STRING node_list[VIRTUAL]INTEGER status, nodes(VIRTUAL), nnodes... /* * Get the nodes from the node selectdatabox. */ ui_wid_get_vstring(node_id, “VALUE”, node_list) /* * Count the number of nodes in the node list. */ nnodes = app_count_id_list(LP_SUBLIST_NODE, node_list, @ FALSE, status)IF (status != 0) THEN RETURN status/* * Allocate a virtual array to store the node ids. */ status = SYS_ALLOCATE_ARRAY(nodes, 1, nnodes)

fem_u_extract_node_ids (node_list, num_nodes, id_nodes )

Description:

Extract the array of nodes IDs from a Picklist.

Input:

STRING node_list Picklist string.

INTEGER num_nodes Number of nodes, from fem_u_count_id_list() normally.

Output:

INTEGER(num_nodes) id_nodes Array of node IDs.

INTEGER <Return Value> Message facility code. See Message System Functions, 155. 0 indicates no error.

Error Conditions:

None.

PCL and CustomizationList Processor

288

IF(status != 0) THEN RETURN 1/* * Allocate a virtual array to store the pick list information. */ status = SYS_ALLOCATE_ARRAY(pklist, 1, nnodes, 1, 6) IF(status != 0) THEN RETURN 1/* * Extract the node IDs from the selectdatabox string. */ status = fem_u_extract_node_ids(node_list, nnodes, nodes(1:)) IF(status != 0) THEN RETURN 1

List Processor Functions

Example:

*/ INTEGER elem_topo_codes(VIRTUAL) INTEGER shape_code(VIRTUAL)

fem_u_get_free_faces (el_ids, max_nodes, max_per_face, max_faces, nels, el_con, el_shape, el_nodes, face_el_ids, face_ids, free_faces)

Description:

Create a list of all free element faces in a list of solid finite elements.

Input:

INTEGER el_ids() List of solid elements.

INTEGER max_nodes Maximum number of nodes per element in EL_IDS.

INTEGER max_per_face Maximum number of nodes per face in EL_IDS.

INTEGER max_faces Maximum number of faces for any element in EL_IDS.

INTEGER nels Number of elements.

INTEGER el_con() Element node list (Connectivity).

INTEGER el_shape() Element shape array.

INTEGER el_nodes() Element node count array.

Output:

INTEGER face_el_ids() Associated element ID.

INTEGER face_ids() Free face ID.

INTEGER free_faces Number of free faces.

INTEGER <Return Value> 0, no error.1, Unsupported element type (shape/nodes).2, Memory allocation error.

Error Conditions:

None.

289Chapter 5: User Interface and List Processor FunctionsList Processor

INTEGER nodes_per_elem(VIRTUAL) INTEGER connectivity(VIRTUAL) INTEGER face_elem_ids(VIRTUAL) INTEGER keep_face_elem_ids(VIRTUAL) INTEGER free_elements(VIRTUAL) INTEGER face_ids(VIRTUAL) INTEGER elem_ids(VIRTUAL) INTEGER status INTEGER cntr1 INTEGER num_elems INTEGER num_free_faces INTEGER group_id/* *.. Now allocate element and node arrays ... */ status = db_get_current_group_id( group_id ) IF( status != 0 ) THEN RETURN status status = db_count_elems_in_group( group_id, num_elems ) IF( status != 0 ) THEN RETURN status status = sys_allocate_array( elem_ids, 1, num_elems ) IF( status != 0 ) THEN RETURN status/* * fetch all the element ids ... */ status = db_get_elem_ids_in_group( num_elems, group_id, elem_ids ) IF( status != 0 ) THEN RETURN status IF ( num_elems <= 0 ) THEN RETURN status = sys_allocate_array( elem_topo_codes, 1, num_elems ) IF( status != 0 ) THEN RETURN status status = sys_allocate_array( shape_code, 1, num_elems ) IF( status != 0 ) THEN RETURN status status = sys_allocate_array( nodes_per_elem, 1, num_elems ) IF( status != 0 ) THEN RETURN status status = sys_allocate_array( connectivity , 1,8*num_elems ) IF( status != 0 ) THEN RETURN status status = sys_allocate_array( face_elem_ids, 1,6*num_elems) IF( status != 0 ) THEN RETURN status status = sys_allocate_array( keep_face_elem_ids, 1,6*num_elems) IF( status != 0 ) THEN RETURN status status = sys_allocate_array( free_elements, 1,6*num_elems) IF( status != 0 ) THEN RETURN status status = sys_allocate_array( face_ids, 1,6*num_elems) IF( status != 0 ) THEN RETURN status/* * .. Get the associated nodes ... */ status = db_get_nodes_for_elems( num_elems, 8, elem_ids, connectivity ) IF( status != 0 ) THEN RETURN status status = db_get_elem_etop( num_elems, elem_ids, elem_topo_codes ) IF( status != 0 ) THEN RETURN status status = db_get_elem_topology_data( num_elems, elem_topo_codes, @ shape_code, nodes_per_elem) IF( status != 0 ) THEN RETURN status /* set up array for later referencing to tell if element is a wedge or a hex */ status = db_get_nodes_for_elems( num_elems, 8, elem_ids, connectivity ) IF( status != 0 ) THEN RETURN status status = fem_u_get_free_faces( elem_ids, 8, 4, 6, num_elems, connectivity ,@ shape_code, nodes_per_elem, @ face_elem_ids, face_ids, num_free_faces ) IF( status != 0 ) THEN RETURN status DUMP num_free_faces, face_elem_ids(1:num_free_faces) RETURN 0END FUNCTION

PCL and CustomizationList Processor

290

fem_u_get_id_list (sublist_type, lst, nument, domesg, ids )

Description:

Return the entities ids of a specified list processor sublist type in a list using the picklist decoder routines.

Input:

INTEGER sublist_type Works only with following types from lpenums.p As follows:

LP_SUBLIST_FINITE_ELEMENT

LP_SUBLIST_NODE

LP_SUBLIST_ELEMENT

LP_SUBLIST_MPC

LP_SUBLIST_GEOMETRY

LP_SUBLIST_POINT

LP_SUBLIST_CURVE

LP_SUBLIST_SURFACE

LP_SUBLIST_SOLID

LP_SUBLIST_ANY

STRING lst Picklist from a selectdatabox.

INTEGER nument Number of entities to get.

LOGICAL domesg If TRUE, issue a message if error condition occurs.

Output:

INTEGER(nument) ids Array of entity ids.

INTEGER <Return Value> Message facility code. See Message System Functions, 155. 0 indicates no error.

Error Conditions:

None.

291Chapter 5: User Interface and List Processor FunctionsList Processor

Example:

#include “lpenums.p” STRING list1_entities[VIRTUAL] INTEGER node_ids1(VIRTUAL), num_nodes1.../* * Count the nodes in the list and return if there are no nodes or we * can’t process the list */

num_nodes1 = fem_u_count_id_list(LP_SUBLIST_NODE, list1_entities, @ true, status) IF(num_nodes1 <= 0 || status != 0) THEN RETURN

/* * Get the IDs of the nodes */

IF(sys_allocate_array(node_ids1, 1, num_nodes1) != 0) THEN RETURN status = fem_u_get_id_list(LP_SUBLIST_NODE, list1_entities, @ num_nodes1, true, node_ids1)

Note: fem_u_get_id_list does not work for all sub-list types. Use lp_sublist_type and lp_sublist_next if the particular type of interest is not included here. In general, this routine performs better (takes less time) than lp_sublist_type and lp_sublist_next.

PCL and CustomizationList Processor

292

fem_u_get_subid_list (sublist_type, lst, nument, domesg, ids, fids, edids )

Description:

Return the entities face ids and edges ids of a specified list processor sublist type in a list using the picklist decoder routines.

Input:

INTEGER sublist_type Works only with following types from lpenums.p As follows:

LP_SUBLIST_FINITE_ELEMENT

LP_SUBLIST_NODE

LP_SUBLIST_ELEMENT

LP_SUBLIST_MPC

LP_SUBLIST_GEOMETRY

LP_SUBLIST_POINT

LP_SUBLIST_CURVE

LP_SUBLIST_SURFACE

LP_SUBLIST_SOLID

LP_SUBLIST_ANY

STRING lst Picklist from a selectdatabox.

INTEGER nument Number of entities to get.

LOGICAL domesg If TRUE, issue a message if error condition occurs.

Output:

INTEGER(nument) ids Array of entity ids.

INTEGER(nument) fids Face ids of the entities.

INTEGER(nument) edids Edge ids of the entities.

INTEGER <Return Value> Message facility code. See Message System Functions, 155. 0 indicates no error.

Error Conditions:

None.

293Chapter 5: User Interface and List Processor FunctionsList Processor

Example: Creating a Simple Customized Menu and FormMany times it is desired to create an additional menu that is to appear on the Main Menubar. User created menus will appear between the Applications menu and the Help menu. Customized forms may be displayed as the result of a menu selection from a customized menu item or as the result of clicking on a customized button. In either case, the PCL is exactly the same to define the form and its widgets. The following example provides the necessary PCL to create a customized menu and form. Although the example is quite simple, the basic ideas are presented. More complex examples are provided later in this book.

The p3epilog.pcl file is used to link customized PCL to Patran. Refer to The p3prolog.pcl and p3epilog.pcl Files (p. 54) in the Patran Reference Manual for more information concerning this file. Often times it is useful to refer to the PCL file or compiled PCL and, if necessary, initialize the functionality from the p3epilog.pcl file. For example, to reference the PCL in the following example which creates a customized menu and form, the required p3epilog.pcl file would be:

/** Add the PCL to the existing set of libraries accessed by Patran.*/

!! INPUT your_custom.pcl

/** Run the init function of the user_pcl class to create the menu and* the form.*/

ui_exec_function(“user_pcl”, “init”)

The first line uses the !!INPUT directive to instruct Patran to find the file named your_custom.pcl, compile it, and add it to the existing set of PCL. By calling ui_exec_function(), Patran is instructed to run the function named “init” in the class named “user_pcl”.

Here is PCL for a file named your_custom.pcl:

CLASS user_pcl

FUNCTION init()

WIDGET menubar_id, usermenu_id, form_id

/* * Get the id of the Patran menubar. */ menubar_id = uil_primary.get_menubar_id()

/* * Create the menu. */ usermenu_id = ui_menu_create(menubar_id, “menu_cbk”, “Customer Option”)

Note: fem_u_get_subid_list does not work for all sub-list types. Use lp_sublist_type and lp_sublist_next if the particular type of interest is not included here. In general, this routine performs better (takes less time) than lp_sublist_type and lp_sublist_next.

PCL and CustomizationList Processor

294

/* * Create an item for the menu. */ ui_item_create(usermenu_id, “my_item”, “Site Specific Item...”, FALSE)

/* * Create the form. Normally, each form would have it’s own class and * it’s own PCL file. But for this example, the form will be created here. */ form_id = ui_form_create(“form”, 3.4, 2.25, “UL”, 3.75, 3.25, @ “Site Specific Form”, ““)

/* * Create a label to further identify the form. Notice that once the label * is created we no longer need it’s ID, so we ignore the return value. */ ui_label_create(form_id, ““, .75, .25, “Site Specific Application”)

/* * Create some buttons which could be used to bring up other forms. The * separator at the bottom provides a visual separation between the * buttons which bring up forms and the button which closes this form. */ ui_button_create(form_id, ““, .25, .75, 3., 0., @ “Site Specific Geometry Access...”, TRUE, FALSE) ui_button_create(form_id, ““, .25, 1.25, 3., 0., @ “Acoustic Analysis...”, TRUE, FALSE) ui_button_create(form_id, ““, .25, 1.75, 3., 0., @ “Experimental Modal Import...”, TRUE, FALSE)

/* * Create the button to close the form. */ ui_button_create(form_id, “cancel”, 1.375, 2.5, 1., 0., @ “Cancel”, TRUE, TRUE)

END FUNCTION

FUNCTION display

/* * Since the form is not to be displayed unless the menu item is selected, * the display() function does not contain a ui_form_display() call. This * function exists for completeness. */

END FUNCTION/* * This function is called to handle menu events.*/FUNCTION menu_cbk(item_name)

STRING item_name[]

IF(item_name == “my_item”)THEN ui_form_display(“user_pcl”) END IF

END FUNCTION

/* * This function is called to handle Cancel button events.*/

FUNCTION cancel

ui_form_hide(“user_pcl”)

END FUNCTION

295Chapter 5: User Interface and List Processor FunctionsList Processor

END CLASS

The first executable line of the file defines the class to be user_pcl. This class will be referred to in the class and it may also be referred to from other classes. The first function in the file is the init function which creates the widgets to be used in this class. Although it is not required to create all of the widgets here, it is suggested. Notice that since the three widgets declared in the init function are referenced in only that function, they need not be declared CLASSWIDE.

If a PCL file creates a menu, become familiar with the uil_primary.get_menubar_id() function. Refer to User Interface Functions, 297 for detailed information on this function. Once the menubar ID has been returned it may be used as the parent to the menu, and in turn the menu may be used as the parent to the item. The newly created menu and menu item will now appear once this function has been called. This is a picture of part of the customized menubar:

The form is created next. The ID returned from the ui_form_create() function will be used as the parent to the label and the buttons. Notice that the locations and dimensions of the form and the widgets have been done by defining the values specifically rather than using the PCL variables. This was done to how show quickly forms and widgets can be created. Here is a picture of the resulting form:

PCL and CustomizationList Processor

296

An empty function named display() is next. Notice that since no arguments are needed for this function, the parentheses are optional. In most classes the display() function will be used to manage the display of the form created in the init() function. These function names are important as documented by ui_exec_function(). This example contains a form that is displayed from a menu pick so the callback function for the menu handles the display of the form.

The next function is named menu_cbk(). This function is the callback function for the menu created in the init() function; notice that the name, menu_cbk, is the same as the second argument in the ui_menu_create() call which is the “callback” argument. One argument is passed to the function, item_name, which is the name of the item that was selected from the menu. Since the menu has only one item there is only one IF...THEN branch (which is unnecessary for this example but is included for completeness). If the item is selected, item_name will be “my_item” which instructs Patran to display the form that was created in the class named “user_pcl.”

The last function in the class is cancel(). This function is also a callback function, this time for the button labelled Cancel (notice that the callback argument for the Cancel button, the second argument, is “cancel” which will be called when the user clicks on the Cancel button). This function simply hides the form.

297Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

User Interface Functions

BUTTON Functions

According to OSF/Motif terminology, the Patran button widget is of the XmPushButtonGadget class.

A button has only one option: it is clicked to initiate an action. No manipulation of data occurs in terms of direct input.

ui_button_create (parent, callback, x, y, width, height, label, [unused], highlight)

PCL and CustomizationUser Interface Functions

298

BUTTON Functions

A button icon falls into the same class and works exactly the same as the button widget. Instead of a text label on the button icon, an icon visually describes the widget’s function.

Description:

Create a button widget.

Input:

widget parent Parent widget of newly created widget. Must be a form.

STRING callback Name of PCL function called for an event in this widget. The function must be in the class in which the widget is created. Use ““ if events for this widget are not of interest.

NUMERIC x X location of widget in inches relative to the parent.

NUMERIC y Y location of widget in inches relative to the parent.

NUMERIC width Width of widget in inches. If zero, the button will be sized automatically to fit the text.

NUMERIC height Height of widget in inches. If zero, the button will be sized automatically to fit the text.

STRING label Text that will be displayed in button.

LOGICAL [unused] Use TRUE.

LOGICAL highlight TRUE if button is highlighted as the default button. Only one button per form may be highlighted as the default.

Output:

widget <Return Value> Button widget ID. NULL if button not created.

Error Conditions:

None.

ui_buttonicon_create (parent, callback, x, y, icon)

299Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

CASCADE Item Functions

This widget resides in the OSF/Motif defined XmCascadeButtonGadget class. Although not often used in Patran, this widget provides the ability to bring a pull-down menu from an item contained within a higher-level pull-down menu. (To operate a cascade item from the keyboard, press the space bar. The arrow keys will move focus to other items.)

Description:

Create a button icon widget.

Input:

widget parent Parent widget of newly created widget. Must be a form.

STRING callback Name of PCL function called for an event in this widget. The function must be in the class in which the widget is created. Use ““ if events for this widget are not of interest. The first space character in the name/callback signifies that the rest of the string value is the pop-up help for the icon, and delimits the preceding string without the space as the name/callback of the widget.

NUMERIC x X location of widget in inches relative to the parent.

NUMERIC y Y location of widget in inches relative to the parent.

STRING icon Name of the file containing the icon data. Use a !!PATH in your p3midilog.pcl file if this file does not appear along the standard path.

Output:

widget <Return Value> Button widget ID. NULL if button not created.

Error Conditions:

None.

ui_cascadeitem_create (parent, name, label)

PCL and CustomizationUser Interface Functions

300

Comments:

This function may be used to create menu items that does not have an associated menu. However, it is recommended that ui_item_create() is used in such a case.

Description:

Creates an item widget to be used to bring up a cascading menu.

Input:

widget parent ID of the parent widget. Must be a menu or popup menu.

STRING name Name of PCL function called for an event in this widget. The function must be in the class in which the widget is created. Use ““ if events for this widget are not of interest.

STRING label Label to be displayed indicating the widgets action. Unlike for ui_item_create(), specifying the label as ““ will not create a separator, but will create a menu item whose label is ““.

Output:

widget <Return Value> Item widget ID. NULL_WIDGET if item not created.

Error Conditions:

None.

301Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

COLOR WIDGET Functions

ui_colormenu_create (parent, callback, x, y, width, height, label, label_position, label_x, label_y, color, user_data)

Description:

Create a colormenu.

Input:

widget parent Parent widget ID. Parent widget must be a form, modal form or a frame.

STRING callback Name of the PCL function called when a color from the popup menu, posted from this widget, is selected.

NUMERIC x x location of the widget.

NUMERIC y y location of the widget.

NUMERIC width Wwidth of the widget.

NUMERIC height Height of the widget.

STRING label Widget label.

STRING label_position String specifying the position of the label. The label_position string must be from among the following.

“Top”: Place the label at the top of the menu button.

“Left”: Place the label at the left of the menu button.

“Right”: Place the label at the right of the menu button.

“None”: Place the label at the position specified by the label_x and label_y parameters.

NUMERIC label_x x location of the widget label. Used only if label_position is “None”.

NUMERIC label_y y location of the widget label. Used only if label_position is “None”.

INTEGER color Background color of the button. If 1< color < 16 the widget will be assigned the appropriate color from the Patran colors. Otherwise, the widget will show multiple colors to indicate ambiguity or nonuniqueness.

INTEGER user_data Data specific to this widget. This will be passed to the callback function (see below.)

Output:

PCL and CustomizationUser Interface Functions

302

Comments:

The PCL callback needs to be defined if the callback string passed to the creation function is not a null string. The syntax of the callback function is as follows.

FUNCTION color_cb ( wid, user_data, index )WIDGET widINTEGER user_data, index

where,

wid is the widget id of the colormenu that caused this callback.user_data is the value passed to the colormenu creation call.index is the new color value.

widget <Return Value> Colormenu widget id. NULL if the widget is not created.

Error Conditions:

None.

303Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Comments:

The PCL callback needs to be defined if the callback string passed to the creation function is not a null string. The syntax of the callback function is as follows.

FUNCTION color_cb( wid, user_data, index )WIDGET widINTEGER user_data, index

where,wid is the widget id of the colorbar that caused this callback.user_data is the value passed to the colorbar creation call.index is the number of the depressed color button when the callback is called.

ui_colorbar_create (parent, callback, x, y, width, height, label, ncolors, user_data)

Description:

Create a colormenu.

Input:

widget parent Parent widget ID. Parent widget must be a form, modal form or a frame.

STRING callback Name of the PCL function called when a color button from this widget is selected.

NUMERIC x x location of the widget.

NUMERIC y y location of the widget.

NUMERIC width Width of the widget.

NUMERIC height Height of the widget.

STRING label Widget label.

INTEGER ncolors Numbers of color buttons in the widget. Must be between 1 and 16.

INTEGER user_data Data specific to this widget. This will be passed to the callback function (see below.)

Output:

widget <Return Value>

Colorbar widget ID. NULL if the widget is not created.

PCL and CustomizationUser Interface Functions

304

The following parameters may be set using ui_wid_set call and may be obtained using ui_wid_get call.

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if this widget is to be displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

INTEGER(2) ITEMCOLOR Item color of the widget. The ui_wid_set or ui_wid_get call must be passed an array of size two. The first element of the carry should contain the item number. On a call to ui_wid_set the second element of the array should contain the index of the color desired. A call to the function ui_wid_get will return the color index in the second element.

INTEGER CURRENTITEM Currently depressed color button of the colorbar.

INTEGER NITEMS Number of color buttons in the colorbar.

305Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

CURSOR Functions

Example:

gu_view_center is used to pick the view center from the View menu. /*$$ gu_view_center * * Purpose: To set a flag so that the next pick rectangle will be * used for a change view center operation. * * Input: * * Output: * * Log: * * Notes: * * */ FUNCTION gu_view_center( ) GLOBAL INTEGER view_center

view_center = 1 ui_cursor_set( “graphics”, “dotbox” )

ui_cursor_set (mode, cursor)

Description:

Set the window cursor for the assigned windows.

Input:

STRING mode “ALL”, any window

“GRAPHICS”, Graphics window

”NONGRAPHICS”, Any non-graphics window

”NONMODAL”, Non-modal window

”MODAL”, Modal window

STRING cursor “dotbox” - Square with dot in it.

“cross” - Cross hair

“left_ptr” - Hand pointing

Output:

None.

Error Conditions:

None.

PCL and CustomizationUser Interface Functions

306

DATABOX Functions

Databoxes are defined by OSF/Motif to be text widgets which can only accept three kinds of user input: 1) integers, 2) real numbers and 3) character strings. This input may be typed or “pasted” from another databox or an X window.

Although a databox will accept only one line of information, this line can sometimes be quite long.

Depending on the application of a databox, the type of data as well as the number of data values which can be input by the user is sometimes limited, in which case a warning bell or message will be issued.

ui_databox_create (parent, callback, x, y, label_length, box_length, label, value, label_above, datatype, num_vals)

307Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Comments:

The data is checked to be consistent with datatype and num_vals each time the contents of the databox is changed.

Description:

Creates a databox widget

Input:

widget parent Parent widget ID. May be a form or a scroll frame.

STRING callback Name of PCL function called for an event in this widget. The function must be in the class in which the widget is created. Use ““ if events for this widget are not of interest.

NUMERIC x X location of the databox in inches relative to the parent.

NUMERIC y Y location of the databox in inches relative to the parent.

NUMERIC label_length Used only if label_above is FALSE. Distance between the beginning of the label and the beginning of the box, in inches. If zero, the length of the label string will be used. Specifying the label_length is useful when lining up several databoxes.

NUMERIC box_length Length of the box in inches.

STRING label Displayed text describing the value associated with the databox. To have no label initially but plan on using ui_wid_set() to change the label, assign label to be “ “. If not assigning a label, use ““ and set label_above to FALSE.

DYNAMIC value Value displayed inside the databox. This value is of the datatype specified. If the databox is to be empty upon startup, specify ““as the initial value for all datatypes.

LOGICAL label_above TRUE is the label is to be displayed above of the databox, FALSE if the label is to be displayed to the left of the databox.

STRING datatype Type of data to accept. “INTEGER,” “REAL,” or “STRING.” All values must be of the same datatype.

INTEGER num_vals Upper limit of the number of values of type datatype to accept. If “STRING” is the assigned datatype, this value is ignored.

Output:

widget <Return Value> Widget ID. NULL if the widget could not be created.

Error Conditions:

None.

PCL and CustomizationUser Interface Functions

308

EXEC Functions

Comments:

If the function name is “DISPLAY”, Patran will ensure that the class's INIT function has be executed first. As a result, it is not necessary to call ui_exec_function() twice, the first time assigning the function name as INIT, the second time assigning the function name as DISPLAY; a call to ui_exec_function(classname, “DISPLAY”) will suffice.

ui_databox_get_current ( )

Description:

Get the current databox which has focus.

Input:

None.

Output:

widget <Return Value>

Error Conditions:

None.

ui_exec_function ( classname, functionname )

Description:

Invokes a class's function. This function should be used to properly register a class containing a ui_form_create() call by calling ui_exec_function(classname, “DISPLAY”). If the INIT function is called improperly using a classname.init() call, problems will occur when attempting to display the form. By using ui_exec_function() to initialize and display forms, problems will be avoided.

Input:

STRING classname Name of the class containing the function to be executed.

STRING functionname Name of the function to be executed.

Output:

None.

Error Conditions:

None.

309Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

FILE Functions

ui_file_create (parent_id, callback_func, x_location, y_location, width, number_rows, filter_label, filter_mask, directory_label, files_label, selection_label, file_name, ok_label, filterbutton_label, cancel_label )

Description:

This function will create a file selection form.

Input:

widget parent_id This value specifies a widget identifier for the parent widget of this form.

STRING callback_func[] This value specifies the name of the PCL function that will be called for an event representing a form event. This call back function must be a member of the class in which this widget is created.

REAL x_location This value specifies the x axis location of the file widget in pixels relative to the upper left corner of the parent widget.

REAL y_location This value specifies the y axis location of the file widget in pixels relative to the upper left corner of the parent widget.

REAL width This value specifies the width of the widget in pixels, excluding the border.

INTEGER number_rows This value specifies the number of rows that will be displayed in files and directory list boxes of the form.

STRING filter_label[] This value specifies the title used on the form to describe the filter databox.

STRING filter_mask[] This value specifies the path and filter mask that determines which files will be displayed in the file list box.

STRING directory_label[] This value specifies the text used on the form to describe the directory databox.

STRING files_label[] This value specifies the text used on the form to describe the files databox.

STRING selection_label[] This value specifies the text used on the form to describe the selection databox.

STRING file_name[] This value specifies a file name to be displayed in the selection databox. If the file name specified is listed in the file list box the file list box entry will be highlighted.

PCL and CustomizationUser Interface Functions

310

Remarks:

The PCL callback function will be called when the “OK” or the “Cancel button” is selected. This PCL callback fuction should be designed to accept two strings as arguments and to return nothing. When the “OK” button is selected the callback function will have the complete path and name of the selected file passed as the first argument and the work “OPEN” passed as the second argument. When the “Cancel” button is selected an empty string or ““ will be passed as the first argument and the work “CANCEL” will be passed as the second argument.

The following input values can be manipulated through a call to the function ui_wid_set().

STRING ok_label[] This value specifies the text used to label the “OK” button.

STRING filterbutton_label[] This value specifies the text used to label the “Filter” button.

STRING cancel_label[] This value specifies the text used to label the “Cancel” button.

Output:

widget <Return Value> This function returns avalid form widget identifier when executed successfully and a value on WIDGET_NULL to indicate a change an error.

Error Conditions:

None.

311Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

:

The file widget follows the OSF/Motif standard XmFileSelectionBox. It is unique in that the file widget contains a group of closely related widgets. The filter is used to list only the desired files in the list box below and to the right. The “*” character is a wild card.

Input Value Name Corresponding

ui_wid_set() Parameter Name

callback_function NAME

x_location X

y_location Y

width WIDTH

number_rows None available.

filter_label[] FILTERLABEL

filter_mask[] DIRECTORY and FILTER

directory_label[] None available.

files_label[] FILESLABEL

selection_label[] FILENAMELABEL

file_name[] FILENAME

ok_label[] OKBUTTONLABEL

filterbutton_label[] FILTERBUTTONLABEL

cancel_label[] CANCELBUTTONLABEL

PCL and CustomizationUser Interface Functions

312

Example:

None.

FORM Functions

Forms are separate operating system windows that serve as backgrounds for widgets. They follow the OSF/Motif standard XmBulletinBoard type. They are enclosed by window manager borders. Two types of forms exist: forms and modal forms. See ui_modalform_create, 337 for information on modal forms.

ui_form_create ( callback, x, y, position, width, height, label, [unused] )

313Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Description:

Create a form widget.

Input:

STRING callback Name of PCL function called for an event in this widget. Use ““ since forms do not register events.

NUMERIC x X location of the form in inches relative to the screen.

NUMERIC y Y location of the form in inches relative to the screen.

STRING position Indicates which corners of the screen and form to use when measuring the x and y locations. Options: “UL,” “UR,” “LL” and “LR” for upper-left, upper-right, lower-left, and lower-right, respectively.

NUMERIC width Width of the form in inches.

NUMERIC height Height of the form in inches.

STRING label Label to appear in title bar.

STRING [unused]

Output:

PCL and CustomizationUser Interface Functions

314

FORM Functions

Comments:

The form will be hidden prior to deletion. This function is useful for developing new PCL forms and widgets since a call to ui_exec_function() will re-run the INIT function. However, during normal execution, all the widgets settings are lost as a result of deleting which removes them from memory. Use ui_form_hide() instead.

If class_wide variables are set upon initialization, be careful when using this function because it will cause the INIT function to be re-executed, sometimes producing un-expected results.

widget <Return Value> ID of the created form widget. NULL if the form is not created properly.

Error Conditions:

None.

ui_form_delete ( classname )

Description:

Delete a form widget.

Input:

STRING classname Name of the class containing the definition of the form to be deleted.

Output:

None.

Error Conditions:

None.

315Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Comments:

Child widgets that have been hidden by calling ui_wid_set (widget, “DISPLAY”, FALSE) will not be displayed. It is preferable to use ui_exec_function(classname, “DISPLAY”).

ui_form_display ( classname )

Description:

Displays a form defined in class classname and all of its visible children.

Input:

STRING classname Name of the class containing the definition of the form to be displayed.

Output:

None.

Error Conditions:

None.

PCL and CustomizationUser Interface Functions

316

FORM Functions

Example:

Typing in:

ui_form_to_file( “uil_app_asm”,1)at command line with geometry panel displayed results in file uil_app_asm.fd.01 which contains:Form title: “Geometry”Optmenu: “Construct”Label: “Action: “Optmenu: “Grid”Label: “Object: “Optmenu: “XYZ”Label: “Method: “Databox Value: “9”Label: “Grid ID List”Select: “Coord 0”Label: “Refer. Coordinate Frame”Select: “[0 0 0]”

Description:

Hides a form defined in class classname and all of its children.

Input:

STRING classname Name of the class containing the definition of the form to be hidden.

Output:

None.

Error Conditions:

None.

ui_form_to_file ( classname, level )

Description:

Given the string classname as the name of a class which has a form currently displayed, this function will create a file classname.fd.version file which contains the form and widget descriptions.

Input:

STRING classname Classname which contains form of interest.

INTEGER level Optional and defaults to 0.

Output:

<Return Value>

Error Conditions:

None.

317Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Label: “Point Coordinates List”Toggle: “Auto Execute” [On]Button: “-Apply-” [Default]

FORM Functions

Comments:

Creates FrameMaker objects when imported into a FrameMaker document through the import file menu pick.

FRAME Functions

The frame widget, OSF/Motif standard type XmFrame, is strictly a visual aid. Its “etched in,” narrow appearance groups associated widgets together in a form. Thus, no user interaction occurs with this widget type. Frames may have titles (text strings) at the top left corner.

ui_form_to_frame ( classname, scale )

Description:

Given the string classname as the name of a class which has a form currently displayed, this function will create a framemaker file classname.mif file which contains the form at a scale factor of scale.

Input:

STRING classname Name of the PCL class containing the form to be used.

INTEGER scale Scale factor for translation. Optional and defaults to 1.0.

Output:

None.

Error Conditions:

None.

ui_frame_create ( parent, callback, x, y, width, height, label, options )

PCL and CustomizationUser Interface Functions

318

Comments:

Description:

Creates a frame widget.*

Input:

widget parent ID of the parent widget. Must be a form, modalform, or window

STRING callback Name of the PCL function called for an event in this widget. Use ““ since frames are not registering events.

NUMERIC x X location of the frame in inches relative to its parent.

NUMERIC y Y location of the frame in inches relative to its parent.

NUMERIC width Width of the frame in inches.

NUMERIC height Height of the frame in inches.

STRING label Label to appear describing the contents of the frame.

INTEGER options Optional argument defaults to 0.

FRAME_CANRESIZE(1) - Allow resizable frames.

Output:

widget <Return Value> Item widget ID. NULL if frame not created.

Error Conditions:

None.

319Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Widgets placed inside of the frame are positioned relative to the upper left corner of the frame. Widgets positioned with an x or y value that is too large will only partially appear or will not be displayed at all.

ITEM Functions

Four different item types exist: menu items, listbox items, option menu items, and switch items.

ui_framemaker ( option[, scale] )

Description:

Set automatic framemaker generation. If option is 1, whenever ui_form_display() is called, the classname is echoed to the history window. This gives you the classname in order to type a ui_form_to_frame() command. If option is 2, then whenever ui_form_display() is called, the name of the class is echoed, and a call is automatically made to ui_form_to_frame() with the specified scale factor. If option is 0, then ui_form_display() reverts back to normal operation.

Input:

INTEGER option Specifies how the function works. See Description above.

REAL scale Scale factor for translation. Optional and defaults to 1.0.

Output:

None.

Error Conditions:

None.

ui_item_create ( parent, name, label, toggleable, options )

PCL and CustomizationUser Interface Functions

320

Description:

Creates an item widget to be used as a child of a menu, menubar, option menu, or switch widget. To create items in a listbox see ui_listbox_items_create, 332.

Input:

widget parent ID of the parent widget. Must be a menu, popup menu, menubar, option menu, listbox, or a switch.

STRING name Name of the widget. This name is frequently used as an argument for the callback function for the item's parent.

STRING label Label to be displayed indicating the widget’s action. If label is “ ” and the parent is a menu or option menu, the item will be defined as a separator.

LOGICAL toggleable Value used only for menu items; ignored if the item is not a menu item. If TRUE, the item will display a toggle box next to the item. If FALSE, the item will have only one value.

321Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Comments:

Menus, menubars, option menus, listboxes, and switches use item widgets. The functional attributes of the item are defined by the parent widget type. The position of the item relative to other currently existing children for the parent widget is specified by the order in which the items are created, i.e., the item created first will appear first in the parent widget, the last item created will appear last.

Use ui_cascadeitem_create() if a cascading menu is desired upon selection of this item.

INTEGER options Optional argument with default value of 0 can be the sum of a combination of the following values and are ignored if the parent is the wrong type:

MNUITEM_HAS_UNIQUE_CB(1) - Menu item has unique callback specified in the name argument above.

MNUITEM_SYMBL_1OFN(4) - The toggle item has a 1-of-many(diamond) symbol. This specification is required only for menu toggle items where by default they will have the N-of-many(square) symbol. To imitate switch-like behavior you are required to implement it the menu’s PCL callback function.

MNUITEM_ISLABL(8)- Menu item is a label.

Output:

widget <Return Value> Item widget ID. NULL if item not created.

Error Conditions:

None.

PCL and CustomizationUser Interface Functions

322

Comments:

The parent must be a listbox. Do not reference a listbox item after a ui_item_delete() call.

Comments:

The parent must be a listbox or an option menu. Do not reference items after they have been deleted.

ui_item_delete ( listbox_id, item_id )

Description:

Deletes a listbox item from it’s parent listbox.

Input:

widget listbox_id Item's parent listbox.

widget item_id Item's ID.

Output:

None.

Error Conditions:

None.

ui_item_deleteall ( parent )

Description:

Deletes all items from it’s parent. The parent must be a listbox or an option menu.

Input:

widget listbox_id Item's parent. Must be a listbox or an option menu.

Output:

None.

Error Conditions:

None.

323Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

ITEM Functions

Comments:

The parent must be a listbox. Do not reference items after they have been deleted.

Comments:

The parent may not be a listbox.

ui_item_deleteselected ( listbox_id )

Description:

Deletes selected items from a listbox.

Input:

widget listbox_id Listbox from which selected items are to be deleted.

Output:

None.

Error Conditions:

None.

ui_item_display ( item )

Description:

Displays a menu item, a switch item, or an option menu item after a call to ui_item_hide().

Input:

widget item Item widget ID to be displayed.

Output:

None.

Error Conditions:

None.

PCL and CustomizationUser Interface Functions

324

ITEM Functions

Comments:

If the specified parent does not have an item with the specified label, NULL will be returned.

ui_item_hide ( item )

Description:

Hides a menu item, a switch item, or an option menu item.

Input:

widget item Item widget ID to be hidden.

Output:

None.

Error Conditions:

None.

ui_item_idfromlabel ( parent, label )

Description;

Returns the item's ID given it's parent and it's label.

Input:

widget parent Item's parent.

STRING label Item's label.

Output:

widget <Return Value> Item's ID.

Error Conditions:

None.

325Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Comments:

If the specified parent does not have an item with the specified name, the string “NONE” will be returned.

ITEM Functions

Comments:

If the specified parent does not have an item with the specified label, the string “NONE” will be returned.

ui_item_labelfromname ( parent, name, label )

Description:

Outputs the item's label givens it’s parent and it’s name.

Input:

widget parent Item's parent.

STRING name Item's name.

Output:

STRING label Item's label.

Error Conditions:

None.

ui_item_namefromlabel ( parent, label, name )

Description:

Outputs the item's name givens it’s parent and it’s label.

Input:

widget parent Item's parent.

STRING label Item's label.

Output:

STRING name Item's name.

Error Conditions:

None.

PCL and CustomizationUser Interface Functions

326

Comments:

The items will be sorted if sort is set to TRUE in the ui_listbox_create() call for this listbox (Refer to the ui_listbox_create() call for more information.).

ITEM Functions

The only item icon type is the switch item icon. They may be keyboard-selected using the arrow keys to move from one item to the next, then pressing the space bar.

ui_item_relabel ( listbox_id, old_label, new_label )

Description:

Replaces an old string for a listbox item with a new string.

Input:

widget listbox_id Listbox containing the string to be replaced.

STRING old_label String to be replaced.

STRING new_label New label.

Output:

None.

Error Conditions:

None.

ui_itemicon_create ( parent, name, iconname, toggleable, options )

327Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Description:

Creates an icon item widget to be used as a child of a menu, or switch widget.

Input:

widget parent ID of the parent widget. Must be a menu, menubar, or a switch.

STRING name Name of the widget. This name is frequently used as an argument for the callback function for the item's parent. The first space character in the name/callback signifies that the rest of the string value is the pop-up help for the icon, and delimits the preceding string without the space as the name/callback of the widget.

STRING iconname Name of the file containing the hex information that is used to describe the icon.

LOGICAL toggleable Value used only for menu items; ignored if the item is not a menu item. If TRUE, the item will display a toggle box next to the item. If FALSE, the item will behave as a (push) button if it is not used as the parent for a (cascading)menu.

INTEGER options Optional argument with default value of 0 can be the sum of a combination of the following values and are ignored if the parent is the wrong type:

MNUITEM_HAS_UNIQUE_CB(1) - Menu item has unique callback specified in the name argument above.

MNUITEM_ISTOGL(2) - The item is a toggle. If specified overrides the value of the toggleable argument.)

MNUITEM_SYMBL_1OFN(4) - The toggle item has a 1-of-many(diamond) symbol. This specification is required only for menu toggle items where by default they will have the N-of-many(square) symbol. To imitate switch-like behavior you are required to implement it the menu’s PCL callback function.

MNUITEM_ISLABL(8) - Menu item is a (title)label.

Output:

PCL and CustomizationUser Interface Functions

328

Comments:

Menus, menubars, and switches use itemicon widgets. The functional attributes of the item are defined by the parent widget type. The position of the item relative to other currently existing children for the parent widget is specified by the order in which the items are created, i.e., the item created first will appear first in the parent widget, the last item created will appear last.

LABEL Functions

Labels are used only to label other widgets and cannot be selected. They provide additional information to the user.

LABELICON Functions

Label icons and labels are exactly alike except that label icons label other widgets with an icon; not text. See ui_label_create, 328 for more information.

widget <Return Value> Item widget ID. NULL if item not created.

Error Conditions:

None.

ui_label_create ( parent, callback, x, y, label )

Description:

Create a label widget

Input:

widget parent Parent widget of newly created widget. Must be a frame, a form, or a modal form.

STRING callback Not used.

NUMERIC x X location of the widget in inches relative to the parent.

NUMERIC y Y location of the widget in inches relative to the parent.

STRING label Text to be displayed.

Output:

widget <Return Value> Label widget ID. NULL if label not created.

Error Conditions:

None.

ui_labelicon_create ( parent, callback, x, y, iconname )

329Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

LISTBOX Functions

This widget is considered by OSF/Motif as an XmList contained within an XmScrolledWindow.

Description:

Create a label icon widget

Input:

widget parent Parent widget of newly created widget. Must be a frame, a form, or a modal form.

STRING callback Not used.

NUMERIC x X location of the widget in inches relative to the parent.

NUMERIC y Y location of the widget in inches relative to the parent.

STRING iconname Name of the file containing the hex information describing the icon. The file must be in the path described by the !!PATH directive assigned during session initialization.

Output:

widget <Return Value> Label widget ID. NULL if label not created.

Error Conditions:

None.

ui_listbox_create ( parent, callback, x, y, width, num_rows, label, selection_type, sort )

PCL and CustomizationUser Interface Functions

330

Comments:

In order to add items to a listbox see ui_listbox_items_create, 332. Due to a Motif bug a listbox created in a form that is already displayed will have incorrect num_rows. To work around this problem you have to call ui_wid_set( <listbox>, “ROWS”, num_rows ) after creating the listbox successfully.

selection_type Modes

Four different selection_type modes exist for the listbox, as follows:

Description:

Create a listbox widget

Input:

widget parent Parent widget of newly created widget. Must be a frame, a form, or a modal form.

STRING callback Name of the PCL function called for an event in this widget. The function must be in the class in which the widget is created. Use ““ if events in this widget are not of interest.

NUMERIC x X location of the widget in inches relative to the parent.

NUMERIC y Y location of the widget in inches relative to the parent.

NUMERIC width Width of the listbox in inches.

INTEGER num_rows Number of rows of items displayed in the listbox.

STRING label Label displayed to describe the listbox.

STRING selection_type “BROWSE”, “EXTEND”, “MULTIPLE”, or “SINGLE”. See selection_type Modes, 330.

LOGICAL sort TRUE if the items should be sorted alphabetically, FALSE if not.

Output:

widget <Return Value> Widget ID of listbox widget. NULL if not created.

Error Conditions:

None.

331Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Single Allows only one pick at a time. Here, pressing down on an item will automatically pick it. Any scrolling done afterwards or a releasing of the mouse button on another item will be inconsequential. Arrow keys highlight subsequent items which also selects one at a time.

Browse Allows only one selection to be made at a time. Pressing down on an item only initiates picking, then you may scroll up and down through the other choices without making a selection. As the cursor moves over the items, the item corresponding to the cursor location will become highlighted. Releasing the mouse button on the highlighted item makes the selection. Keyboard selection works the same for browse mode as for single mode.

Multiple Allows picking of more than one item by clicking each one separately. It will also toggle off previously highlighted items. The arrow keys highlight the items while the space bar selects and deselects them.

Extend Also permits multiple picking of items. Pressing down on the left mouse button with the cursor on the first (base) item desired will initiate picking. Next, dragging through any adjacent items will highlight them also. These highlights are temporary and can be changed by dragging elsewhere in the listbox. Releasing the mouse button on another item will pick all items between the base and last item inclusively.

PCL and CustomizationUser Interface Functions

332

LISTBOX Functions

ui_listbox_items_create ( listbox, names, labels, num_items, wid_array )

Description:

Create items in a listbox. This routine differs from ui_item_create by creating items in a listbox from an array of labels. The result is that items are created much faster with this routine than by creating them one at a time. This call ignores the DUPLICATEITEM resource setting of the listbox. The caller of this function is responsible for eliminating duplicate items when necessary.

Input:

widget listbox Listbox ID returned from the ui_listbox_create() call containing the items to be selected.

STRING[]() names Names of the widgets to be created in the listbox. These are frequently used as arguments for the callback function for the item’s parent.

STRING[]() labels Labels to be displayed indicating the widgets action.

INTEGER num_items Number of items in listbox.

Output:

WIDGET() wid_array Array that will contain the uims widgets created for each label. If uims widgets are not needed, pass the global WIDGET_NULL instead of wid_array

INTEGER <Return Value> Status. 0 if no error occurred, 1 otherwise.

Error Conditions:

None.

ui_listbox_items_delete ( listbox )

Description:

Delete all items contained in the listbox.

Input:

widget listbox Listbox ID returned from the ui_listbox_create() call containing the items to be deleted.

Output:

None.

Error Conditions:

None.

333Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

LISTBOX Functions

Comments:

This routine will work with listboxes created with a selection type of EXTENDED or MULTIPLE. It will not work with listboxes created with a selection type of BROWSE or SINGLE.

• If start is greater than the actual number of items in the listbox no items will be selected.

• If start + num_items is greater than the actual number of items in the listbox, items will be selected from position start through the last item in the listbox.

• If start is negative, then the first num_items + start items will be selected.

• If num_items is negative, no items will be selected.

ui_listbox_select_items ( listbox, start, num_items )

Description:

Select all items contained in the listbox.

Input:

widget listbox Listbox ID returned from the ui_listbox_create() call containing the items to be selected.

INTEGER start Starting position of items to select.

INTEGER num_items Number of items in listbox to select.

Output:

None.

Error Conditions:

None.

PCL and CustomizationUser Interface Functions

334

Comments:

This routine will work with listboxes created with a selection type of EXTENDED or MULTIPLE. It will not work with listboxes created with a selection type of BROWSE or SINGLE.

ui_list_select_nitems ( listbox, item_labels, start, num_items )

Description:

Select items specified in the listbox.

Input:

widget listbox Listbox ID returned from the ui_listbox_create() call containing the items to be deleted.

STRING ARRAY item_labels Array of item labels.

INTEGER start Starting position of item labels to select.

INTEGER num_items Number of item labels from start to select.

Output:

None.

Error Conditions:

None.

335Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

MENU Functions

The menu bar contains a horizontal grouping of menus. However, the menus listed within a menu bar are not displayed in their entirety. Instead, a menu label representing each menu is shown.

ui_listbox_unselectall ( listbox )

Description:

Unselect all items contained in the listbox.

Input:

widget listbox Listbox ID returned from the ui_listbox_create() call containing the items to be deleted.

Output:

None.

Error Conditions:

None.

ui_menu_create ( parent, callback, label, options )

PCL and CustomizationUser Interface Functions

336

Comments:

Menus are vertical groupings of item widgets. The size and number of items added to the menu widget determines the menu's size.

Description:

Create a menu widget.

Input:

widget parent Parent widget of a newly created widget. The parent must be a cascade_item or a menubar. The Patran menubar ID can be determined by calling menubar = uil_primary.get_menubar_id().

STRING callback Name of PCL function called for an event in this widget. The function must be in the class in which the widget is created. Use ““ if events in this widget are not of interest.

STRING label Label that will be displayed in menubar.

INTEGER options Optional argument defaults to 0. It can have a sum of the following values: MENU_IS_SWITCH(4) - Menu behaves like a switch.

MENU_HAS_NO_CB(8) - Each menu item has its own callback.

The optional argument values are defined in ui_options.p and it is required to include the file to access the options by the default names.

Output:

widget <Return Value> Menu widget ID. NULL if menu not created.

Error Conditions:

None.

337Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

MODAL FORM Functions

Forms are separate operating system windows that serve as backgrounds for widgets. They follow the OSF/Motif standard XmBulletinBoard type. They are enclosed by window manager borders. Two types of forms exist: forms and modal forms. See ui_form_create, 312 for information on forms.

ui_modalform_create ( name, x, y, position, width, height, [unused], options )

PCL and CustomizationUser Interface Functions

338

OPTION MENU Functions

According to OSF/Motif terminology, an option menu is defined as a class XmOptionMenu widget. An

Description:

Create a modal form widget.

Input:

STRING name Name of the modal form.

NUMERIC x X location of the form in inches relative to the screen.

NUMERIC y Y location of the form in inches relative to the screen.

STRING position Indicates which corners of the screen and modal form to use when measuring the x and y locations. Options include “UL”, “UR”, “LL”, and “LR”.

NUMERIC width Width of the modal form in inches.

NUMERIC height Height of the modal form in inches.

STRING [unused] Unused. Specify ““.

INTEGER options Optional argument defaults to 0. MODAL_LOC_ISFIXED(8) - Uses the location specified to position the modal dialog form. Without this option the form is placed centered at the mouse pointer location.

Output:

widget <Return Value> Modal form widget ID. NULL if modal form not created.

Error Conditions:

None.

ui_optionmenu_create ( parent, callback, x, y, label_length, label, label_above )

339Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

option menu is a vertical grouping of items; however, only one of the items is visible until the user clicks on the item.

Comments:

The PCL callback will be called when an option menu item is selected unless the selected item is the currently displayed option menu item.

Description:

Create a option menu widget.

Input:

widget parent Parent ID. Must be a frame, a window, a form or a modal form.

STRING callback Name of PCL function called for an event in this widget. The function must be in the class in which the widget is created. Use ““ if events in this widget are not of interest.

NUMERIC x X location in inches relative to the parent.

NUMERIC y Y location in inches relative to the parent.

NUMERIC label_length Length of the space between the beginning of the label and the option menu button. Used only if label_above is FALSE. If 0., the actual length of the label will be used.

STRING label Label to appear describing the option menu.

LOGICAL label_above TRUE if the label is to appear above the menu. FALSE if the label is to appear to the left of the menu.

Output:

widget <Return Value> Option menu widget ID. NULL if the option menu was not created.

Error Conditions:

None.

PCL and CustomizationUser Interface Functions

340

PERCENT COMPLETE Functions

Comments:

pcntcomplete_close is PCL, Fortran and C callable. The Fortran syntax is:

PCNTCOMPLETE_CLOSE( )

The C syntax is:

PcntcompleteClose( )

Comments:

pcntcomplete_init is PCL, Fortran and C callable. The Fortran syntax is:

PCNTCOMPLETE_INIT( MESSAGE )

pcntcomplete_close ( )

Description:

Remove the percent complete form from the screen.

Input:

None.

Output:

None.

Error Conditions:

None.

pcntcomplete_init ( message )

Description:

Display the percent complete form and assign the message to be displayed.

Input:

STRING[256]

message Message to be displayed describing the operation that is being performed.

Output:

None.

Error Conditions:

None.

341Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

The C syntax is:

PcntcompleteInit( message )

PERCENT COMPLETE Functions

Comments:

pcntcomplete_update is PCL, Fortran and C callable. The Fortran syntax is:

PCNTCOMPLETE_UPDATE( NEW_PCNT )

The C syntax is:

PcntcompleteInit( new_pcnt ).

The percent complete functions are to be used to indicate to the user that progress is being made. If the operation occurs too quickly (heaven forbid), it is possible for the X queue to receive the pcntcomplete_close call and therefore the instruction to hide the pcntcomplete form before the pcntcomplete_init call has had a chance to display the form. This will result in the inability to hide the form. For these operations, it is not necessary to use the pcntcomplete functions.

pcntcomplete_update (new_pcnt )

Description:

Update the value indicated in the slidebar in the percent complete form.

Input:

REAL new_pcnt The new value to be displayed. This value should be between 0. and 100., inclusive. If new_pcnt is less than 0., the UIMS will reassign the value to 0. If new_pcnt is greater than 100., the UIMS will reassign the value to 100. Although there is nothing stopping the PCL developer from counting from 100 to 0, it would be more intuitive to count up.

Output:

None.

Error Conditions:

None.

PCL and CustomizationUser Interface Functions

342

RING BELL Functions

POPUP MENU Functions

A popup menu bar contains a horizontal grouping of menus activated by clicking the right mouse button. However, the menus listed within a menu bar are not displayed in their entirety. Instead, a menu label representing each menu is shown.

ui_ring_bell (new_pcnt )

Description:

Rings bell.

Input:

None.

Output:

None.

Error Conditions:

None.

ui_c_popupmenu ( parent, callback, options )

343Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Comments:

Only tree widget entities currently support right mouse button to display popup menus. Use ui_item_create() to add items to the popup menu widget in the same manner you would for ui_menu_create(). The same for cascading menu items.

POPUP MENU Functions

Posts a previously created popup menu widget.

Description:

Create a menu widget.

Input:

widget parent Should be a NULL widget if popup menu is created. Should be a widget of type created using UI_CASCADEITEM_CREATE if submenu is created.

STRING callback Name of PCL function called for an event in this widget. The function must be in the class in which the widget is created. Use ““ if events in this widget are not of interest.

INTEGER options Optional argument defaults to 0. It can have a sum of the following values: MENU_IS_SWITCH(4) - Menu behaves like a switch.

MENU_HAS_NO_CB(8) - Each menu item has its own callback.

The optional argument values are defined in ui_options.p and it is required to include the file to access the options by the default names.

Output:

widget <Return Value> Menu widget ID. NULL if menu not created.

Error Conditions:

None.

ui_post_popupmenu ( wid )

PCL and CustomizationUser Interface Functions

344

Comments:

Where the popup menu appears is based on setting the X and Y positions of the popuup menu using UI_WID_SET() before making this call.

SCROLLFRAME Functions

The scroll frame can contain several widgets and text. To use a scroll frame, click on either of the horizontal or vertical scroll arrows to move the contents incrementally. Otherwise, click and drag either of the scroll bars to quickly move the scroll frame contents. Any applicable widget may be selected as long as it is in the visible portion of the scroll frame.

Description:

Create a menu widget.

Input:

widget wid The variable of type WIDGET created using UI_C_POPUPMENU().

Output:

widget <Return Value> None.

Error Conditions:

None.

ui_scrollframe_create (parent, callback, x, y, width, height, label, working_width, working_height, needstaticscrolls )

345Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Comments:

Description:

Create a frame widget that scrolls.

Input:

widget parent Parent widget ID of newly created widget. Must be form, modalform, or window.

STRING callback Name of PCL function called for an event in this widget. The function must be in the class in which the widget is created. Use ““ since frames are not registering events.

NUMERIC x X location of the scrollframe in inches relative to parent

NUMERIC y Y location of the scrollframe in inches relative to parent.

NUMERIC width Width of the scrollframe in inches.

NUMERIC height Height of the scrollframe in inches.

STRING label Label to appear describing the contents of the frame.

NUMERIC working_width Width of the scrollable area inside of the scrollframe on which widgets are placed, in inches.

NUMERIC working_height Height of the scrollable area inside of the scrollframe on which widgets are placed, in inches.

LOGICAL needstaticscrolls Optional argument defaults to TRUE. Set to FALSE, whenever scrolls are to be displayed only when required.

Output:

widget <Return Value> ID of the created scrollframe widget. NULL if the scrollframe is not created properly.

Error Conditions:

None.

PCL and CustomizationUser Interface Functions

346

Slidebars used for scrolling will be drawn as needed. Widgets placed inside of the scrollframe widget are positioned relative to the upper left corner of the scrollframe. Widgets positioned with an x or y value that is too large will only partially appear or will not be displayed at all.

SELECTDATABOX Functions

Although select databoxes fall into the same OSF/Motif widget class as databoxes, several differences exist. Visibly, a select databox and a databox look exactly alike; however, only the select databox, or a group of them, is surrounded by a select frame. See ui_selectframe_create, 351 for more details.

In terms of user input, a select databox has all of the features of a databox. In addition, it also allows mouse picking. See ui_databox_create, 306 for a complete description. Select databoxes are tightly linked to graphics windows in that they allow the selection of entities in a viewport if that data is relevant. If screen selection is appropriate, a select menu may appear on the bottom of the screen when the select databox is clicked, depending on the type of data expected in the select databox. See Screen Picking (p. 33) in the Patran Reference Manual for more details.

ui_scrollitem_setvisible (parent, item, lrMargin, tbMargin )

Description:

Make an invisible or partially visible scrollframe item visible.

Input:

widget parent Parent widget ID. Must be a scroll frame.

widget item Item widget ID. Must be a descendent of scroll frame parent.

INTEGER lrMargin Margin to use between left or right edge of the item and the associated edge of the parent.

INTEGER tbMargin Margin to use between top or bottom edge of the item and the associated edge of the parent.

Output:

None.

Error Conditions:

None.

ui_selectdatabox_create (parent, name, x, y, label_width, box_width, label, cvalue, label_above, datatype, prompt, pick_callback )

347Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Description:

Creates a select databox widget.

Input:

WIDGET parent Parent WIDGET ID. Must be a select frame.

STRING name Name of the data box. See widget Function Descriptions, 256 for more information.

NUMERIC x X location of the databox in inches relative to parent

NUMERIC y Y location of the databox in inches relative to parent.

NUMERIC label_width Used only if label_above is FALSE. Distance between the beginning of the label and the beginning of the box, in inches. If zero, the length of the label string will be used. Specifying the label_width is useful when lining up several databoxes.

NUMERIC box_width Width of the box in inches.

STRING label Displayed text describing the value associated with the databox. To have no label initially but plan on using ui_wid_set() to change the label, assign label to be “ “. If not assigning a label, use ““ and set label_above to FALSE.

STRING cvalue Value displayed inside the databox. This value is of the datatype specified.

LOGICAL label_above TRUE is the label is to be displayed above of the databox, FALSE if the label is to be displayed to the left of the databox.

STRING datatype Type of data to accept. For specific types, see Comments section.

STRING prompt The prompt that will appear in the text widget in the select menu when the select databox is expecting selecting to occur.

STRING pick_callback This argument is optional. Name of PCL function called for an event in this widget. The function must be in the class in which the widget is created. Use ““ if events for this widget are not of interest.

Output:

widget <Return Value> Widget ID. NULL if the widget could not be created.

PCL and CustomizationUser Interface Functions

348

Comments:

The PCL callback will be called when widget receives input focus, when the widget loses input focus, and when a carriage return (<CR>) is entered.

This function will accept any datatype, but selecting/picking will report an error if the datatype is not one of the following valid types:

Error Conditions:

None.

349Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

datatype string description

"ALL_SWEEP" Curves, surfaces, edges, faces, nodes, bar elements, 2D elements, edge elements, face elements

"ANY" Any entity; points, curves, surfaces, solids, coords, planes, vectors, nodes, elements, MPCs

"ANY_POINT" Points, geometry vertex, nodes

"ASM" ASM Menu; points, curves, surfaces, solids, coords, planes, vectors,

"BEAMELEM" Beam elements; bar elements

"CID" Coords

"CID1" Coord axis 1

"CID2" Coord axis 2

"CID3" Coord axis 3

"CONNECTOR" User entity

"CURVE" Curve Menu; curves

"CURVE_EDGE" Curves and edges; curves, geometry edges

"DECOMPSURF" Edges on surface, verticies on surface, points, points on decomposed surface

"DEF_NODE" Nodes

"DEF_POINT" Points, geometric verticies

"EDGE" Edges

"EDGEONSURFACE" Edges on surfaces

"ELEDGE" Element edges

"ELEDGE_BEAM" Bar element edges, element edges

"ELEDGE_FREE" Element edges, free element edges

"ELEM2D" 2D elements

"ELEM2_SWEEP" Nodes, bar elements, 2D elements, element edges

"ELEM3D" 3D elements

"ELEMENT" Elements

"ELEM_EDGE_2D" 2D element edges

"ELEM_EDGE_2D_FREE"

2D element edges, free element edges

"ELEM_NODE" Element node

"ELEM_SWEEP" Nodes, point elements, bar elements, 2D elements, element edges, element faces

"ELFACE" Element faces

PCL and CustomizationUser Interface Functions

350

"ELFACE_FREE" Element faces, free element faces.

"ELFACE_QUAD_TRI" Quad elements, Tria elements, element faces

"FACE" Geometry faces

"FEM" Nodes, elements, MPCs

"FEM_AND_GEO_0D" Points, point elements

"FEM_AND_GEO_1D" Curves, geometry edges, and bar elements

"FEM_AND_GEO_2D" Surfaces, geometry faces, 2D elements

"FEM_AND_GEO_3D" Solids, 3D elements

"FEM_SHELL_BNDRY" 2D element edges, element edges

"FRAME" Coordinate frames

"FREE_EDGE_ELEMS" 2D elements, 3D elements, element free edges

"FREE_FACE_ELEMS" 3D elements, element free faces

"FREE_FACE_SOLIDS" Geometric free faces, solids

"GEOMETRY" Curves, surfaces, solids, planes, vectors

"GEO_BEAM" Curves, geometric edges

"GEO_CURVE_EDGE" Curves, geometric edges

"GEO_FEATURES" Solids, surfaces, geometric faces, curve mask, geometric edges,

"GEO_SHELL" Surfaces, geometric faces

"GEO_SOLID" Geometric solid

"GEO_SOLID_BNDRY" Geometric faces

"GEO_SURFACE_FACE"

Surfaces, geometric faces

"GRID" Geometric points

"HEXELEM" Hex elements

"HPAT" Geometric solids

"LINE" Geometric curves

"MESH" Surfaces, solids, geometric edges, geometric faces, nodes, elements, MPCs

"MESH_SWEEP" Curves, surfaces, geometric edges, geometric faces

"MPC" MPCs

"NODE" Nodes

"PATCH" Surfaces

"PLANE" Planes

datatype string description

351Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

SELECTFRAME Functions

Select frames act as containers for one or more select databoxes. See ui_selectdatabox_create, 346. Select frames follow the OSF/Motif style “etched-out” frame.

Select frames can also have an attached toggle. This toggle will most often be the Auto Execute option. If a series of select databoxes is necessary for an application, then the Auto Execute function automatically advances the cursor to the next select databox as soon the previous one is filled if the select databox was filled using mouse selection. In some cases after all the select databoxes have been filled, Auto Execute may indicate to Patran to perform the function. In addition, partial data as it is input by the user will be immediately applied instead of waiting for a complete set of data before acting. Thus, if the Auto Execute option is used, the need for clicking the Apply button is eliminated.

"POINT" Points

"POINTELEM" Point elements

"POINTONNODE" Points on nodes

"POINT_VERTEX" Points, geometric verticies

"PTONCURVE" Points on curves

"PTONSURFACE" Points on decomposed surfaces

"QUADELEM" Quad elements

"SOLID" Solids

"SOLIDFACE_FREE" Geometric faces, geometric free faces

"SP" Screen points

"SURFACE" Surfaces

"SURFACE_EDGE" Surfaces edges

"SURFACE_FACE" Surfaces, geometric faces

"TETELEM" Tet elements

"TRIELEM" Tria elements

"TRIMSURFACE" Trimmed surfaces

"VECTOR" Vectors

"VERTEX" Geometric verticies

"VERTEXONSURFACE"

Verticies on surfaces

"WEDGEELEM" Wedge elements

ui_selectframe_create (parent, callback, x, y, width, height, label, recycle )

datatype string description

PCL and CustomizationUser Interface Functions

352

Description:

Create a select frame widget. This widget is used to visually and functionally group select databoxes.

Input:

widget parent Parent widget ID of newly created widget. Must be form.

STRING callback The callback function assigned will only be called when: (1) the toggle is set to ON, and (2) the last select databox in this select frame has just been filled with a list created using the select mechanism.

Typically, this callback will be the function called for the action button for a form.

NUMERIC x X location of the frame in inches relative to parent

NUMERIC y Y location of the frame in inches relative to parent.

NUMERIC width Width of the frame in inches.

NUMERIC height Height of the frame in inches.

STRING label Label of toggle describing the automatic traversal functionality. This toggle will indicate whether the select databoxes are to be automatically traversed. If the label is ““, the toggle will not be visible.

LOGICAL recycle TRUE if the first databox in the frame is to regain input focus after the last databox in the frame loses input focus otherwise focus remains in the last databox.

Output:

widget <Return Value> ID of the created frame widget. NULL if the frame is not created properly.

353Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Comments:

The toggle that indicates whether single or multiple select is to occur is currently disabled since the functionality to automatically move to the next selectdatabox is not present. Databoxes placed inside of the selectframe widget are positioned relative to the upper left corner of the frame.

Use ui_wid_set(widget_id, “TOGGLEVALUE”, FALSE) to turn the toggle to OFF if default ON is not desired.

Error Conditions:

None.

PCL and CustomizationUser Interface Functions

354

SEPARATOR Functions

Comments:

ui_separator_create (parent, name, x, y, length, horizontal )

Description:

Create a separator widget.

Input:

widget parent Parent widget ID of newly created widget. Must be a frame, a form, or a modal form.

STRING name Name of the separator.

NUMERIC x X location of the widget in inches relative to parent

NUMERIC y Y location of the widget in inches relative to parent.

NUMERIC length Length of the widget in inches.

LOGICAL horizontal TRUE if separator is horizontally oriented, FALSE if separator is vertically oriented.

Output:

widget <Return Value> Separator widget ID. NULL if widget is not created

Error Conditions:

None.

ui_set_fixedfont (wid )

Description:

Set the global fixed font for a widget.

Input:

widget wid Widget ID.

Output:

INTEGER <Return Value> 1 if successful, 0 if font is not set.

Error Conditions:

None.

355Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

This function will obtain the global fixed font specified using Patran.fixedFont resource in the Patran resource file, verify if the font exists on the X display server that Patran windows are shown, and then set the font resource for the widget.

SET FOCUS Functions

Comments:

When used in conjunction with select_focus.select_manager(), in the class display function will cause the select mechanism to immediately allow picking of graphical entities of the type specified if the widget is a select databox.

Example:

FUNCTION display /* * Enable the select menu for immediate picking */ select_focus.select_manager( /* widget */ entities_sdbox, @ /* datatype */ “ANY”, @ /* prompt */ “Input Entity IDs or “ // @ “pick a Select Menu Icon.” ) /* * Display the form */ ui_form_display( “uil_imaging_plot_erase” ) /* * Set the input focus on the selectdatabox for immediate typing */ ui_set_focus( entities_sdbox )

END FUNCTION /* display */

FUNCTION callback( treeWidget, event, callData, userData ) WIDGET treeWidget STRING event [] WIDGET callData STRING userData []

ui_set_focus (wid )

Description:

Set the input focus for a widget

Input:

widget wid Widget ID to set focus ON.

Output:

None.

Error Conditions:

None.

PCL and CustomizationUser Interface Functions

356

… END FUNCTION

SLIDEBAR Functions

Slide bars allow values to be increased by moving the slider to the right or decreased by moving the slider to the left.

Slide bars can be adjusted several ways. The slider may be dragged to a desired position with the mouse. Or, the slider may be repositioned to the cursor position by clicking the middle mouse button inside the slide bar. Remember that the terms “click” and “drag” mean to use the left mouse button unless otherwise noted. By clicking inside the slide bar, the slider will move toward the cursor by one default increment. Clicking and holding the left mouse button inside the slide bar will incrementally move the slide bar toward the cursor until the button is released.

Once a slide bar has focus, the arrow keys may be used to move the slider.

ui_slidebar_create (parent, callback, x, y, length, label, value, num_digits, horizontal, minlabel, maxlabel, show_value, minvalue, maxvalue )

357Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Comments:

The PCL callback will be called for either of the following events:

the user drags the slider, which instructs the UIMS to assign the string “DRAG” to be the second argument of the callback,

the user stops dragging the slider, which instructs the UIMS to assign the string “VALUE_CHANGED” to be the second argument of the callback, or

the user clicks in the slide area but not in the slider, which also instructs the UIMS to assign the string “VALUE_CHANGED” to be the second argument of the callback.

Description:

Create a slide bar widget.

Input:

widget parent Parent widget ID of newly created widget. Must be a frame, a form, or a modal form.

STRING callback Name of PCL function called for an event in this widget. The function must be in the class in which the widget is created. Use ““ if events for this widget are not of interest.

NUMERIC x X location of the widget in inches relative to parent

NUMERIC y Y location of the widget in inches relative to parent.

NUMERIC length Length of the widget in inches.

STRING label Label to appear describing the slidebar.

NUMERIC value Current value of the slidebar.

INTEGER num_digits Number of digits beyond the decimal to display.

LOGICAL horizontal TRUE if separator is horizontally oriented, FALSE if separator is vertically oriented.

STRING minlabel Label to appear at the minimum end of the slidebar.

STRING maxlabel Label to appear at the maximum end of the slidebar.

LOGICAL show_value TRUE if slidebar value is to be displayed adjacent to the slidebar value indicator.

NUMERIC minvalue Minimum value the slidebar will allow.

NUMERIC maxvalue Maximum value the slidebar will allow.

Output:

widget <Return Value> Slidebar widget ID. NULL if widget is not created.

Error Conditions:

None.

PCL and CustomizationUser Interface Functions

358

SPREADSHEET Functions

SPREADSHEET Functions

ui_spread_cell_delete (wid, col, row, lay )

Description:

Delete a spreadsheet cell

Input:

widget wid Spreadsheet widget ID.

INTEGER col Column number

INTEGER row Row number

INTEGER lay Layer number

Output:

widget <Return Value> Separator widget ID. NULL if widget is not created

Error Conditions:

None.

ui_spread_cells_delete (wid, fr_col, fr_row, to_col, to_row, lay )

Description:

Delete a block of spreadsheet cells

Input:

widget wid Spreadsheet widget ID.

INTEGER fr_col Starting column

INTEGER fr_row Starting row

INTEGER to_col Ending column

INTEGER to_row Ending row

INTEGER lay Layer

Output:

None.

Error Conditions:

None.

359Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

The spreadsheet is an MSC-developed widget.

The spreadsheet widget contains several features. It consists of rows and columns of cells with numerical values entered by the user. Each cell has an address designated by the row and column in which it resides. After entering data in a cell or multiple cells, the data may be manipulated in various ways. An entire row or column may be selected by clicking on its label. Or, an individual cell may be selected by clicking inside the cell. Also, multiple cells may be selected by dragging the mouse cursor over the desired cells.

ui_spread_create (parent, callback, x, y, width, height, label_width, num_vis_cols, num_cols, num_rows, num_layers, col_labels, row_labels, label, layer_label, layer_value_label, selection_type )

PCL and CustomizationUser Interface Functions

360

Description:

Creates a spreadsheet widget.

Input:

widget parent Parent widget ID of newly created widget. Must be a frame, a form, or a modal form.

INTEGER callback Name of PCL function called for an event in this widget. The function must be in the class in which the widget is created. Use ““ if events for this widget are not of interest.

NUMERIC x X location of spreadsheet in inches relative to the parent.

NUMERIC y Y location of spreadsheet in inches relative to the parent.

NUMERIC width Width of the spreadsheet in inches.

NUMERIC height Height of the spreadsheet in inches.

NUMERIC label_width Width of the row labels in inches.

INTEGER num_vis_cols Number of visible columns.

INTEGER num_cols Total number of columns.

INTEGER num_rows Total number of rows.

INTEGER num_layers Total number of layers.

STRINGARRAY col_labels 2D array of column labels, (columns, layers).

STRINGARRAY row_labels 2D array of row labels, (rows, layers).

STRING label Spreadsheet label.

STRING layer_label Layer databox label (for 3D).

361Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Comments:

Four different selection_type modes exist, as follows:

The PCL callback will be called when the user clicks on the cell display portion of the spreadsheet unless the selection_type has been set to “READONLY”.

A databox must accompany this widget if data entry, editing, and expansion of cell contents is needed. The application transfers data into and out of the spreadsheet using ui_spread_set_cell and ui_spread_get_cell and the callback information.

Clicking on a row or column label selects the entire row or column.

STRING layer_value_label Layer value databox label (for 3D).

STRING selection_type “SINGLE”, “ROWSELECT”, “EXTEND”, “READONLY”. See comments below.

Output:

widget <Return Value> Widget ID of spreadsheet widget. NULL if not created.

Error Conditions:

None.

SINGLE May pick only one cell. Dragging the mouse and picking labels has no effect.

ROWSELECT Picking a cell or label selects the entire row. Dragging the mouse has no effect. Used for the coupled listbox.

EXTEND Allows picking of more than one item by clicking each one separately. It will also toggle off previously highlighted items. The arrow keys highlight the items while the space bar selects and deselects them.

READONLY Cells are not pickable. Scrollbars are still active. No callback is called.

PCL and CustomizationUser Interface Functions

362

SPREADSHEET Functions

Comments:

One cell accessed at a time.

Comments:

ui_spread_get_cell ( widget_id, col, row, layer, value )

Description:

Get a spreadsheet cell.

Input:

widget widget_id Must be a spreadsheet.

INTEGER col Column to retrieve.

INTEGER row Row to retrieve.

INTEGER layer Layer to retrieve.

Output:

STRING value Value in cell.

Error Conditions:

None.

ui_spread_get_cell_info (widget_id, col, row, layer, value )

Description:

Gets a spreadsheet cell information dot.

Input:

widget widget_id Must be a spreadsheet.

INTEGER col Column to access.

INTEGER row Row to access.

INTEGER layer Layer to access.

Output:

LOGICAL value TRUE or FALSE if dot is set or not.

Error Conditions:

None.

363Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

The dot that shows up in the cell is used to signify that there is extra information associated with this cell. It is up to the programmer to store the structure containing this information. See ui_spread_set_cell_info (p. 369).

SPREADSHEET Functions

Comments:

This value is displayed in the layer value databox.

ui_spread_get_cell_length (widget_id, col, row, layer, length )

Description:

Gets the number of visible characters in a spreadsheet cell.

Input:

widget widget_id Must be a spreadsheet.

INTEGER col Column to retrieve.

INTEGER row Row to retrieve.

INTEGER layer Layer to retrieve.

Output:

INTEGER length Number of visible characters in cell.

Error Conditions:

None.

ui_spread_get_layer_value (widget_id, layer, value )

Description:

Gets a layer value from a 3D spreadsheet.

Input:

widget widget_id Must be a spreadsheet.

INTEGER layer Layer to requested.

Output:

STRING value Value of the given layer as displayed in the layer value databox.

Error Conditions:

None.

PCL and CustomizationUser Interface Functions

364

SPREADSHEET Functions

Comments:

See ui_spread_get_top_row, 365 to determine which rows are visible.

Comments:

The callback from ui_spread_create returns the same information. If the from and to values are the same, only one cell is selected (highlighted).

ui_spread_get_num_vis_rows (wid, num_vis_rows )

Description:

Get a spreadsheet number of visible rows.

Input:

widget wid Spreadsheet widget ID.

Output:

INTEGER num_vis_rows Number of visible rows.

Error Conditions:

None.

ui_spread_get_selected (widget_id, from_col, from_row, to_col, to_row, layer )

Description:

Retrieves the starting and ending column and row positions and layer for the currently selected (highlighted) cells of a given spreadsheet.

Input:

widget widget_id Must be a spreadsheet.

Output:

INTEGER from_col Starting column.

INTEGER from_row Starting row.

INTEGER to_col Ending column.

INTEGER to_row Ending row.

INTEGER layer Layer.

Error Conditions:

None.

365Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

SPREADSHEET Functions

ui_spread_get_top_row (widget_id, top_row )

Description:

Gets the top visible row number of a spreadsheet.

Input:

widget widget_id Must be a spreadsheet.

Output:

INTEGER top_row Row to get.

Error Conditions:

None.

PCL and CustomizationUser Interface Functions

366

Comments:

Add a row after the last row of the spreadsheet.

Comments:

The row numbers are counted from the first row altogether and NOT the first currently visible one in the spreadsheet. Hence the rows following the deleted one are decremented by one. The application needs to account for this when deleting multiple rows. For example, all rows can be deleted by deleting row 1 repeatedly.

ui_spread_row_create (widget_id, label )

Description:

Add a spreadsheet row.

Input:

widget widget_id Must be a spreadsheet.

STRING label Row label.

Output:

None.

Error Conditions:

None.

ui_spread_row_delete (widget_id, row_num )

Description:

Delete a spreadsheet row.

Input:

widget widget_id Must be a spreadsheet.

INTEGER row_num Row number to be deleted.

Output:

None.

Error Conditions:

None.

367Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Comments:

One cell is set at a time. If setting cell to the empty string, use ui_spread_cell_delete instead.

ui_spread_set_cell (widget_id, col, row, layer, value )

Description:

Sets a spreadsheet cell.

Input:

widget widget_id Must be a spreadsheet.

INTEGER col Column to access.

INTEGER row Row to access.

INTEGER layer Layer to access.

STRING value Value to be set.

Output:

None.

Error Conditions:

None.

PCL and CustomizationUser Interface Functions

368

SPREADSHEET Functions

Comments:

Improved performance over ui_spread_set_cell.

ui_spread_set_cells (wid, fr_col, fr_row, to_col, to_row, lay, values )

Description:

Set multiple spreadsheet cell contents.

Input:

widget widget_id Spreadsheet widget ID.

INTEGER fr_col Start column.

INTEGER fr_row Start row.

INTEGER to_col End column.

STRING to_row End row.

INTEGER lay Layer.

STRINGARRAY values Data to display in cells.

Output:

None.

Error Conditions:

None.

369Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Comments:

The dot that shows up in the cell is used to signify that there is extra information associated with this cell. It is up to the programmer to store the structure containing this information. See ui_spread_get_cell_info, 362.

ui_spread_set_cell_info (widget_id, col, row, layer, value )

Description:

Sets a spreadsheet cell information dot.

Input:

widget widget_id Must be a spreadsheet.

INTEGER col Column to access.

INTEGER row Row to access.

INTEGER layer Layer to access.

STRING value TRUE or FALSE to display or hide the dot.

Output:

None.

Error Conditions:

None.

PCL and CustomizationUser Interface Functions

370

SPREADSHEET Functions

ui_spread_set_display (parent, state )

Description:

Modify the display state of the spreadsheet.

Input:

widget parent Spreadsheet widget ID.

STRING state Determines the display characteristics of a spreadsheet:

“COL_ROW_LINE” - Draw heavy lines after the first row and column.

”COL_LINE” - Heavy line after first column.

“ROW_LINE”- Heavy line after first row.

““- Default (No heavy lines).

Output:

None.

Error Conditions:

None.

ui_spread_set_label (widget_id, col_row, index, layer, label )

Description:

Sets a spreadsheet column or row label.

Input:

widget widget_id Must be a spreadsheet.

INTEGER col_row 1 for col, 2 for row.

INTEGER index Column or row number.

INTEGER layer Layer to set.

STRING label Label to set.

Output:

None.

Error Conditions:

None.

371Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Comments:

The new label will be truncated if it is larger than the existing space for the labels.

SPREADSHEET Functions

Comments:

This value is displayed in the layer value databox.

ui_spread_set_layer_value (widget_id, layer, value )

Description:

Sets a layer value of a 3D spreadsheet.

Input:

widget widget_id Must be a spreadsheet.

INTEGER layer Layer to set.

STRING value Value to be set.

Output:

None.

Error Conditions:

None.

ui_spread_set_selected (widget_id, from_col, from_row, to_col, to_row )

Description:

Selects (highlights) the starting and ending column and row positions for the currently visible layer of a given spreadsheet.

Input:

widget widget_id Must be a spreadsheet.

INTEGER from_col Starting column.

INTEGER from_row Starting row.

INTEGER to_col Ending column.

INTEGER to_row Ending row.

Output:

None.

Error Conditions:

None.

PCL and CustomizationUser Interface Functions

372

SPREADSHEET Functions

Comments:

The new label will be truncated if it is larger than the existing space for the layer label.

SWITCH Functions

Switches exist in either a “regular” mode or an “always one” mode. Most switches are in the “always one” mode, which means that there is always one (and only one) switch item selected at all times. The “always one” switch items do not toggle on off as the “regular” switch items do to select/deselect items.

ui_spread_set_top_row (widget_id, top_row )

Description:

Sets the top visible row number of a spreadsheet.

Input:

widget widget_id Must be a spreadsheet.

INTEGER top_row Row to set.

Output:

None.

Error Conditions:

None.

ui_spread_set_value_label (widget_id, label )

Description:

In a 3D spreadsheet, sets a spreadsheet layer label.

Input:

widget widget_id Must be a spreadsheet.

STRING label Label to set.

Output:

None.

Error Conditions:

None.

ui_switch_create (parent, callback, x, y, num_cols, label, always_one )

373Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

One way to pick a switch item is to click on it with the mouse. To select a switch item, click anywhere inside its active area. (Switch items may be keyboard-selected using the arrow keys to move from one item to the next, then pressing the space bar.)

Comments:

Description:

Creates a switch widget.

Input:

widget parent Parent widget ID. Must be a frame or a form.

STRING callback Name of PCL function called for an event in this widget. The function must be in the class in which the widget is created. Use ““ if events for this widget are not of interest.

NUMERIC x X location of switch in inches relative to parent

NUMERIC y Y location of switch in inches relative to parent.

INTEGER num_cols Number of columns of items the switch is to have (see Comments section below).

STRING label Displayed text to describe switch.

LOGICAL always_one TRUE if one item in switch must always be ON. FALSE if it is allowable to have no items selected.

Output:

widget <Return Value> Widget ID of switch widget. NULL if not created.

Error Conditions:

None.

PCL and CustomizationUser Interface Functions

374

Items in switches are organized vertically. A switch contains an arbitrary number of item widgets. Only one of the item widgets may be set to ON at any given time; setting an item ON automatically sets all other items for the switch OFF. If always_one is set to FALSE, clicking on an ON item will set it to OFF.

The num_cols parameter does not work intuitively for most values. Motif takes the number of switch items, divides it by num_cols, truncates any remainder and adds one if a remainder was truncated. The resulting value is used as the number of rows. The items are then added to the switch in row-major format. For example, if num_cols is three and four switch items are supplied, the end will be:

1. item 1item 3

2. item 2item 4

The PCL callback will be called when a switch item is selected.

TEXT Functions

The textbox is mostly for informational read-only use. However, some textboxes allow the user to input data when appropriate. If the amount of text exceeds the available visible space, use the scroll bar to vertically scroll through the material.

ui_text_create (parent, callback, x, y, width, num_rows, label, text, editable, needHScroll)

375Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

TOGGLE Functions

A toggle can only be in one of two states: “TRUE” or “FALSE.” To reverse a toggle’s state, click anywhere in its active area. (If a toggle has focus, the space bar may be used to toggle its value.)

Description:

Create a text widget.

Input:

widget parent Parent of the text widget. Must be a frame, a form, a modalform, or a window.

STRING callback Name of PCL function called for an event in this widget. The function must be in the class in which the widget is created. Use ““ since text widgets do not register events.

NUMERIC x X location of widget in inches relative to parent

NUMERIC y Y location of widget in inches relative to parent.

NUMERIC width Width of the widget, in inches.

INTEGER num_rows Number of rows that will contain the text.

STRING label Label to appear with the text widget.

STRING text Text string to initially appear in the widget. Include “\n” in the string to indicate a newline.

LOGICAL editable TRUE if the user is allowed to edit the text.

LOGICAL needHScroll TRUE if horizontal scrollbar is required. Optional and defaults to FALSE.

Output:

widget <Return Value> Text widget ID. NULL if text not created.

Error Conditions:

None.

ui_toggle_create (parent, callback, x, y, label)

PCL and CustomizationUser Interface Functions

376

Comments:

The PCL callback function will be called when the user clicks on the toggle.

TOGGLEICON Functions

Description:

Creates a toggle widget.

Input:

widget parent Parent widget ID. Must be a frame, a form, or a modalform.

STRING callback Name of PCL function called for an event in this widget. The function must be in the class in which the widget is created. Use ““ if events for this widget are not of interest.

NUMERIC x X location of toggle in inches relative to parent

NUMERIC y Y location of toggle in inches relative to parent.

STRING label Label describing toggle.

Output:

widget <Return Value> Toggle widget ID. NULL if toggle widget not created.

Error Conditions:

None.

ui_toggleicon_create (parent, callback, x, y, icon)

377Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Description:

Creates a toggleicon widget.

Input:

widget parent Parent widget ID. Must be a frame, a form, or a modalform.

STRING callback Name of PCL function called for an event in this widget. The function must be in the class in which the widget is created. Use ““ if events for this widget are not of interest. The first space character in the name/callback signifies that the rest of the string value is the pop-up help for the icon, and delimits the preceding string without the space as the name/callback of the widget.

NUMERIC x X location of toggle in inches relative to parent

NUMERIC y Y location of toggle in inches relative to parent.

STRING icon Name of the icon to display describing the toggle.

Output:

widget <Return Value> Toggleicon widget ID. NULL if toggleicon widget not created.

Error Conditions:

None.

PCL and CustomizationUser Interface Functions

378

Tree Widget Functions

Example:

The PCL function “callback” must be defined as shown in the example below.

FUNCTION callback( treeWidget, event, callData, userData )WIDGET treeWidgetSTRING eventWIDGET callDataSTRING userData…END FUNCTION

Where:

TreeWidget is the ID of the tree widget that caused the callback event can be one of the following:

EXPANDEDCOLLAPSEDSELCHANGED

userdata is the string data set with the ui_wid_set with “CALLBACKDATA” as the parameter.

callData is the information pertaining to the event that triggered this callback. Note that this data is transient and is not valid once the callback returns. It can be queried using ui_tree_calldata_get_count and ui_tree_calldata_get_items (described below) before the call returns to get the affected items.

ui_tree_create ( parent, callback, x, y, width, height, label, selection_type, options )

Description:

creates a tree view widget

Input:

widget parent Parent form or frame containing this tree widget

STRING callback Name of the PCL function called for an event in this widget.

REAL x

REAL y

REAL width

REAL height

STRING label

STRING selection_type One of SINGLE, BROWSE, MULTIPLE, EXTEND

INTEGER options Optional and defaults to 0.

Output:

INTEGER <Return Value> ID of the widget created. NULL if creation fails.

379Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

ui_tree_calldata_get_count

(callData, event, itemCount )

Description:

Retrieves the item count related to the callback from the tree widget

Input:

widget callData This is the callData argument passed to the callback

STRING reason one of the following EXPANDED, COLLAPSED, SELECTED or UNSELECTED

Output:

INTEGER itemCount number of items that changed their state

ui_tree_calldata_get_items (callData, event, itemCount, items )

Description:

Retrieves the items related to the callback from the tree widget

Input:

widget callData This is the callData argument passed to the callback

STRING event one of the following EXPANDED, COLLAPSED, SELECTED or UNSELECTED

Output:

INTEGER itemCount size of the items array

INTEGER ()

items virtual array to hold the items that changed their state

INTEGER <Return Value> Number of items returned in items array.

>=0 number items

-1 event parameter is not valid

-2 not enough memory to return the items.

ui_tree_add_item ( treeWidget, parent, insertAfter, name, image, selectedImage )

PCL and CustomizationUser Interface Functions

380

Description:

adds an item to the tree widget

Input:

widget treeWidget

INTEGER parent

INTEGER insertafter ID of the item after which the item will be inserted into the tree

=0 item is inserted as the first item of the parent

= -1 item is appended to the parent

>0 ID of the sibling item after which the new item is inserted

if this ID is not a child of the parent then the behavior is undefined.

String label

INTEGER image

INTEGER selectedImage

Output:

INTEGER <Return Value> ID of the item created. 0 if creation fails.

381Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

ui_tree_add_items ( treeWidget, parent, insertAfter, name, image, selectedImage, nitems )

Description:

adds an item to the tree widget

Input:

widget treeWidget

INTEGER nitems

INTEGER() parent

INTEGER() insertafter

String[]() label

INTEGER() image

INTEGER() selectedImage

Output:

INTEGER <Return Value> ID of the last item created. nitems items are created with this return value being the ID of the last item. Return value of 0 indicates failure.

ui_tree_delete_item ( treeWidget, itemToDelete )

Description:

deletes an item from the tree.

Input:

widget treeWidget

INTEGER itemToDelete

Output:

logical <Return Value> TRUE if no error.

ui_tree_delete_items ( treeWidget, nitems, itemsArray)

Description:

deletes an item from the tree.

Input:

PCL and CustomizationUser Interface Functions

382

widget treeWidget

INTEGER nitems

INTEGER() itemsArray

Output:

logical <Return Value> TRUE if no error.

383Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

ui_tree_select_item ( treeWidget, itemToSelect, selectionFlag )

Description:

selects/deselects an item in the tree.

Input:

widget treeWidget

INTEGER itemToSelect

LOGICAL selectionFlag TRUE indicates selection FALSE indicates deselection

Output:

logical <Return Value> TRUE if no error.

ui_tree_select_items ( treeWidget, itemsArray, nitems, selectionFlag )

Description:

selects/deselects multiple items from the tree.

Input:

widget treeWidget

INTEGER() itemsArray

INTEGER nitems

LOGICAL selectionFlag TRUE indicates selection FALSE indicates deselection

Output:

logical <Return Value> TRUE if no error.

ui_tree_select_node ( treeWidget, nodeToSelect, selectionFlag )

Description:

selects/deselects a node and all its children in the tree.

Input:

widget treeWidget

INTEGER nodeToSelect

LOGICAL selectionFlag TRUE indicates selection FALSE indicates deselection

Output:

logical <Return Value> TRUE if no error.

PCL and CustomizationUser Interface Functions

384

ui_tree_expand_item ( treeWidget, itemId, expandOrCollapse)

Description:

expands/collapse an item (that has children) in the tree.

Input:

widget treeWidget

INTEGER nodeToSelect

LOGICAL expandOrCollapse TRUE indicates expansion FALSE indicates collapse

Output:

logical <Return Value> TRUE if no error.

ui_tree_add_image ( treeWidget, imageFile )

Description:

add an image to a tree.

Input:

widget treeWidget

STRING imageFile Name of the file containing the icon data.

Output:

INTEGER <Return Value> ID of the created image.

ui_tree_delete_image ( treeWidget, imageId )

Description:

delete an image from a tree.

Input:

widget treeWidget

INTEGER imageId ID of the image obtained from ui_tree_add_image.

Output:

LOGICAL <Return Value> TRUE if image was successfully deleted.

ui_treeitem_set_image ( treeWidget, itemId, imageId, selectedImageId )

385Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Description:

set images for a tree item.

Input:

widget treeWidget

INTEGER itemId ID of the item for which images are to be set.

INTEGER imageId ID of the image to display in unselected state.

INTEGER selectedImageId ID of the image to display in selected state.

Output:

LOGICAL <Return Value> TRUE if images were successfully modified.

PCL and CustomizationUser Interface Functions

386

ui_treeitem_set_label ( treeWidget, itemId, label )

Description:

sets the label for a tree item.

Input:

widget treeWidget

INTEGER itemId ID of the item for which images are to be set.

STRING label text to be displayed.

Output:

LOGICAL <Return Value> TRUE if the label was successfully modified.

ui_treeitem_get_image ( treeWidget, itemId, imageId, selectedImageId )

Description:

get images for a tree item.

Input:

widget treeWidget

INTEGER itemId ID of the item for which images are to be set.

Output:

INTEGER imageId ID of the image to display in unselected state.

INTEGER selectedImageId ID of the image to display in selected state.

LOGICAL <Return Value> TRUE if images were successfully obtained.

ui_treeitem_get_label ( treeWidget, itemId, label, length )

Description:

Obtains the label for a tree item.

Input:

widget treeWidget

INTEGER itemId ID of the item for which label needs to be returned.

INTEGER length size of label string

Output:

387Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

STRING label text displayed.

LOGICAL <Return Value> TRUE if the label was successfully obtained.

PCL and CustomizationUser Interface Functions

388

ui_treeitem_is_selected ( treeWidget, itemId )

Description:

returns whether a tree item is selected

Input:

widget treeWidget

INTEGER itemId ID of the item for which the information is desired.

Output:

LOGICAL <Return Value> TRUE if the item is selected FALSE if the item is not selected or does not exist.

ui_treeitem_is_ expanded ( treeWidget, itemId )

Description:

returns whether a tree item is expanded or collapsed.

Input:

widget treeWidget

INTEGER itemId ID of the item for which the information is desired.

Output:

LOGICAL <Return Value> TRUE if the item is expanded. FALSE if the item is collapsed or has no children or does not exist.

ui_tree_set_selection ( treeWidget, itemIds, itemCount )

Description:

replaces the selected items in the tree with the input list

Input:

widget treeWidget

INTEGER() itemIds

INTEGER temCount

Output:

logical <Return Value> TRUE if no error.

389Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

ui_tree_get_selection ( treeWidget, itemIds, itemCount )

Description:

obtains the list of currently selected items in the tree

Input:

widget treeWidget

Output:

INTEGER() itemIds virtual array to hold the items

INTEGER itemCount

logical <Return Value> TRUE if no error. FALSE if failed to allocate memory.

ui_tree_clear_selection ( treeWidget )

Description:

clears selection. All items in the tree are unselected after this call

Input:

widget treeWidget

Output:

None.

ui_treeitem_get_parent ( treeWidget, itemId )

Description:

gets the ID of the parent of the item

widget treeWidget

INTEGER itemId ID of the item for which parent needs to be returned.

Output:

INTEGER <Return Value> ID of the parent item. –1 if itemId is invalid.

ui_treeitem_get_child_count

( treeWidget, itemId )

PCL and CustomizationUser Interface Functions

390

VERIFY NAME Functions

Description:

gets the number of children of the item

widget treeWidget

INTEGER itemId ID of the item for which parent needs to be returned.

Output:

INTEGER <Return Value> number of immediate children of the item. –1 if itemId is invalid.

ui_treeitem_get_children ( treeWidget, itemId, childIds, childCount )

Description:

gets the ids of the child items of the given parent item

widget treeWidget

INTEGER itemId ID of the item for which parent needs to be returned.

Output:

INTEGER() childIds virtual array to hold the child items

INTEGER childCount

LOGICAL <Return Value>

TRUE if no error. FALSE if failed to allocate memory.

391Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

ui_verify_name (name)

PCL and CustomizationUser Interface Functions

392

Description:

Verify whether the given name has the syntax for a valid name.

Input:

STRING name Name to verify.

Output:

INTEGER <Return Value> = 0 if name is valid.

= 1 if name is too long.

= 2 if name contains white space.

= 3 if name contains a illegal char.

= 4 if name is NULL or ““.

Error Conditions:

None.

393Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

WIDGET Functions

Comments:

Removes the widget from memory and destroys it. To delete and destroy a form, modal form, or window use ui_form_delete instead.

ui_wid_delete (wid)

Description:

Delete and destroy the widget.

Input:

widget wid Widget to delete and destroy.

Output:

None.

Error Conditions:

None.

ui_wid_exists (widget)

Description:

Determine whether the given widget exists.

Input:

widget widget Widget whose existence is to be queried.

Output:

LOGICAL <Return Value> TRUE if widget exists, FALSE if not.

Error Conditions:

None.

PCL and CustomizationUser Interface Functions

394

WIDGET Functions

Comments:

The datatype of the return value must be that of the widget's parm. For example, for a call to:

ui_wid_get (button, “ENABLE”, logical_variable)

the third argument must be declared as a logical. For the call

ui_wid_get (button, “NAME”, string_variable)

the third argument must be declared as a string.

Possible parm names:

Button parameters:

ui_wid_get (widget, parm, value)

Description:

Get the value of a widget parameter.

Input:

widget widget Widget whose value is to be queried.

STRING parm Name of parameter. Upper or lower case is permitted.

Output:

SEE BELOW value Value of parameter.

LOGICAL <Return Value> TRUE, if no error.

Error Conditions:

None.

395Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Cascade Item parameters::

Color Bar parameters:

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if this widget is to be displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

REAL HEIGHT Height of the widget.

STRING LABEL String that appears in the button.

STRING NAME Name of the widget.

REAL WIDTH Width of the widget.

REAL X X location of widget.

REAL y Y location of widget.

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if this widget is to be displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

STRING ACCELERATOR Accelerator key to drop the menu.

STRING LABEL Text to be displayed.

STRING NAME Name of the widget.

STRING MNEMONIC Key mnemonic to drop the menu.

PCL and CustomizationUser Interface Functions

396

Color Menu parameters:

Databox and Selectdatabox parameters:

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if this widget is to be displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

INTEGER(2) ITEMCOLOR Item color of the widget. The ui_wid_set or ui_wid_get call must be passed an array of size two. The first element of the carry should contain the item number. On a call to ui_wid_set the second element of the array should contain the index of the color desired. A call to the function ui_wid_get will return the color index in the second element.

INTEGER CURRENTITEM Currently depressed color button of the colorbar.

INTEGER NITEMS Number of color buttons in the colorbar.

STRING LABEL Label of the accompanying label widget. Returns a null string if colorbar is not created with a label.

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if this widget is displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

INTEGER COLOR Color of the widget.

STRING LABEL Label of the accompanying label widget.Returns a null string if colorbar is not created with a label.

397Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

File parameters:

Data Type Parameter Name Description

INTEGER COLUMNS Width of the widget as the number of visible characters. Valid only for databoxes.

STRING DATATYPE Name of the type of data that will be accepted by the databox.

LOGICAL DISPLAY or VISIBLE TRUE if this widget is to be displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

FILTER_ENTITY Valid only for selectdataboxes.

REAL HEIGHT Height of the widget.

STRING LABEL Label of the accompanying label widget.

INTEGER MAXNUMCHARS Maximum number of characters that can appear in a databox. Valid only for databoxes.

STRING NAME Name of the widget.

INTEGER NUMCHARS Number of characters in the databox. Valid only for databoxes.

INTEGER NUMVALS Number of reals or integers that are in the databox. Valid only for databoxes.

STRING PROMPT Prompt to appear in the select menu when the selectdatabox has focus. Valid only for selectdataboxes.

LOGICAL READONLY TRUE if the databox can not be edited. Valid only for databoxes.

LOGICAL SINGLESELECT TRUE if the selectdatabox should not allow multiple picking. Valid only for selectdataboxes.

LOGICAL UNSELECT FALSE if all text is to be selected.

(type defined by the databox's datatype)

VALUE Current value of the databox.

LOGICAL WIDSETNOTIFY TRUE if the widget’s callback will be called for a ui_wid_set(..., “VALUE”,...) call.

REAL WIDTH Width of the widget.

REAL X X location of widget.

REAL Y Y location of widget.

PCL and CustomizationUser Interface Functions

398

Form and Modalform parameters:

Frame, Scrollframe, and Selectframe parameters:

Data Type Parameter Name Description

STRING DIRECTORY Directory path.

LOGICAL DISPLAY or VISIBLE TRUE if the widget is to be displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

STRING FILENAME Name of the file to appear in the file databox.

STRING FILTER Value of the directory filter.

STRING FILTERPATH Value of the filter databox.

REAL HEIGHT Height of the widget.

STRING NAME Name of the widget.

REAL WIDTH Width of the widget.

REAL X X location of widget.

REAL Y Y location of widget.

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if this widget is currectly displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

REAL HEIGHT Height of the widget.

STRING LABEL Label to appear in the banner of the form.

STRING NAME Name of the widget.

REAL WIDTH Width of the form.

REAL X X location of form.

REAL Y Y location of form.

399Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Item parameters:

Label parameters:

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if the frame’s children are displayed.

LOGICAL ENABLE TRUE if frame’s children are selectable.

REAL HEIGHT Height of the widget.

STRING LABEL Label accompanying the frame.

STRING NAME Name of the widget.

LOGICAL TOGGLEVALUE Valid only for selectframes.

REAL WIDTH Width of the widget.

WORKINGHEIGHT Valid only for scrollframes.

WORKINGWIDTH Valid only for scrollframes.

REAL X X location of widget.

REAL y Y location of widget.

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if widget is currently displayed. Invalid for listbox items.

CHAR ACCELERATOR Character used with the <control> key to assign the item’s accelerator. Invalid for listbox items.

LOGICAL ENABLE TRUE if this widget is selectable. Not valid for listbox items.

STRING LABEL String describing the item.

CHAR MNEMONIC Character used to enable the item’s mnemonic. Invalid for listbox items.

STRING NAME Name of the widget.

LOGICAL VALUE Value of the widget. Invalid for menu bar items and menu items which are not toggles.

PCL and CustomizationUser Interface Functions

400

Listbox parameters:

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if this widget is to be displayed.

LOGICAL ENABLE TRUE if the label is in bold print.

REAL HEIGHT Height of the widget.

STRING LABEL Text to be displayed. Valid only for widgets created with ui_label_create.

STRING NAME Name of the widget.

REAL WIDTH Width of the widget.

REAL X X location of widget.

REAL y Y location of widget.

401Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Menu and Popup Menu parameters:

Data Type Parameter Name Description

STRING BOTTOMITEM Label of the item to appear at the bottom of the listbox.

INTEGER BOTTOMPOS Number of the item to appear at the bottom of the listbox.

LOGICAL DISPLAY or VISIBLE TRUE if this widget is to be displayed.

LOGICAL DEFAULTEVENT TRUE if the recent callback was due to a Return or Enter key pressed when selection type is “SINGLE”.

LOGICAL DUPLICATEITEM TRUE if this listbox allows items having the same value to appear more than once.

LOGICAL ENABLE TRUE if this widget is selectable.

REAL HEIGHT Height of the widget.

STRING ARRAY

ITEMS All items in the listbox whether selected or not selected.

STRING LABEL Label to describe the listbox.

STRING NAME Name of the widget.

INTEGER NITEMS Number of items in widget.

INTEGER NSELECTED Number of items selected in widget.

INTEGER ROWS Number of rows that can be visible in the displayed listbox.

STRING SELECTIONTYPE “SINGLE”, “MULTIPLE”, “BROWSE”, “EXTEND”, or “READONLY”.

STRING TOPITEM Label of the item to appear at the top of the listbox.

STRING ARRAY

VALUE Selected items of the widget.

REAL WIDTH Width of the widget.

REAL X X location of widget.

REAL Y Y location of widget.

PCL and CustomizationUser Interface Functions

402

Menubar parameters:

Optionmenu parameters:

Popup Menu parameters:

See Menu and Popup Menu parameters:, 401.

Selectdatabox parameters:

See Databox and Selectdatabox parameters:, 396.

Separator:

Data Type Parameter Name Description

LOGICAL ENABLE TRUE if this widget is selectable.

STRING LABEL Label of the menu.

INTEGER MNEMONIC Character that assigns the mnemonic to the menu.

REAL X X location of popup menu.

REAL y Y location of popup menu.

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if the widget is to be displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if this widget is displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

STRING LABEL Label of the optionmenu.

STRING NAME Name of the optionmenu.

STRING VALUE Currently displayed name of the optionmenu.

REAL X X location of widget.

REAL y Y location of widget.

403Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Slidebar parameters:

Spreadsheet:

Switch parameters:

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if this widget is displayed.

REAL HEIGHT Height of the widget.

REAL WIDTH Width of the widget.

REAL X X location of widget.

REAL y Y location of widget.

Data Type Parameter Name Description

INTEGER DECPOINTS Number of digits to appear after the decimal point. Used only when show_value (see ui_slidebar_create, 356) is TRUE.

LOGICAL DISPLAY or VISIBLE TRUE if the widget is to be displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

REAL HEIGHT Height of the widget.

STRING LABEL Label of the slidebar.

STRING MAXLABEL Label at the upper end of the slidebar.

STRING MINLABEL Label at the lower end of the slidebar.

STRING NAME Name of the widget.

REAL VALUE Value of the widget.

REAL WIDTH Width of the widget.

REAL X X location of the widget.

REAL Y Y location of the widget.

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if the widget is to be displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

STRING LABEL Label of the spreadsheet.

INTEGER NITEMS Number of rows in spreadsheet widget

PCL and CustomizationUser Interface Functions

404

Text:

Toggle parameters:

Data Type Parameter Name Description

INTEGER COLUMNS Number of columns of items that the switch should contain.

LOGICAL DISPLAY or VISIBLE TRUE if this widget is to be displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

STRING LABEL Label of the widget.

STRING NAME Name of the widget.

STRING VALUE Name of the item that is currently on.

REAL X X location of the widget.

REAL Y Y location of the widget.

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if this widget is displayed.

LOGICAL EDITABLE TRUE if the user can type in the widget.

LOGICAL ENABLE TRUE if this widget is selectable.

REAL HEIGHT Height of the widget.

INTEGER MAXNUMCHARS Maximum number of characters that can be entered into the widget.

STRING NAME Name of the widget.

INTEGER NUMCHARS Number of characters in the text box.

INTEGER POSITION Location of the insertion bar in the text box.

STRING VALUE Text that appears in the widget.

REAL WIDTH Width of the widget.

REAL X X location of the widget.

REAL Y Y location of the widget.

405Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Window parameters:

WIDGET Functions

Comments:

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if this widget is to be displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

STRING LABEL Label that describes the toggle.

STRING NAME Name of the widget.

LOGICAL VALUE Value of the widget.

REAL WIDTH Width of the widget.

REAL X X location of the widget.

REAL Y Y location of the widget.

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if this widget is currently displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

REAL HEIGHT Height of the widget.

STRING LABEL String to appear in the window’s namestripe.

STRING NAME Name of the window.

REAL WIDTH Width of the widget.

REAL X X location of the widget.

REAL Y Y location of the widget.

ui_wid_get_vstring (widget, parm, vstr )

Description:

Get the value of a widget's string parameter and return the value in a virtual string.

Input:

widget widget Widget whose value is to be queried.

STRING parm Name of parameter. Upper or lower case is permitted

Output:

STRING [VIRTUAL] vstr Value of string parameter.

Error Conditions:

None.

PCL and CustomizationUser Interface Functions

406

All parameter names from ui_wid_get() that return a string are valid.

Comments:

Used to keep the contents of widgets up-to-date when events occur which might change the information displayed on a form. Normally ui_wid_refresh is called at the end of a callback which adds, modifies or removes an entity from the database.

The refresh function in a class should update the contents of the displayed widgets which might change from actions on unrelated forms.

WIDGET Functions

Comments:

The widget values restored are those last saved using the ui_wid_save function. If used in conjunction with a ui_form_hide(), do the hide first, then the restore, to avoid flicker.

ui_wid_refresh ( )

Description:

Calls the refresh function for all classes with forms currently visible.

Input:

None.

Output:

None.

Error Conditions:

None.

ui_wid_restore (class_name )

Description:

Restores the values of all of the widgets in the class class_name to the values assigned due to the last call to ui_wid_save (class_name).

Input:

STRING class_name Name of the form’s class.

Output:

LOGICAL <Return Value> TRUE if no error.

Error Conditions:

None.

407Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Comments:

The widget values saved using this function can be restored back into the form using ui_wid_restore. If used in conjunction with a ui_form_hide(), do the hide first, then the save, to avoid flicker.

WIDGET Functions

Remarks:

ui_wid_save (class_name )

Description:

Saves the values of all of the widgets in the class class_name.

Input:

STRING class_name Name of the form’s class.

Output:

LOGICAL <Return Value> TRUE if no error.

Error Conditions:

None.

ui_wid_set (widget_id, parameter_name, parameter_value)

Description:

This function will set a widget parameter value.

Input:

widget widget_id This value specifies the identifier of the widget that will be modified.

STRING parameter_name[]

This value specifies the name of the parameter to be modified. See below for more information.

DYNAMIC_ILRS parameter_value This value specifies the array of flags used to identify the specific entity types to be exported. See the remarks below for more information.

Output:

LOGICAL <Return Value> This function returns a value of TRUE when executed successfully and a non TRUE value to indicate a change in status or an error.

Error Conditions:

This function may return a nonzero value if an error occurs.

PCL and CustomizationUser Interface Functions

408

The data type of the input value parameter_value must match the data type specified for the input value paramter_name as listed in the tables below. The parameter names that can be used and the functions used to create the widgets with which they can be used are listed in the tables below.

Button parameters:

Cascade Item parameters:

Color Bar parameters:

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if this widget is to be displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

REAL HEIGHT Height of the widget.

STRING LABEL Text to be displayed.

STRING NAME Name of the widget.

REAL WIDTH Width of the widget.

REAL X X location of widget.

REAL y Y location of widget.

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if this widget is to be displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

STRING ACCELERATOR Accelerator key to drop the menu.

STRING LABEL Text to be displayed.

STRING NAME Name of the widget.

STRING MNEMONIC Key mnemonic to drop the menu.

409Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Color Menu parameters:

Databox and Selectdatabox parameters:

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if this widget is displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

INTEGER(2) ITEMCOLOR Item color of the widget. The ui_wid_set or ui_wid_get call must be passed an array of size two. The first element of the carry should contain the item number. On a call to ui_wid_set the second element of the array should contain the index of the color desired. A call to the function ui_wid_get will return the color index in the second element.

INTEGER CURRENTITEM Currently depressed color button of the colorbar.

INTEGER NITEMS Number of color buttons in the colorbar.

STRING LABEL Label of the accompanying label widget. Invalid if colorbar is not created with a label.

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if this widget is to be displayed.

INTEGER COLOR Color of the widget.

STRING LABEL Label of the accompanying label widget. Invalid if colorbar is not created with a label.

REAL WIDTH Width of the widget.

REAL HEIGHT Height of the widget.

PCL and CustomizationUser Interface Functions

410

File Parameters:

See the ui_file_create, 309 function description for more information.

Data Type Parameter Name Description

STRING APPENDVALUE Append the string onto the current value.

INTEGER COLUMNS Width of the widget as the number of visible characters. Valid only for databoxes.

STRING DATATYPE Name of the type of data that will be accepted by the databox.

LOGICAL DISPLAY or VISIBLE TRUE if this widget is to be displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

FILTER_ENTITY Valid only for selectdataboxes.

REAL HEIGHT Height of the widget.

STRING LABEL Label of the databox.

INTEGER MAXNUMCHARS Upper limit of characters allowed in the databox. Valid only for databoxes.

STRING NAME Name of the widget.

STRING PROMPT Prompt to be displayed when the selectdatabox has focus and if the datatype displays a selection menu. Valid only for selectdataboxes.

READONLY Valid only for databoxes.

LOGICAL SINGLESELECT Used only for selectdataboxes. TRUE for the selectdatabox if only one pick is to appear in the selectdatabox.

LOGICAL UNSELECT FALSE if all text is to be selected.

(type defined by the databox's datatype)

VALUE Current value of the databox.

LOGICAL WIDSETNOTIFY TRUE if the callback function is to be called for ui_wid_set calls.

REAL WIDTH Width of the widget.

REAL X X location of widget.

REAL Y Y location of widget.

411Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Data Type Parameter Name Description

STRING CANCELBUTTONLABEL This value specifies the text used to label the “Cancel” button. See the input value cancel_label in the ui_file_create() function description for more information.

STRING DIRECTORY This value specifies the path which is used together with the filter mask specified with the input variable parameter_name value FILTER to determine which files and directories are displayed in the form. See the parameter_name value FILTERPATH for more information. See the input value filter_mask in the ui_file_create() function description for more information.

LOGICAL ENABLE This value specifies, when set to TRUE, that the file form can be selected, is active, and can be used for input. If this value is set to FALSE, the form will be grayed out and cannot be selected and used for input.

STRING FILENAME This value specifies a file name to be displayed in the selection databox. If the file name specified is listed in the file list box the file list box entry will be highlighted. See the input value file_name in the ui_file_create() function description for more information.

STRING FILENAMELABEL This value specifies the text used on the form to describe the selection databox. See the input value selection_label in the ui_file_create() function description for more information.

STRING FILESLABEL This value specifies the text used on the form to describe the files databox. See the input value files_label in the ui_file_create() function description.

STRING FILTER This value specifies the filter mask which is used together with the path specified with the input variable parameter_name value DIRECTORY to determine which files and directories are displayed in the form. See the parameter_name value FILTERPATH for more information.See the input value filter_mask in the ui_file_create() function description for more information.

STRING FILTERBUTTONLABEL This value specifies the text used to label the “Filter” button. See the input value filterbutton_label in the ui_file_create() function description.

PCL and CustomizationUser Interface Functions

412

Form and modalform parameters:

STRING FILTERLABEL This value specifies the title used on the form to describe the filter databox. See the input value filter_label in the ui_file_create() function description.

STRING FILTERPATH This value sets the path and filter mask value in the filter databox and determines what will be displayed in the directory and files databoxes. This parameter_name value combines the operations of the parameter_name values DIRECTORY and FILTER. See the input value filter_mask in the ui_file_create() function description for more information.

REAL HEIGHT This value specifies the height of the widget in inches, excluding the border.

STRING NAME This value specifies the name of the PCL function that will be called for an event representing a form event. This call back function must be a member of the class in which the ui_file_create() widget is created. See the input value callback_func in the ui_file_create() function description for more information.

STRING OKBUTTONLABEL This value specifies the text used to label the “OK” button. See the input value ok_label in the ui_file_create() function description for more information.

STRING WIDTH This value specifies the width of the widget in inches, excluding the border. See the input value width in the ui_file_create() function description for more information.

REAL X This value specifies the x axis location of the file widget in inches relative to the upper left corner of the parent widget. See the input value x_location in the ui_file_create() function description for more information.

REAL Y This value specifies the y axis location of the file widget in inches relative to the upper left corner of the parent widget. See the input value y_location in the ui_file_create() function description for more information.

413Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Frame, Scrollframe, and Selectframe parameters:

Item parameters:

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if this widget is currently displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

REAL HEIGHT Height of the widget.

STRING LABEL Label to appear in the banner of the form.

STRING NAME Name of the widget.

REAL WIDTH Width of the widget.

REAL X X location of widget.

REAL y Y location of widget.

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if the frame’s children that have been specifically left ON via a ui_wid_set() are to be displayed.

LOGICAL DISPLAYALL or VISIBLEALL

TRUE if the frame’s children are to be displayed regardless of whether the children have been displayed or hidden via a ui_wid_set().

LOGICAL ENABLE TRUE if frame’s children are to be selectable.

REAL HEIGHT Height of the widget.

STRING LABEL String to appear above the frame.

STRING NAME Name of the widget.

LOGICAL TOGGLEVALUE Valid only for selectframes.

REAL WIDTH Width of the widget.

WORKINGHEIGHT Valid only for scrollframes.

WORKINGWIDTH Valid only for scrollframes.

REAL X X location of widget.

REAL y Y location of widget.

PCL and CustomizationUser Interface Functions

414

Label parameters:

Listbox parameters:

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if widget is currently displayed. Invalid for listbox items.

CHAR ACCELERATOR Specifies CRTL<char> sequence to invoke item. Item need not be visible for accelerator to work. Invalid for listbox items.

LOGICAL ENABLE TRUE if this widget is selectable. Not valid for listbox items.

STRING ICON Name of the icon used in lieu of the label. See ui_itemicon_create, 326.

STRING LABEL Text to be displayed.

CHAR MNEMONIC Specifies key to invoke item. Item must be visible for mnemonic to work. Only valid for menu items.

STRING NAME Name of the widget.

LOGICAL VALUE Value of the widget. Invalid for menu bar items.

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if this widget is to be displayed.

LOGICAL ENABLE TRUE if the label is in bold print.

REAL HEIGHT Height of the widget.

STRING ICON Name of the icon to be displayed in lieu of the label. Valid only for widgets created with ui_labelicon_create.

STRING LABEL Text to be displayed.

STRING NAME Name of the widget.

REAL WIDTH Width of the widget.

REAL X X location of widget.

REAL y Y location of widget.

415Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Menu and Popup Menu parameters:

Menubar parameters:

Data Type Parameter Name Description

STRING BOTTOMITEM Label of the item that is to be the bottom visible item.

INTEGER BOTTOMPOS Number of the items to appear at the bottom of the listbox.

LOGICAL DISPLAY or VISIBLE TRUE if this widget is to be displayed.

LOGICAL DUPLICATEITEM TRUE if this listbox allows items having the same value to appear more than once.

LOGICAL ENABLE TRUE if this widget is selectable.

REAL HEIGHT Height of the widget.

STRING LABEL Label to describe the listbox.

STRING NAME Name of the listbox.

INTEGER ROWS Number of rows that can be visible in the displayed listbox.

STRING SELECTIONTYPE Selection type of the listbox. “SINGLE”, “MULTIPLE”, “BROWSE”, “EXTEND”, or “READONLY”.

STRING TOPITEM Label of the item that is to be the top visible item.

STRING ARRAY

VALUE Selected items of the widget.

REAL WIDTH Width of the widget.

REAL X X location of widget.

REAL Y Y location of widget.

LOGICAL UNSELECT FALSE if all items are to be selected.

Data Type Parameter Name Description

LOGICAL ENABLE TRUE if this widget is selectable.

STRING LABEL Label of the menu.

CHAR MNEMONIC Specifies key to invoke menu.

REAL X X location of popup menu widget.

REAL y Y location of popup menu widget.

PCL and CustomizationUser Interface Functions

416

Optionmenu parameters:

Popup Menu parameters:

See Menu and Popup Menu parameters:, 415.

Selectdatabox parameters:

See Databox and Selectdatabox parameters:, 409.

Separator:

Slidebar parameters:

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if this widget is to be displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if this widget is to be displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

STRING LABEL Label of the optionmenu.

STRING NAME Name of the optionmenu.

STRING VALUE Currently displayed item label of the optionmenu.

REAL X X location of widget.

REAL y Y location of widget.

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if this widget is displayed.

REAL HEIGHT Height of the widget.

REAL WIDTH Width of the widget.

REAL X X location of widget.

REAL y Y location of widget.

417Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Spreadsheet:

Switch parameters:

Data Type Parameter Name Description

INTEGER DECPOINTS Number of digits to appear after the decimal point. Used only when show_value (see ui_slidebar_create, 356) is TRUE.

LOGICAL DISPLAY or VISIBLE TRUE if the widget is to be displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

STRING LABEL Text to be displayed.

STRING MAXLABEL Label at the upper end of the slidebar.

REAL MAXVALUE Maximum allowable value.

STRING MINLABEL Label to appear at the lower end of the slidebar.

REAL MINVALUE Minimum allowable value.

STRING NAME Name of the widget.

REAL VALUE Value of the widget.

REAL X X location of the widget.

REAL Y Y location of the widget.

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if the widget is currently displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

STRING LABEL Main label to be displayed with the widget.

LOGICAL UNSELECT TRUE to unselect all cells. FALSE does nothing.

PCL and CustomizationUser Interface Functions

418

Text:

Toggle parameters:

Data Type Parameter Name Description

INTEGER COLUMNS Number of columns of items that the switch should contain.

LOGICAL DISPLAY or VISIBLE TRUE if this widget is to be displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

STRING LABEL Label to be displayed with the widget.

STRING NAME Name of the widget.

STRING VALUE Name of the item that is currently on. If “NONE”, all switch items will be turned OFF.

REAL X X location of the widget.

REAL Y Y location of the widget.

Data Type Parameter Name Description

STRING APPENDVALUE String to append onto the current value.

LOGICAL DISPLAY or VISIBLE TRUE if the widget is currently displayed.

LOGICAL EDITABLE TRUE if the user may alter the text value.

LOGICAL ENABLE TRUE if this widget is selectable.

REAL HEIGHT Height of the widget.

INTEGER MAXNUMCHARS Maximum number of characters that can be contained in the widget.

STRING NAME Name of the widget.

INTEGER POSITION Location of the insertion bar in the text box.

LOGICAL UNSELECT FALSE if all text is to be selected.

STRING VALUE Text that appears in the widget. To include a newline character, place “\n” in the string.

REAL WIDTH Width of the widget.

REAL X X location of the widget.

REAL Y Y location of the widget.

419Chapter 5: User Interface and List Processor FunctionsUser Interface Functions

Window parameters:

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if this widget is currently displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

STRING ICON Name of icon to be used, valid only when created with ui_toggleicon_create.

STRING LABEL Text to be displayed to describe the toggle.

STRING NAME Name of the widget.

LOGICAL VALUE Value of the widget.

REAL WIDTH Width of the widget.

REAL X X location of the widget.

REAL Y Y location of the widget.

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if this widget is currently displayed.

LOGICAL ENABLE TRUE if this window is selectable.

REAL HEIGHT Height of the widget.

STRING LABEL String to appear in the window’s banner.

STRING NAME Name of the window.

REAL WIDTH Width of the widget.

REAL X X location of the widget.

REAL Y Y location of the widget.

PCL and CustomizationUser Interface Functions

420

Chapter 6: Creating New Analysis Forms Using PCLPCL and Customization

6 Creating New Analysis Forms Using PCL

Introduction 2

Updating Patran Release 1.1 Analysis Forms 3

Naming Convention 4

The Analysis PCL Library 5

Contents of the Analysis Library 6

The Main Analysis Form 7

Main Analysis Form Functions 9

PCL and CustomizationIntroduction

422

IntroductionIn the previous chapter, we learned that the forms of many applications within Patran change depending upon analysis code specific definitions stored within the database. In this section we will see that the forms under Analysis are also analysis code specific. But, instead of being dependent upon analysis code specific definitions stored within the database, they are governed by PCL functions contained within a special PCL library called <analysis_code>.plb. For user defined analysis interfaces, it is the user’s responsibility to create the PCL functions needed to govern the Analysis forms for his interface and compile them into the <analysis_code>.plb library.

Then Analysis functions contained in <analysis_code>.plb have three basic responsibilities:

They control the appearance and behavior of the main Analysis form.

They control any subordinate forms or functions.

They activate the requested application once the Apply button on the main Analysis form is selected.

423Chapter 6: Creating New Analysis Forms Using PCLUpdating Patran Release 1.1 Analysis Forms

Updating Patran Release 1.1 Analysis FormsThe top level architecture of the Analysis forms has drastically changed between Patran release 1.2 and the current release. Despite this change, it should be very simple to convert Patran release 1.1 Analysis forms to this new architecture. Only two steps need be taken.

1. Delete your <analysis_code>_enabler and <analysis_code>_set_options PCL classes.

2. Create an <analysis_code>_load_aom_data class which explicitly calls out each of your subordinate Analysis forms and functions.

There might be slight differences in behavior between the main Analysis form of the 1.1 release and the current main Analysis form. If you dislike these changes, you should be able to convert back to the 1.1 style of behavior by using the functions described in this chapter.

We hope the expanded flexibility and power of our new Analysis forms counterbalances any inconveniences that this change may have created.

PCL and CustomizationNaming Convention

424

Naming ConventionThe names of the Analysis PCL library, <analysis_code>.plb, and the class which must exist in this library, <analysis_code>_load_aom_data, are derived from the analysis code name. Also, the mandatory functions within the <analysis_code>_load_aom_data PCL class (<analysis_type>_ are derived from the name of the available analysis types. The following rules should be used to convert the analysis code name or analysis code name or analysis type name to the <analysis_code> or <analysis_type> prefix.

1. Convert all alpha characters within the analysis code or analysis type name to lower case.

2. Replace any occurrence of “p3/” (as in Patran FEA) with “p.”

3. Remove any non alphanumeric characters including blanks.

For example, the prefix for “MSC.Nastran” is mscnastran,” for “Structural,” “structural,” and for “John Code,” “johncode.” This derived prefix is referenced in this chapter as either <analysis_code> or <analysis_type>.

It is recommended that the user add a unique prefix to all his PCL classes and class-less functions in order to ensure uniqueness in class and function name. For example, if the user were to create a PCL class which controlled selecting a file for an analysis code called “John Code” a good class name would be “john_select_file.” Just using “select_file” as the name might interfere with already existing Patran PCL classes or functions.

425Chapter 6: Creating New Analysis Forms Using PCLThe Analysis PCL Library

The Analysis PCL LibraryWhen an analysis code is selected as the current analysis code, Patran closes the Analysis PCL library of the previously selected analysis code and opens the Analysis library of the newly selected code. This library should contain all the PCL functions needed to control the Analysis forms for the chosen analysis code. The expected name of the library is <analysis_code>.plb. The entire Patran file path will be searched for this library. The Analysis libraries for the MSC supplied analysis interfaces (MSC Nastran, MSC.Marc, etc.) are delivered in the $P3_HOME directory.

The Analysis PCL libraries will be automatically removed and added by Patran. This is done using the sys_library ( ) PCL function. See System Functions, 188. For this reason, the Analysis PCL libraries should not be added explicitly by the user: not by the !!LIBRARY directive, not by an explicit sys_library ( ) call, not within any of the initialization files, such as “init.pcl,” and not through the command line.

If Patran is unable to locate the Analysis library, the analysis code may not be selectable on the Analysis Preference form, or the Analysis pick on the main form may be ghosted, or no forms will appear when Analysis is selected. If the Analysis library cannot be found or if the wrong Analysis library has been found, the safest course of action is to rectify the problem, exit Patran and start back up again. If the Analysis library does not exist or is deficient, create or modify this PCL library before exiting Patran. If the analysis library cannot be found, expand the Patran file path to include the location of the library or move the library to a location along the file path. If you have multiple Analysis libraries and the second library is taking precedence over the desired library, move the desired library to a higher location in the file path or change the file path to give precedence to the location of the desired library. The path changes can be added to an initialization file such as init.pcl or can be typed directly into the command line. Both the path changes and file location changes require exiting Patran and should occur before opening the Patran database in the re-started Patran session.

We maintain separate PCL libraries for the Analysis PCL functions simply because there are as many versions of the Analysis functions as there are analysis interfaces to Patran and placing every version within the p3patran.plb library would make it unnecessarily large and slow.

For more on creating PCL libraries, refer to Libraries, 28 and Directives, 9. For details about modifying the Patran file path refer to Path Directive, 29 and PCL Start-Up File, 35.

PCL and CustomizationContents of the Analysis Library

426

Contents of the Analysis LibraryAs a minimum, the Analysis library should contain one PCL class called <analysis_code>_load_aom_data. The <analysis_code>_load_aom_data class must contain as many functions as there are analysis types related to the current analysis code and the name of each of these functions is <analysis_type>. For example, if the analysis code “ANSYS” has two analysis types, “Structural” and “Thermal,” then the PCL library “anays.plb” must contain the PCL class, “ansys_load_aom_data” and this class must contain two functions called “structural” and “thermal”.

Of course, the Analysis library will most likely contain many more functions than the minimum set mentioned above. Most of the time the <analysis_code>_load_aom_data class will reference a PCL class, <apply_class>, which will contain the “apply” function activated by the Apply button on the main Analysis form and the Analysis functions. All subordinate Analysis forms will be controlled by PCL classes which exist in the Analysis library. Any PCL application code, such as the actual application, if written in PCL, or functions which will gather data for an external application, prepare Patran for an external application (such as close the database, if necessary) and spawn the external application program, should exist in the Analysis library.

427Chapter 6: Creating New Analysis Forms Using PCLThe Main Analysis Form

The Main Analysis FormThe main Analysis form is controlled by two PCL classes, “analysis_main” and <analysis_code>_load_aom_data. “analysis_main” is a generic class contained within the p3patran.plb library. The <analysis_code>_load_aom_data class is analysis code specific and resides in the <analysis_code>.plb library. “analysis_main” is not modifiable by the user. For MSC supplied analysis interfaces, such as Patran MSC Nastran or MSC.Marc, the <analysis_code>_load_aom_data class is not modifiable, whereas for user defined analysis interfaces, it is the user’s responsibility to create this class and place it into the Analysis library.

There are many levels of communication between the main Analysis form and the subordinate Analysis forms and functions. This communication will be discussed in detail in the following sections.

PCL and CustomizationThe Main Analysis Form

428

429Chapter 6: Creating New Analysis Forms Using PCLMain Analysis Form Functions

Main Analysis Form Functions

Changing the AppearanceIt is not always necessary to use “ui_wid_set” to modify the main Analysis form. The following function allows the user to automatically hide many items on the main Analysis form.

Changing the Behavior

The following calls allow the user to modify certain aspects of the way the main Analysis form works. Since the main Analysis form is refreshed every time an action-object change occurs, these calls must be repeated every time the action-object selection is changed.

Normally, the “analysis_main” class will commit all changes to the database (using “db_commit”) whenever the main Analysis form’s Apply button is selected. To prevent this from happening, the user can call the function described below.

analysis_main.set_display_flags (<job_frame_display>, <button_frame_display>, <separator_display>, <apply_button_display>)

Input:

None.

Output:

LOGICAL <job_frame_display> A flag specifying whether the job name / job description frame should be displayed (TRUE) or not (FALSE).

LOGICAL <button_frame_display> A flag specifying whether the button frame should be displayed (TRUE) or not (FALSE).

LOGICAL <separator_display> A flag specifying whether the separator widget should be displayed (TRUE) or not (FALSE).

LOGICAL <apply_button_display> A flag specifying whether the Apply button should be displayed (TRUE) or not (FALSE).

Error Conditions:

None.

Note: For the same reasons mentioned above, this call should be made every time an action-object change occurs.

PCL and CustomizationMain Analysis Form Functions

430

Also, after the Apply button is selected, the “analysis_main” class automatically updates the job name databox and list box. To prevent this from happening, the user can call “dont_update_on_apply”. This call is especially needed if the user’s application closes the Patran database without re-opening it.

If the user wishes to make the job name and job description databoxes un-editable, so that the user can only specify job names via the job name list box, then he should make the following call. This is useful whenever the action-object selection requires choosing an already existing job. An example of such an action-object combination would be “Delete” - “Job”.

To set the job name and job description databoxes to blank, use the function described below.

To load the job name databox with a new job name, use the “load_job_name_dbox” function.

analysis_main.dont_commit_on_apply ()

Input:

None.

Output:

LOGICAL <job_frame_display> A flag specifying whether the job name / job description frame should be displayed (TRUE) or not (FALSE).

LOGICAL <button_frame_display> A flag specifying whether the button frame should be displayed (TRUE) or not (FALSE).

LOGICAL <separator_display> A flag specifying whether the separator widget should be displayed (TRUE) or not (FALSE).

LOGICAL <apply_button_display> A flag specifying whether the Apply button should be displayed (TRUE) or not (FALSE).

Error Conditions:

None.

analysis_main.dont_update_on_apply ()

analysis_main.disable_jobname_and_description ()

analysis_main.set_jobname_blank ()

431Chapter 6: Creating New Analysis Forms Using PCLMain Analysis Form Functions

The function described below will place the name of the “current” job into the job name databox. The “current” job is defined as the last job created or as the name of the Patran database (with the .db suffix removed) if no jobs exist.

The user can force the job name listbox to be refreshed with the following function.

analysis_main.load_job_name_dbox ()

Input:

STRING <job_name> The name of the job to be loaded in the job name databox.

Output:

None.

Error Conditions:

None.

analysis_main.set_jobname_current ()

analysis_main.refresh_jobname_listbox ()

PCL and CustomizationMain Analysis Form Functions

432

<analysis_code>_load_aom_dataThis PCL class dictates the appearance and some of the behavior of the main Analysis form. It specifies the number of action-object-method combinations are valid, what the names for these options are, the number of buttons which exist for each action-object combination and which PCL classes will be activated by these buttons. This class must exist within the Analysis library and must contain as many functions as there are analysis types for the current analysis code. The names of these functions are derived from the names of the analysis types in the manner described in the previous Naming Convention section. For example, if an analysis code has two valid analysis types, “Structural” and “Thermal”, then the two necessary functions would be “structural” and “thermal”. The argument list for each of these functions is as follows.

<analysis_type> ( <num_actions>, <action_labels>, <num_objects>, <object_labels>, <num_methods>, <method_labels>, <num_buttons>, <button_labels>, <button_callbacks>, <apply_class>, <callback_diagnostics>)

Input:

None.

Output:

INTEGER <num_actions> The number of actions valid for this analysis code / analysis type combination. The maximum number of actions allowed is 20.

STRING ARRAY

<action_labels> An array of <num_actions> strings containing the names of all the actions.

INTEGER ARRAY

<num_objects> A <num_actions> array containing the number of objects for each action. There must be at least one object per every action, but the name of this object can be blank. The maximum number of objects allowed per any action is 20.

STRING ARRAY

<object_labels> A <num_actions>*max( <num_objects> ) array containing all the names of the objects per the chosen action.

INTEGER ARRAY

<num_methods> A <num_actions>*max( <num_objects> ) array containing the number of methods valid for every action-object combination. Methods are optional. The maximum number of methods allowed for any action-object combination is 20.

STRING ARRAY

<method_labels> A <num_actions>*max( <num_objects> ) *max(<num_methods> ) array containing the names of all the methods per action and object.

433Chapter 6: Creating New Analysis Forms Using PCLMain Analysis Form Functions

The <analysis_code>_load_aom_data classes for MSC supplied analysis interfaces are not modifiable by the user. For user defined analysis interfaces, it is the user’s responsibility to create this required class and place it into the Analysis library.

Below is an example of an <analysis_code>_load_aom_data function for analysis code “John Code”, analysis type “Structural”. This example is delivered to all users, it is called johncode_loud_aom_data.pcl and resides in the $P3_HOME/customization directory. The steps needed to create a “John Code” Analysis library are as follows:

INTEGER ARRAY

<num_buttons> A <num_actions>*max( <num_objects> ) array containing the number of buttons for every action-object combination. Buttons are optional. The maximum number of buttons allowed for a action-object combination is 10, but only 5 or 6 buttons can Be placed on the main Analysis form at a given time before the form becomes too large for the computer screen.

STRING ARRAY

<button_labels> A <num_actions>*max( <num_objects> )*max( <num_buttons> ) array containing all the button labels per action and object.

STRING ARRAY

<button_callbacks> A <num_actions>*max( <num_objects> )*max (<num_buttons> ) array containing the names of the PCL classes to be activated when the button is selected. Button callbacks are optional; they may be blank.

STRING <apply_class> The name of the PCL class which contains the “apply” function activated by the Apply button on the main Analysis form. This class is optional; it may be blank.

LOGICAL <callback_diagnostics> A flag specifying if all Analysis function calls made by the “analysis_main” class should be echoed to the command line (TRUE) or not (FALSE). Set this flag to TRUE during development in order to debug or just to get a better understanding of the interactions between the main Analysis form and the Analysis functions.

Error Conditions:

None.

Note: 1. As seen is the example below, the size of argument arrays or strings should not be explicitly stated in the <analysis_type> function so that compatibility is maintained with the “analysis_main” class regardless of the dimensions used in “analysis_main”. In other words, declare the argument <object_labels> listed above as “STRING object_labels[]()” instead of “STRING object_labels[31](20,20)”.

2. All string arguments listed in the above call have a maximum of 31 characters.

PCL and CustomizationMain Analysis Form Functions

434

1. Start Patran.

2. Type the following command into the command line: “COMPILE ($P3_HOME)/customization/johncode_load_aom_data.pcl INTO johncode.plb”.

The brackets around $P3_HOME signify that you must type in the evaluation of “$P3_HOME,” such as “/patran/patran3,” instead of typing in “$P3_HOME.” PCL does not directly support UNIX environmental variables.

/* $Header: /madrid/users9/pflib/pcl/custom/RCS/johncode_load_aom_data.pcl,v 1.1 92/12/11 20:55:13 sprack Exp Locker: sprack $ */

/*$$h */ /* * Purpose: * Define the option menu selections, button labels, and * button pcl classes for John Code. */

CLASS johncode_load_aom_data

/*---------------------------------------------------------------------*$$ FUNCTION structural * * Purpose: * Load the option menu data for "John Code-Structural". */

FUNCTION structural( num_actions, action_items, @ num_objects, object_items, @ num_methods, method_items, @ num_buttons, button_labels, @ button_callbacks, preference_class, @ callback_diagnostics ) /* * Local declarations: */ INTEGER num_actions STRING action_items[]() INTEGER num_objects() STRING object_items[]() INTEGER num_methods() STRING method_items[]() INTEGER num_buttons() STRING button_labels[]() STRING button_callbacks[]() STRING preference_class[] LOGICAL callback_diagnostics*$$ FUNCTION structural * * Purpose: * Load the option menu data for "John Code-Structural". */

FUNCTION structural( num_actions, action_items, @ num_objects, object_items, @ num_methods, method_items, @ num_buttons, button_labels, @ button_callbacks, preference_class, @ callback_diagnostics ) /* * Local declarations: */ INTEGER num_actions

435Chapter 6: Creating New Analysis Forms Using PCLMain Analysis Form Functions

STRING action_items[]() INTEGER num_objects() STRING object_items[]() INTEGER num_methods() STRING method_items[]() INTEGER num_buttons() STRING button_labels[]() STRING button_callbacks[]() STRING preference_class[] LOGICAL callback_diagnostics/* * Define the Actions, Objects and Methods. Note that at least * one actions must exist and for every action, one object * must exist. Methods are optional. */

num_actions = 3 action_items(1) = ~Analyze”

action_items(2) = "Read Results File" action_items(3) = "Read Input File"

num_objects(1) = 2 num_objects(2) = 1 num_objects(3) = 1

object_items(1,1) = "Entire Model" object_items(1,2) = "Current Group" object_items(2,1) = "Results Entities" object_items(3,1) = "Model Data"

num_methods(1,1) = 3 num_methods(1,2) = 3 num_methods(2,1) = 1 num_methods(3,1) = 1

method_items(1,1,1) = "Full Run" method_items(1,1,2) = "Check Run" method_items(1,1,3) = "Input File Only" method_items(1,2,1) = "Full Run" method_items(1,2,2) = "Check Run" method_items(1,2,3) = "Input File Only" method_items(2,1,1) = "Translate" method_items(3,1,1) = "Translate"/* * Define the number of buttons for each action-object * combinations. Then define the button labels and * callbacks. */ num_buttons(1,1) = 3 num_buttons(1,2) = 3 num_buttons(2,1) = 2 num_buttons(3,1) = 2 button_labels(1,1,1) = "Button One" button_labels(1,1,2) = "Button Two" button_labels(1,1,3) = "Button Three" button_labels(1,2,1) = "Button One" button_labels(1,2,2) = "Button Two" button_labels(1,2,3) = "Button Three" button_labels(2,1,1) = "Button One" button_labels(2,1,2) = "Button Two" button_labels(3,1,1) = "Button One" button_labels(3,1,2) = "Button Two" button_callbacks(1,1,1) = " " button_callbacks(1,1,2) = " " button_callbacks(1,1,3) = " " button_callbacks(1,2,1) = " " button_callbacks(1,2,2) = " " button_callbacks(1,2,3) = " " button_callbacks(2,1,1) = " "

PCL and CustomizationMain Analysis Form Functions

436

button_callbacks(2,1,2) = " " button_callbacks(3,1,1) = " " button_callbacks(3,1,2) = " "/* * Define the class for general button functions, such as * the "apply" function. */ preference_class = " "

callback_diagnostics = FALSE

END FUNCTION /* structural */

END CLASS /* johncode_load_aom_data */

437Chapter 6: Creating New Analysis Forms Using PCLMain Analysis Form Functions

Subordinate Analysis Forms and FunctionsBelow we see a subordinate Analysis form which is activated by selecting the “Solution Type” button on the main Analysis form and whose function is to allow the user to choose a solution type.

As described above, buttons on the main Analysis form are associated with PCL classes via the <analysis_code>_load_aom_data PCL class. Once a button on the main Analysis form is selected, the “display” function of the associated class is called. If a subordinate Analysis form is open when the action-object selection on the main Analysis form is modified or the main Analysis form is closed, the “exit” function of that form’s associated class is called.

When a subordinate Analysis form is closed by anyone other than the main Analysis form, such as by the Cancel button on the subordinate form, the following call should be made.

This call keeps the “analysis_main” class aware of which subordinate forms are open and which are closed so that when re-entering a given action-object combination “analysis_main” will know which forms were left open, and should thus be re-displayed, and which forms were closed.

There are other optional calls to the “analysis_main” class which will allow the subordinate functions and forms to gather data from the main Analysis form or in some way alter the behavior of the main Analysis form. These functions are described in the “analysis_main” section.

For more details about creating PCL forms, refer to The PATRAN Command Language (PCL) Introduction. For more details about PCL and PCL functions, refer to User Interface and List Processor Functions.

analysis_main.button_class_closed ( <associated_class>)

Input:

STRING <associated_class> The name of the class whose form is being closed.

Output:

None.

Error Conditions:

None.

PCL and CustomizationMain Analysis Form Functions

438

The <apply_class> ClassThe name of this class is defined in the PCL function <analysis_code>_load_aom_data.<analysis_type>. The purpose of this class is to capture events from the main Analysis form. None of the functions listed in this section are mandatory. In fact, the <apply_class> reference in the PCL function <analysis_code>_load_aom_data.<analysis_type> can be left blank.

The most important event to be captured is the main Analysis form’s Apply button being selected. When this happens, the “apply” function of <apply_class> is called. Typically this “apply” function will activate the PCL functions of the user application which will either directly perform the task at hand or spawn an external program to perform this task.

Another event which is trapped is the choosing of a job name from the job name list box. Once a job name has been selected from the list box, but prior to its being placed into the job name databox, the “jobname_about_to_change” function of <apply_class> is called. Once the newly selected job name is placed into the job name databox, the “jobname_was_selected” function is called.

When the main Analysis form is opened for the first time after a Patran database is opened, the “database_was_just_opened” function of <apply_class> is called.

When the current analysis code or analysis type is changed, the “preference_was_just_changed” function of <apply_class> is called. This function is not called when a Patran database with a different analysis code preference from the previous database is opened. It is only called when the analysis preference is changed after a database has been opened.

When the action-object-method selection on the main Analysis form is changed, the “option_menu_changed” function of <apply_class> is called. After the action-object-method change is completed, the “option_menu_change_is_done” function is called. If the action-object combination changed (versus only a change in the method), then two more functions are called: “hide_user_defined_widgets” and “display_user_defined_widgets.” These last two functions allow the user control over subordinate Analysis forms which are not directly affected by events on the main Analysis form will be automatically “exit”ed and re-displayed when an action-object change occurs. Other Analysis forms need to be exited and redisplayed explicitly by the user. This is most conveniently done in “hide_user_defined_widgets” and “display_user_defined_widgets.” Closing and opening of the main Analysis form and a change in analysis preference are also considered to be action-object-method changes. So, whenever any of these three events occur the four functions described in this paragraph will be called.

Similar to the specialized “display” and “exit” calls of a PCL class, all the <apply_class> functions described in this section have no arguments.

The <apply_class> of any MSC supplied analysis interface is not modifiable. For user defined analysis interfaces, it is the user’s responsibility to create the <apply_class>, if one is referenced by the <analysis_code>_load_aom_data. <analysis_type> function, and to place this class in the Analysis library.

The “analysis main” Class

439Chapter 6: Creating New Analysis Forms Using PCLMain Analysis Form Functions

The “analysis_main” is the PCL class which controls the main Analysis form. It is contained in the “p3patran.plb” library and is generic, meaning that its behavior does not change according to analysis preference. This class is not modifiable by the user.

Here is a list of main tasks performed by “analysis_main”.

1. It calls the <analysis_code>_load_aom_data.<analysis_type> function to determine the appearance of the main Analysis form.

2. When a button on the main Analysis form is selected, “analysis_main” calls the “display” function of the associated PCL class.

3. When the action-object combination on the main Analysis form is changed or the main Analysis form is closed, “analysis_main” calls the “exit” function of any class associated with an open subordinate Analysis form.

4. The “analysis_main” keeps tract of which subordinate Analysis forms were left open and which were closed for each action-object combination so that when re-entering an action-object combination, the forms which were left open can be automatically re-displayed.

5. The “analysis_main” reports any main Analysis form event to the <apply_class> as described in the previous section.

In addition to the main tasks mentioned above, there are many “analysis_main” functions which can be called from the <apply_class> or from other subordinate Analysis forms or functions which either control the appearance or behavior of the main Analysis form or extract data from the main Analysis form. Node of these function calls are mandatory, but they can greatly enhance the power of your user defined analysis interface. These optional functions are described below.

PCL and CustomizationMain Analysis Form Functions

440

Fetching Data From “analysis_main”To get the names of the currently selected action, object and method, use the following function.

To get the name and description of the currently selected job, the function described below should be used.

analysis_main.get_analysis_menu_items

(<item_orders>, <item_labels>)

Input:

None.

Output:

INTEGER ARRAY

<item_orders> A 3 element vector containing the order of the current action in the list of valid actions, the order of the current object in the list of objects valid for the chosen action, and the order of the current method in the list of methods valid for the chosen action-object selection. As an example, let us look at the case where the valid objects under “Import” are “Model,” “Results” and “Both” and there are no methods. If the object-method selection is “Import” - “Both” “ “, the <items> would be [2,3,0].

STRING ARRAY

<item_labels> A 3 element vector of strings containing the names of the currently chosen action-object-method. In the above example, <item_labels> would be [“Import,” “Both,” “ “]. The maximum length of each string is 31 characters.

Error Conditions:

None.

441Chapter 6: Creating New Analysis Forms Using PCLMain Analysis Form Functions

In order to get more detailed information about the current job, use “analysis_main.get_current_job_info”

To get the current analysis code and analysis type, use the “get_code_and_type” function.

analysis_main.get_job_name_and_desc

(<job_name>, <job_description>)

Input:

None.

Output:

STRING <job_name> The name of the currently selected job. The maximum length of this string is 31 characters.

STRING <job_description> The description of the currently selected job. The maximum length of this string is 256 characters.

Error Conditions:

None.

analysis_main.get_current_job_info

(<job_name>, <job_description>, <job_id>, <parameter_set_id>, <job_status>)

Input:

None.

Output:

STRING <job_name> The name of the currently selected job. The maximum length of this string is 31 characters.

STRING <job_description> The description of the currently selected job. The maximum length of this string is 256 characters.

INTEGER <job_id> The ID of the current job.

INTEGER <parameter_set_id> The ID of the parameter set associated with this job.

INTEGER <job_status> The status of the current job.

Error Conditions:

None.

PCL and CustomizationMain Analysis Form Functions

442

To fetch the model and results file suffixes for the current analysis code, use the function “get_file_suffixes”.

The user may want to hide, move or re-display items on the main Analysis form. In order to do this, he needs to know the widget IDs of these items. Once he has these IDs he can use “ui_wid_get” to get further information about the items and “ui_wid_set” to manipulate the items. The “get_panel_info” function can be used to get the widget IDs of many Analysis form items.

analysis_main.get_code_and_type

(<analysis_code_name>, <analysis_code_id>, <analysis_type_name>, <analysis_type_id>)

Input:

None.

Output:

STRING <analysis_code_name> The name of the current analysis code. This string has a maximum of 31 characters.

INTEGER <analysis_code_id> The ID of the current analysis code.

STRING <analysis_type_name> The name of the current analysis type. This string has a maximum of 31 characters.

INTEGER <analysis_type_id> The ID of the current analysis type.

Error Conditions:

None.

analysis_main.get_file_suffixes

(<model_suffix>, <results_suffix>)

Input:

None.

Output:

STRING <model_suffix> The user defined model file suffix of the current analysis code. The maximum length of this string is 4 characters.

STRING <results_suffix> The user defined results file suffix of the current analysis code. The maximum length of this string is 4 characters.

Error Conditions:

None.

443Chapter 6: Creating New Analysis Forms Using PCLMain Analysis Form Functions

analysis_main.get_panel_info

(<form_id>, <first_y_location>, <job_frame_id>, <button_frame_id>, <separator_id>, <apply_button_id>)

Input:

None.

Output:

widget <form_id> The ID of the main Analysis form.

REAL <first_y_location> The Y position on the main Analysis form of the first widget following the Analysis Code / Analysis Type text box.

widget <job_frame_id> The ID of the job name / job description frame.

widget <button_frame_id> The ID of the button frame.

widget <separator_id> The ID of the separator widget.

widget <apply_button_id> The ID of the apply button.

Error Conditions:

None.

Note: The values returned by “get_panel_info” are invariant with respect to action-object selection, so this calls only needs to be made once. But the main Analysis form is refreshed every time an action-object change is made (including when the analysis preference is changed or when the main Analysis for is closed and then re-opened), so any modifications to the main Analysis form must be repeated every time a action-object change is made. A good place for any main Analysis form changes would be the <apply_class>.option_menu_change_is_done function.

PCL and CustomizationMain Analysis Form Functions

444

Chapter 7: Modifying the Database Using PCLPCL and Customization

7 Modifying the Database Using PCL

Introduction 2

Querying the MSC Patran Database 3

Loading Definitions for MSC Supported Preferences 7

Loading Definitions for User Defined Preferences 8

Loading Basic Definitions 9

Adding A New Analysis Preference 10

Adding New Element Types/Properties 20

Adding the New Material Properties 63

Adding New Loads and Boundary Conditions 83

Adding Custom General Field Functions 114

Adding New Multi-Point Constraint Definitions 130

Adding Element Verification Parameters 133

Examples of Modifying the Database 136

PCL and CustomizationIntroduction

446

IntroductionThe forms of many Patran applications depend upon analysis code specific definitions contained within the Patran database. These analysis code sensitive applications are Loads and Boundary Conditions, Element Properties, Material Properties and Finite Elements (multi-point constraint equations, available element topologies and element verification). The analysis code specific definitions that they depend upon define element types, element properties, material properties, multi-point constraint equations, loads and boundary conditions and element verification parameters.

Two versions of the Patran database are delivered in the $P3_HOME directory, “template.db” and “base.db”. The “template.db” contains analysis code specific definitions for selected MSC supported interfaces (e.g., Patran MSC.Marc, Patran MSC Nastran, etc.). “base.db” is basically devoid of analysis code specific definitions but does contain some basic definitions. The definitions which are stored in “base.db” are Analysis type, Loads and Boundary Conditions and the association between Loads and Boundary Conditions and all the MSC supported interfaces.

Due to the excessive size of “template.db,” it is highly recommended that the user create his own unique template database which contains only the analysis code specific definitions pertaining to the analysis codes of immediate interest to him. He can call this new template database “<analysis_code>.db,” (e.g., “nastran.db” and can use it as the template for all new databases). See File>New (p. 67) in the Patran Reference Manual. This would produce considerably smaller and simpler databases then would the use of “template.db”.

MSC supplies PCL functions which will add analysis code specific definitions for each of the MSC supplied interfaces to any Patran database. Use of these functions is described in Loading Definitions for MSC Supported Preferences, 451.

Alternatively, the user can define his own analysis code specific definitions in order to create a new interface to Patran. The majority of this chapter is dedicated to teaching the user how to create his own interface.

447Chapter 7: Modifying the Database Using PCLQuerying the Patran Database

Querying the Patran DatabaseThe current version of Patran no longer uses Interbase to provide access to a database. The Interbase product and tools are still supplied with Patran to support conversions of older databases to be compatible with the current version of Patran. The database query tool discussed below can be used to examine the contents of databases built with older versions of Patran. A database query can be used to determine whether an application has successfully accomplished its task, to determine how other applications operate, or to determine what already exists in a database.

The database querying program is located in the $P3_HOME/bin directory. The program is called qli, which is an acronym for Query Language Interpreter and can be used to investigate the contents of a database.

To start qli, simply execute the qli command (for example, $P3_HOME/bin/qli). The qli program supports a subset of SQL, the standard query language, along with having many program specific commands of its own. The six major qli specific commands are “ready,” “show,” “list,” “print,” “help” and “quit.” A brief description of these commands are given below. For further information about qli, see the “help” command within qli. Further information about SQL can be obtained from any SQL reference book.

Ready The ready command opens the specified database and connects it to the qli process. The syntax is “ready <database_name>.” The qli program does not support any on-line arguments, i.e., “qli <database_name>” won’t work. The “ready” command must be made from within qli.

Quit The quit command will exit the qli process, closing the database if it is open.

Help The help command provides on-line help for all of the commands and command syntax supported by the qli program.

Show The show command either shows the names of all the relations in the database (“show relations”) or show the actual definition of a specified relation (“show <relation_name>”, for example: “show point”).

The following is a listing of all the relations in the database delivered with Patran V7.5.

ALLOWABLE_MAGIC_PROP MPC

ALLOWABLE_MATL_PROP MPC_IN_GROUP

ALLOWABLE_PHYS_PROP MPC_TERM

ANALYSIS_CODE MPC_TERM_DOF

ANALYSIS_ELEMENTS MPC_TERM_NODE

ANALYSIS_ELEMENT_SUMMARY MPC_TYPE

ANALYSIS_STEP NODAL_RESULT

Show (continued)

ANALYSIS_TYPE NODE_PATTERN

ANNOTATION PARAM

PCL and CustomizationQuerying the Patran Database

448

APPL_GEO_REGION PARAM_SET

ARBITRARY_CLIPPING_PLANE PERSISTENT_MEMORY

ASSIGNED_LOAD_SET PHYS_PROP_DEFN

CLIPPING_PLANE PHYS_PROP_REGION

CONDENSE_OPTION PHYS_PROP_SET_DEFN

CONFIG PHYS_PROP_SET_MBR_DEFN

CONFIG_PARAM POSTED_ANNOTATION

CONSTITUTIVE_MODEL POSTED_CLIPPING_PLANE

CONSTITUTIVE_MODELS_SPECIFIED

POSTED_GROUP

CONTROL_INFO PREFERENCE

COORDINATE_FRAME PRIMARY_RESULT

DEGREES_OF_FREEDOM RANGE

DISPLAY_PROPERTY REGION_LAYER

DOF_SET RENDER

DOF_SET_MEMBER RESULTS_COORD_SYS

DS_LBC RESULTS_DATA_BULK

DV_LBC RESULTS_DATA_REGISTER

ELEMENT_EDGE_NODE RESULTS_INFO

ELEMENT_FACE RESULTS_RDM_TARGET

ELEMENT_FACE_EDGE RESULTS_RDM_TOOL

ELEMENT_FACE_NODE RESULT_TYPE

ELEMENT_IN_REGION RESULT_VALUES

ELEMENT_POSITION SECONDARY_RESULT

ELEMENT_TOPOLOGY SECTION_POSITION

ELEMENT_TYPE SELECTED_ELEMENT_TYPE

ELEMENT_VERIFICATION_PARMS SELECTED_PROPERTY_SET

FEM_DS_LBC SHORT_FIBER

FEM_DV_LBC SOURCE_FILE

FEM_SS_LBC SPECTRUM

FEM_SV_LBC SPECTRUM_COLOR

FIELD SS_LBC

FIELD_25_LBC SUBRANGE

FIELD_FEM SUB_CASE

449Chapter 7: Modifying the Database Using PCLQuerying the Patran Database

FIELD_FUNCTION SUB_MPC

FIELD_GENERAL SUM_RES_INFO

FIELD_GENERAL_FUNCTIONS SUPPORTED_ANALYSIS_TYPE

FIELD_TABLE SV_LBC

FORMULATION_OPTION TEMP_MPC

FORMULATION_OPTION_ALIAS TEMP_RESULT

GEOMETRIC_OPTION VALID_ANAL_CODE

GEOMETRIC_REGION_LIST VALID_ANAL_LOAD_TYPE

GLOBAL_VARIABLE VALID_CONSTITUTIVE_MODELS

GROUP VALID_LBC_TARGET_ELEM

HALPIN_TSAI VALID_LBC_TYPES

INSTANCE VALID_MATERIAL_CATEGORIES

INSTANCE_IN_GROUP VALID_MPC_TYPE

JOBNAME VIEW

JOBNAME_LIST VIEWPORT

LAMINATE VIEWPORT_TITLE

LAMINATE_LAYER VPPOSTED_TITLE

LAMINATE_OPTION XXX_CLIENT_ENTITY

LAYER_POSITION XXX_CLIENT_INTEGER_DATA

LBC XXX_CLIENT_LOGICAL_DATA

LBC_APP_REGION XXX_CLIENT_REAL_DATA

LBC_GRAPHICS_VECTOR XXX_CLIENT_STRING_DATA

LBC_IN_GROUP XYAXIS

LBC_SELECT_DATATYPE XYCURVE

LBC_TYPE XYCURVE_DATA

LBC_VARIABLE_DEFN XYLEGEND

LIGHT_SOURCE XYLEGEND_ITEM

LOAD_BC XYPOSTED_CURVE

LOAD_CASE XYPOSTED_LEGEND_ITEM

LOOKUP_TABLE XYPOSTED_TITLE

LOOKUP_TABLE_VALUE XYTITLE_TABLE

MATERIAL XYWINDOW

MATERIAL_CATEGORY

MATERIAL_DIRECTIONALITY

PCL and CustomizationQuerying the Patran Database

450

MATERIAL_LINEARITY

MATL_CONST_MODEL_DEFN

MATL_DISPLAY_CATEGORY

MATL_DISPLAY_SUB_CATEGORY

MATL_MAGIC

MATL_MAGIC_ALIAS

MATL_MAGIC_DEFINITION

MATL_PROP_ALIAS

MATL_PROP_DEFN

MATL_PROP_VALUE

MEMORY_DATABASE

MESH_PARAM

MIX_COMPONENT

List The list command will list the contents of a relation (for example, list all points). The syntax is “list <relation_name>.” This command can have qualifiers associated with it. The main qualifier is “where,” for example: “list point where ID = 12.” Many conditions can be linked with “and” for example: “list point where x > 0.0 and x < 1.0.” The difference between list and show is that show merely displays the structure of the relation whereas list will display the contents of the relation.

Print The print command is identical to the list command except that the list command displays one value per line whereas the print command displays one relation per line.

list: id 5 x 1.0 y 1.5 z -0.5

id 6 x 0.5 y 0.0 z -1.0

print: id x y z 5 1.0 1.5 -0.5 6 0.5 0.0 -1.0

451Chapter 7: Modifying the Database Using PCLLoading Definitions for MSC Supported Preferences

Loading Definitions for MSC Supported PreferencesMSC supplies a number of PCL functions which will load the analysis code specific definitions required for each of the MSC supported interfaces. These functions make it easy for the user to create his own template database instead of using $P3_HOME/template.db which is excessively large and complex. The general steps for creating a new template database are:

1. Within Patran, open a new database using $P3_HOME/base.db as the template. You could call this new database “<analysis_code>.db,” (e.g., “mscnastran.db”).

2. In the Patran command line, type the command “load_<analysis_code>(),” (e.g., “load_mscnastran()”). The complete list of the available commands is given below.

3. When the command is finished (heart beat is green), close the database, saving it as a new template database.

4. When opening a new database, choose the newly created template database, instead of $P3_HOME/template.db

The complete list of MSC supplied loading functions is:

These functions can be used on any database which does not already contain definitions for the particular interface. Any number of interfaces can be added to a database at any time, even after the model has been created.

load_mscnastran() for Patran MSC Nastran

load_marck5() for MSC.Marc (K5)

load_marc() for MSC.Marc (pre K5)

load_ansys5() for Patran ANSYS (Revision 5.0)

load_ansys() for Patran ANSYS (pre Revision 5.0)

load_abaqus() for Patran ABAQUS

load_dyna3d() for Patran LS-DYNA3D

load_padvancedfea() for Patran Advanced FEA

load_pfea() for Patran FEA

load_pcfd() for Patran CFD

load_pthermal() for Patran Thermal

load_pteam() for Patran TEAM

load_samcef() for Patran SAMCEF

load_patran2nf() for PATRAN 2 Neutral File Preference

PCL and CustomizationLoading Definitions for User Defined Preferences

452

Loading Definitions for User Defined PreferencesIn addition to loading the analysis code specific definitions for a MSC supplied interface as described in the previous section, the user can add analysis code specific definitions for his own analysis code. The rest of this chapter is dedicated to describing all the PCL callable functions needed to add definitions for a user defined interface.

There are three basic ways to manage the PCL functions which add the definitions for your new analysis code. The user can create a PCL function, “load_<analysis_code>”, which would in turn make all the appropriate PCL function calls to define the new analysis code. This function would be very similar to the PCL functions delivered by MSC (e.g., “load_marck5”, “load_ansys,” etc.) In fact, the user could compile this function into p3patran.plb, giving universal access to the function. Alternatively, the user can create a session file which contains the appropriate calls to define the new analysis code. The example at the end of the chapter uses this method. Lastly, the needed commands could be directly input to the Patran command line, though this method would, in most cases, be undesirable.

It is important to understand that “base.db” contains certain code specific definitions, namely the three analysis types listed in the description of db_create_analysis_type, 454, all the load type definitions listed in the description of db_create_lbc_type_defn, 543 and the associativity between these load type definitions and all the MSC supplied analysis interfaces. In other words, all Patran databases will contain these definitions and they need never be repeated.

There are other definitions which are relatively basic and can be added to “base.db” with one simple PCL function call, “load_generics()” is completely options and is intended solely as a short cut. The user can call “load_generics()” and then reference any of the definitions loaded by this function without going through the labor defining all of them himself. All the MSC supplied interface loading functions, (e.g., “load_mscnastran()”) described in the previous section use “load_generics().” So, a database which contains definitions for any MSC supported interface will also contain all the definitions loaded by “load_generics().” If the definitions added by “load_generics()” already exist, they need not be repeated, but repeating them will also not cause any problems.

Due to the size of “template.db,” it is strongly recommended that the user develop his new template database from “base.db” instead of “templated.db.” But, if he wishes to use “template.db” he should note that all definitions detailed in the rest of this chapter exist in “template.db.” In this case, none of the documented definitions need be repeated and the repetition of certain definitions will create errors. In other words, it is impossible to modify the definitions for an analysis code once defined. In fact, even when redefinition does not create an error, the command will not be obeyed, but instead simply ignored.

Lastly, the way that the analysis interfaces recognize data is through the definitions described in this chapter. If two interfaces recognize the same set of definitions, then a model will easily transfer from one analysis code to the other. If there are differences in the sets of definitions recognized by the two analysis codes, then data is likely to be lost when transferring a model from analysis code to analysis code. So, in order to maintain consistency with the MSC supplied interfaces, it behooves the user to use the definitions documented in this chapter (which are the definitions used by the MSC supplied interfaces) as much as possible, instead of making unique definitions of his own. Most of these definitions are identified by an integer ID. When users or third-parties add new definitions, the IDs for these should be in the range 20000 to 29999 to avoid conflict with MSC-defined ID’s.

453Chapter 7: Modifying the Database Using PCLLoading Basic Definitions

Loading Basic DefinitionsThe function described below will load relatively basic analysis code definitions into the open database. It is entirely optional and is intended solely as a labor saver. The user can call “load_generics()” and then reference any of the definitions it loads without going thought the trouble of individually creating each definition himself. “load_generics()” will add the following definitions: all degrees-of-freedom listed in the description of db_create_degree_of_freedom(), all degree-of-freedom sets listed under db_create_dof_set(), all material linearities listed under options listed under db_create_laminate_opt(), all condensation options listed under db_create_formulation_opt(), all geometric options listed under db_create_geometric_opt(), all element types listed under db_create_element_type(), all element property words listed under db_create_phys_prop_defn(), and all material property words listed under db_create_matl_prop_defn().

load_generics()

Input:

None.

Output:

None.

PCL and CustomizationAdding A New Analysis Preference

454

Adding A New Analysis PreferenceA new analysis code can be added to analysis preferences by adding any new analysis types and then adding the new analysis code.

A new analysis type can be added by using the following PCL function:

This function should only be used to add new analysis types. Three analysis types are already defined in all Patran databases:

The function to add a new analysis code is

db_create_analysis_type (<analy_type_id>, <analy_type_name>)

Input:

INTEGER <analy_type_id> The ID for referencing the analysis type. This ID must be unique with respect to all previously defined analysis type IDs.

CHARACTER STRING

<analy_type_name> The name of the analysis type.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

Analysis type <analy_type_id>

Structural Analysis 1

Thermal Analysis 2

Fluid Dynamics 3

455Chapter 7: Modifying the Database Using PCLAdding A New Analysis Preference

The following analysis code IDs should be reserved for MSC supported analysis interfaces:

db_create_analysis_code (<analy_code_id>, <analy_code_name>, <model_suffix>, <results_suffix>, <num_analy_types>, <analy_type_ids>, <def_analy_type>)

Input:

INTEGER <analy_code_id> The ID for referencing the analysis code. This ID must be unique with respect to all previously defined analysis code IDs. Users and third parties should define analysis code IDs in the range 20000 to 29999.

CHARACTER STRING

<analy_code_name> The name of the analysis code.

CHARACTER STRING

<model_suffix> Suffix to be added to the analysis code input file.

CHARACTER STRING

<results_suffix> Suffix to be added to the analysis code results file.

INTEGER <num_analy_types> The number of analysis types valid for this analysis code.

INTEGER ARRAY

<analy_type_ids> The <num_analy_types> analysis types IDs valid for this analysis code.

INTEGER <def_analy_type> The analysis type ID of the default analysis type.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

PCL and CustomizationAdding A New Analysis Preference

456

• The following PCL function can be used to specify which analysis code will be the default analysis code, i.e., which analysis code is automatically chosen as the analysis preference upon

Analysis Code <analy_code_id>

MSC Nastran 1

ABAQUS 2

ANSYS 3

MARC 4

Patran FEA 5

Patran Thermal 6

Patran CFD 9

Patran Advanced FEA 10

MARC K5 11

ANSYS 5 12

Patran TEAM 13

SAMCEF 15

PATRAN 2NF 16

MSC.Dytran 17

Patran STRUCTURAL OPTIMIZATION

19

MARC K6 20

LMS CADA-X 21

FASTRUDL 31

SESAM 32*

*Conflict with DYNA3D will be resolved when the DYNA3D preference is eliminated.

DYNA3D 32

RCS 41

CFX-F3D 42

CFX-FLOW 43

MSC.DropTest 51

MSC.Forging 52

LS-DYNA3D 10001

PAMCRASH 13001

457Chapter 7: Modifying the Database Using PCLAdding A New Analysis Preference

opening a new database.

db_get_default_anal_code

(<analysis_code_name>)

Input:

None

Output:

STRING[31] <analysis_code_name>

Analysis code name.

Error Conditions:

None.

PCL and CustomizationAdding A New Analysis Preference

458

Since the action of the above function, namely the changing of the chosen analysis code and analysis type, might affect forms which are currently being displayed, the user might wish to include a call to the widget refresh function at the end of his analysis code definition loading session file or PCL function. The syntax of this refresh function is shown below.

ui_wid_refresh( )

db_get_anal_code_id (<analysis_code_name>, <analysis_code_id>)

Input:

STRING[31] <analysis_code_name> Analysis code name.

Output:

INTEGER <analysis_code_id> Analysis code ID.

Error Conditions:

None.

uil_pref_analysis.set_analysis_pref

(<analy_code_name>, <analy_type_name>, <input_file_suffix>, <output_file_suffix>)

Input:

CHARACTER STRING

<analy_code_name> The name of the analysis code to be set as the default. This name can be no more than 31 characters.

CHARACTER STRING

<analy_type_name> The name of the analysis type to be set as the default for the chosen analysis code. This name can be no more than 31 characters.

CHARACTER STRING

<input_file_suffix> The default file suffix for the input files of the chosen analysis code. This suffix can be no more than 4 characters.

CHARACTER STRING

<output_file_suffix> The default file suffix for the output files of the chosen analysis code. This suffix can be no more than 4 characters.

Output:

None.

Error Conditions:

None.

459Chapter 7: Modifying the Database Using PCLAdding A New Analysis Preference

Custom Data and Application Region Sub-FormsThis section is for application developers who want to create their own customized Data and Application Region sub-form classes. The class names for these custom forms will be stored and loaded in from the database with a selected analysis preference. They can then accessed by pressing the “Input Data...” and/or “Select Application Region...” buttons in the Create action of the Loads/Boundary Conditions form. If a selected analysis preference does not have a custom sub-form class(es) associated with it for the data and/or application region classes, it will use the Patran default sub-form class(es).

The Create action of the Loads/Boundary Conditions form is the parent class for the two sub-form classes. It makes a number of calls to functions within the default sub-form classes to manage them. Consequently, the custom sub-form classes must contain these same function names called from the Parent class in order to maintain the integrity of the Parent class code. The sub-form classes may or may not utilize all of the function names called from the Parent class.

Since the name of the sub-form class may vary, the parent Create class must have a generic way of accessing the sub-form class. Normally this is done by using the ui_exec_function(classname, function) call with the class name that was loaded in from the database with the selected analysis preference. This call will work for class name functions that don’t require arguments for data passing.

In order to facilitate communication between the custom sub-form classes and the parent Create class with data passing arguments, a generic interface layer has been created consisting of two new classes:

• lbc_input

• lbc_select

These new classes are independent of the classes that control the data input and application region selection sub-forms. The interface layer is basically a set of storage areas for the common data being passed between the Create class and the associated custom class managing the sub-form.

Each custom sub-form class is required to contain function names which will be called by Patran whether the custom sub-forms utilize them or not.Some of the functions pass data to/from the calling class. Within the functions requiring data passing, the programmer must include a call to the corresponding lbc_input or lbc_select class to retrieve or return data as noted in the following documented interface calls for these functions.

Following is a list of the function names that Patran uses for communication and management of its two default sub-forms.

Required Functions for Data Input Class

Important:One of the required function names for each custom class is initx. The initial Patran design of the LBC forms was made to bypass the standard init function and use an initx function. The initx functions of the custom sub-form classes must contain a call to ui_exec_function(classname, “init”) in order for the UIMS to know that the form has been initialized. Consequently the ui_form_exists(classname) call will return correctly whether or not the form has been initialized.

PCL and CustomizationAdding A New Analysis Preference

460

The required function names for this class are:

init()initx()display()input_disabled()set_cur_data()get_data()get_mem()update_cur_data()get_data_defn()

The functions that require data passing through the generic interface layer are described below:

Notes:

Since it only makes sense to have access to the custom data input form, the variable declaration is optional and the interface call can be made as:

lbc_input.set_input_disable(FALSE)

Required Function for Data Input Class

Input_disabled()

Description:

Called by loadsbcs_create class to determine if the data input form for the current (object, method, target) should be accessible.

Variable declarations (optional):

LOGICAL flag True: Enable the Input Data button.

False: Disable the Input Data button.

Preference call:

lbc_input.set_input_disable(flag)

Error Conditions:

None.

461Chapter 7: Modifying the Database Using PCLAdding A New Analysis Preference

Notes:

Requires #include “app_lbcs.p” for variable array sizes.

Required Function for Data Input Class

set_cur_data()

Description:

When an existing LBC set is selected from the listbox on the Create panel of the Loads/Boundary Conditions form, the values for the widgets which are to be displayed in this sub-form are set with the given values.

Variable declarations:

REAL lbc_sf Loads/BC Set Scale Factor.

STRING[LBC_DATA_LEN]

cid_data Coordinate Frame.

INTEGER num_data Number of databoxes on the Input Data form.

INTEGER(NUM_LBC_INP_FLDS)

data_id Internal Ids corresponding to the databoxes.

STRING[LBC_DATA_LEN](NUM_LBC_INP_FLDS)

stat_data Values from static databoxes.

STRING[LBC_DATA_LEN](NUM_LBC_INP_FLDS)

dyn_data Values from dynamic databoxes.

Preference call:

lbc_input.get_cur_data(lbc_sf, cid_data, num_data, data_id, stat_id, dyn_id)

Error Conditions:

None.

PCL and CustomizationAdding A New Analysis Preference

462

Notes:

Requires #include “app_lbcs.p” for variable array sizes.

Required Function for Data Input Class

get_data()

Description:

Used to transfer data from the data input sub-form to the loadsbcs_create class when creating a new set.

Variable declarations:

REAL lbc_sf Loads/BC Set Scale Factor.

STRING[LBC_DATA_LEN]

cid_data Coordinate Frame.

INTEGER num_data Number of databoxes on the Input Data form.

INTEGER(NUM_LBC_INP_FLDS)

data_id Internal Ids corresponding to the databoxes.

STRING[LBC_DATA_LEN](NUM_LBC_INP_FLDS)

stat_data Values from static databoxes.

STRING[LBC_DATA_LEN](NUM_LBC_INP_FLDS)

dyn_data Values from dynamic databoxes.

Preference call:

lbc_input.set_data(lbc_sf, cid_data, num_data, data_id, stat_id, dyn_id)

Error Conditions:

None.

463Chapter 7: Modifying the Database Using PCLAdding A New Analysis Preference

Required Functions for Application Region Selection Class

The required function names for this class are

The functions that require data passing through the generic interface layer are described below:

Required Function for Data Input Class

get_mem()

Description:

Allocate memory for any classwide virtual arrays.

Variable declarations:

INTEGER stat Return status of success or failure (0: success; -1: error)

Preference call:

lbc_input.set_status(stat)

Error Conditions:

None.

init()

initx()

display()

get_mem()

get_data()

set_cur_data()

get_geo_index()

clear_app_region()

update_cur_data()

PCL and CustomizationAdding A New Analysis Preference

464

Example:

geometry_str = lbc_select.get_geo_group_str()IF (geometry_str == LBC_GEOMETRY_STR) THENgeo_index = 1ELSE IF (geometry_str == LBC_FEM_STR) THENgeo_index = 2END IFlbc_select.set_geo_index(geo_index)

Notes:

Requires #include “app_lbcs.p” for LBC string definitions.

Required Function for Data Input Class

get_geo_index()

Description:

Called by the loadsbcs_create class when an existing set is selected from the listbox. Given the selected set’s geometry string, this function returns the internal index for its application region’s geometry filter.

Variable declarations:

STRING geometry_str[31} Real Geometry Group string:

LBC_GEOMETRY_STR

LBC_FEM_STR

INTEGER geo_index Geometry Group internal index

1: Geometry

2: FEM

Preference call:

geometry_str = lbc_select.get_geo_group_str( )

lbc_select.set_geo_index(geo_index)

Error Conditions:

None.

465Chapter 7: Modifying the Database Using PCLAdding A New Analysis Preference

Notes:

lbc_select.get_cur_2_app_data is only needed for 2 application region forms.

Required Function for Data Input Class

set_cur_data()

Description:

When an existing LBC set is selected from the listbox on the Create panel of the Loads/Boundary Conditions form, the values for the widgets which are to be displayed in this sub-form are set by changing the values with the given data.

Variable declarations:

INTEGER grp Geometry Group.

INTEGER num_list Number of application region lists.

STRING[VIRTUAL](VIRTUAL)

app_list Application region lists.

INTEGER couple Coupling option.

INTEGER order Ordering option.

Preference call:

lbc_select.get_cur_data(grp, num_list, app_list)

lbc_select.get_cur_2_app_data(couple, order)

Error Conditions:

None.

PCL and CustomizationAdding A New Analysis Preference

466

Notes:

lbc_select.set_2_app_data is only needed for 2 application region forms.

Required Function for Data Input Class

get_data()

Description:

Used to transfer data from the Select Application Region sub-form to the loadsbcs_create class when creating a new set.

Variable declarations:

INTEGER result Return status of success or failure. (0: success; -1: error)

INTEGER num_ar Number of application region.

INTEGER(2) ar_id Application Region ids.

STRING[VIRTUAL] app_list1 Application Region list 1 of entities.

STRING[VIRTUAL] app_list2 Application Region list 2 of entities.

STRING geo_fltr[31] Geometry filter which restricts entities which can be selected.

INTEGER couple Coupling option.

INTEGER order Ordering option.

Preference call:

lbc_select.set_status(result)

lbc_select.set_data(num_ar, ar_id, app_list1, app_list2, geo_fltr)

lbc_select.set_2_app_data(couple, order)

Error Conditions:

None.

Required Function for Data Input Class

get_mem()

Description:

Allocate memory for any classwide virtual arrays.

Variable declarations:

INTEGER stat Return status of success or failure. 0: success; -1: error)

Preference call:

467Chapter 7: Modifying the Database Using PCLAdding A New Analysis Preference

lbc_select.set_status(stat)

Error Conditions:

None.

PCL and CustomizationAdding New Element Types/Properties

468

Adding New Element Types/PropertiesFirst, all the element types of the new analysis code must be defined. In order to do this, first define the generic element attributes. These element attributes include degrees-of-freedom, degree-of-freedom sets, material linearities, material directionalities, laminate options, element condensation options, element formulation options, element geometric options and generic element types. Then use the element attributes in order to define the analysis code specific element types. Once the element types have been fully defined, the generic property words to be applied to each of these element types. Then, define the analysis code specific properties for all these property words and then group the words into property sets. Finally, associate the property sets to the appropriate element types.

If the PATRAN 2.5 neutral file is going to be used as a mode of model data communication, PATRAN 2.5 element configuration codes must be assigned to the analysis code specific element types and neutral file order must be assigned to the property words of a property set. PATRAN 2.5 configuration codes are assigned during the definition of analysis code specific element types. Neutral file order for property words is assigned during the grouping of property words into property sets.

In summary, the steps of adding element types and element properties are as follows:

• Define Generic Element Attributes:

Degrees-of-Freedom.

Degree-of-Freedom Sets.

Material Linearities.

Material Directionalities.

Laminate Options.

Element Condensation Options.

Element Formulation Options.

Element Geometric Options.

Element Types.

• Define Analysis Code Specific Element Types and, if needed, assign PATRAN 2.5 configuration codes to analysis code specific element types.

• Define Generic Property Words.

• Assign Analysis Code Specific Properties to the Property Words.

• Group Property Words into Property Sets and, if needed, assign neutral file order to property words.

• Assign Property Sets to Element Types.

Degrees-of-Freedom

To create new degrees-of-freedom use:

469Chapter 7: Modifying the Database Using PCLAdding New Element Types/Properties

The list of degrees-of-freedom defined by “load_generics()” is:

Degree-of-Freedom Sets

To create new degree-of-freedom sets use:

db_create_degree_of_freedom ( <dof_id>, <dof_name> )

Input:

INTEGER <dof_id> The ID for referencing the degree-of-freedom. This ID must be unique with respect to all previously defined degree-of-freedom IDs.

CHARACTER STRING

<dof_name> The name of the degree-of-freedom.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

<dof_name> <dof_id>

UX 1

UY 2

UZ 3

RX 4

RY 5

RZ 6

Temperature 7

Voltage 8

Magnetic Flux 9

Pressure 10

Top Temperature 11

Middle Temperature 12

Bottom Temperature 13

PCL and CustomizationAdding New Element Types/Properties

470

The list of degree-of-freedom sets defined by “load_generics()” is:

db_create_dof_set ( <dof_set_id>, <dof_set_name>, <num_dofs>, <dof_ids> )

Input:

INTEGER <dof_set_id> The ID used to reference the degree-of-freedom set. This ID must be unique with respect to all previously defined degree-of-freedom set IDs.

CHARACTER STRING

<dof_set_name> The name of the degree-of-freedom set.

INTEGER <num_dofs> The number of degrees-of-freedom in this set.

INTEGER ARRAY

<dof_ids> The <num_dofs> IDs of the degrees-of-freedom making up this set.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

<dof_set_name> <dof_set_id>

UX 1

UY 2

UZ 3

RX 4

RY 5

RZ 6

Temperature 7

Voltage 8

Magnetic Flux 9

Pressure 10

Top Temperature 11

Middle Temperature 12

Bottom Temperature 13

UX, UY 14

UX, UY, UZ 15

UX, UY, RX 16

471Chapter 7: Modifying the Database Using PCLAdding New Element Types/Properties

UX, UY, RZ 17

UX, UY, UZ, RX 18

UX, UY, UZ, RX, RY 19

UX, UY, UZ, RX, RY, RZ 20

RX, RY, RZ 21

UX, UY, Temp, Mag Flux 22

Volt, Mag Flux 23

UX, UY, UZ, Temp 24

UX, UY, UZ, Temp, Volt, Mag Flux

25

Temp, Volt, Mag Flux 26

Temp, Volt 27

UX, UY, UZ, Pres 28

UX, UY, Temp 29

UX, UY, Temp, Pres 30

Temp, Pres 31

Top Temp, Mid Temp, Bot Temp

32

Top Temp, Bot Temp 33

All 34

<dof_set_name> <dof_set_id>

PCL and CustomizationAdding New Element Types/Properties

472

Material Linearities

To define material linearities use:

The list of material linearities defined by “load_generics()” is:

Material Directionalities

To define material directionalities use:

db_create_matl_lin ( <lin_id>, <lin_name> )

Input:

INTEGER <lin_id> The ID used to reference the material linearity. This is must be unique with respect to all previously defined material linearities.

CHARACTER STRING

<lin_name> The name of the material linearity.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

<lin_name> <lin_id>

N/A 0

Linear Elastic 1

Nonlinear Elastic 2

Elastoplastic 3

Hyperelastic 4

Viscoelastic 5

Creep 6

473Chapter 7: Modifying the Database Using PCLAdding New Element Types/Properties

:

The material directionalities defined by “load_generics()” is:

Laminate Options

To create the laminate options use:

db_create_matl_dir ( <dir_id>, <dir_name> )

Input:

INTEGER <dir_id> The ID used to reference the material directionality. This ID must be unique with respect to all previously defined material directionality IDs.

CHARACTER STRING

<dir_name>

The name of the material directionality.

Output:

INTEGER <Return Value>

Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

<dir_name> <dir_id>

N/A 0

Isotropic 1

Orthotropic 2

Anisotropic 3

2D Orthotropic 4

2D Anisotropic 5

PCL and CustomizationAdding New Element Types/Properties

474

The list of laminate options defined by “load_generics()” is:

db_create_laminate_opt ( <lam_id>, <lam_name> )

Input:

INTEGER <lam_id> The ID used to reference the laminate option. This ID must be unique with respect to all previously defined laminate option IDs.

CHARACTER STRING

<lam_name>

The name of the laminate option.

Output:

INTEGER <Return Value>

Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

<lam_name> <lam_id>

Homogeneous 1

N/A 2

Laminate 3

Equivalent Section 4

475Chapter 7: Modifying the Database Using PCLAdding New Element Types/Properties

Element Condensation Options

To create the element condensation options use:

The list of element condensation options defined by “load_generics()” is:

db_create_condense_opt

( <condense_id>, <condense_name> )

Input:

INTEGER <condense_id> The ID used to reference the element condensation option. Must be unique with respect to all previously defined element condensation option IDs. Users and third-parties should define IDs in the range 20000 to 29999 to avoid conflicts with MSC-defined IDs

CHARACTER STRING

<condense_name> The name of the element condensation option.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

PCL and CustomizationAdding New Element Types/Properties

476

<condense_name> <condense_id>

Axisymmetric Link 1

Bending Only 11

Cable 12

Combination 13

Cylindrical 14

Damper 15

Deformable 16

Link 17

Mass 18

Membrane 19

N/A 20

Plane Strain 21

Plane Stress 22

Planar 23

Plate 24

Rigid 25

Rod 26

Shear Panel 27

Shell 28

Slide Line 29

Solid 30

Spherical 31

Spring 32

Spring/Damper 33

Surface Effect 34

Thin Shell 35

Thick Shell 36

Truss 37

Tube within Tube 38

Twist Panel 39

Uniaxial 40

2D Beam 41

3D Beam 42

477Chapter 7: Modifying the Database Using PCLAdding New Element Types/Properties

Element Formulation Options

To create the element formulation options use:

2D Gap 43

3D Gap 44

3D Link 45

2D Link 46

2D Rigid Surface 47

3D Rigid Surface 48

3D Thin-Wall Beam 49

General 50

General Thin Shell 51

General Thick Shell 52

Rotary Inertia 53

Linear 54

Non_linear 55

Parabolic 56

Parallel 57

Radial 58

Spatial 59

Bezier 60

Segments 61

Axisymmetric 62

<condense_name> <condense_id>

PCL and CustomizationAdding New Element Types/Properties

478

The list of element formulation options defined by “load_generics()” is:

db_create_formulation_opt

( <form_id>, <form_name> )

Input:

INTEGER <form_id> The ID used to reference the element formulation option. This ID must be unique with respect to all previously defined element formulation option IDs. Users and third-parties should define IDs in the range 20000 to 29999 to avoid conflicts with MSC-defined IDs.

CHARACTER STRING

<form_name>

The name of the element formulation option.

Output:

INTEGER <Return Value>

Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

479Chapter 7: Modifying the Database Using PCLAdding New Element Types/Properties

<form_name> <form_id>

standard formulation 1

deformable 2

Assumed Strain 10

Conduction 11

Convection 12

Convection/Radiation 13

Constant Volume 14

Constant Vol/Assumed Strain 15

Constant Volume/Twist 16

Coupled 17

Euler-Bernoulli 18

Euler-Bernoulli w/Shear 19

Fixed Direction 20

Grounded 21

Hybrid 22

Hybrid/Reduced Integration 23

Hybrid/Twist 24

Linear Axial Strain 25

Linear Temp Distr 26

Lumped 27

N/A 28

Parabolic Shear Strain 29

Plastic 30

Quadratic Temp Distr 31

Radiation 32

Reduced Integration 33

Revised Formulation 34

Rigid Contact Surface 35

Rotational DOF 36

Scalar 37

Shell Stiffener 38

Shell Stiffener w/Warp 39

True Distance 40

PCL and CustomizationAdding New Element Types/Properties

480

Element Geometric Options

To create the element geometric options use:

The list of element geometric options defined by “load_generics()” is:

Twist 41

Uniaxial 42

Viscous 43

Convectio/Diffusion 44

Conv/Diff w/Disprsion Cntrl 45

Ovalization Only 46

Ovaliz Only w/Apprx Fourier 47

Cubic Interpolation 48

Cubic Hybrid 49

Cubic Initially Straight 50

Soft Contact 51

Rigid Contact 52

db_create_geometric_opt

( <geom_id>, <geom_name> )

Input:

INTEGER <geom_id> The ID used to reference the element geometric option. This ID must be unique with respect to all previously defined element geometric option IDs.

CHARACTER STRING

<geom_name>

The name of the element geometric option. Users and third-parties should define IDs in the range 20000 to 29999 to avoid conflicts with MSC-defined IDs.

Output:

INTEGER <Return Value>

Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

<form_name> <form_id>

481Chapter 7: Modifying the Database Using PCLAdding New Element Types/Properties

Generic Element Types

To create the generic element types use:

<geom_name> <geom_id>

Standard Geometry 1

General Section 2

Arbitrary Section 10

Auto Shell Tying 11

Box Section 12

Circular Section 13

Closed Section 14

Curved w/Arbitrary Section 15

Curved w/General Section 16

Curved w/Pipe Section 17

General Plastic Section 18

Hexagonal Section 19

I Section 20

Initial Stress Input 21

Length Input 22

L Section 23

Lumped Section 24

N/A 25

Open Section 26

Pipe Section 27

Rectangular Section 28

Tapered Section 29

Trapezoidal Section 30

16 Layer 31

100 Layer 32

PCL and CustomizationAdding New Element Types/Properties

482

The list of generic element types defined by “load_generics()” is:

db_create_element_type ( <type_id>, <type_name> )

Input:

INTEGER <type_id> The ID used to reference the generic element type. This ID must be unique with respect to all previously defined generic element type IDs. Users and third-parties should define IDs in the range 20000 to 29999 to avoid conflicts with MSC-defined IDs.

CHARACTER STRING

<type_name> The name of the generic element type.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

483Chapter 7: Modifying the Database Using PCLAdding New Element Types/Properties

<type_name> <type_id>

Mass 1

Rotary Inertia 2

Grounded Spring 3

Grounded Damper 4

IRS ( single node ) 5

3D Mass 6

2D Mass 7

Beam 11

Beam in XY Plane 12

Beam in Space 13

2D Spar 14

3D Spar 15

Elastic Beam 16

Thin-Walled Beam 17

Rod 18

Link 19

Truss 20

Spring 21

Damper 22

Spring/Damper 23

Gap 24

2D Gap 25

3D Gap 26

Cable 27

Planar Rigid Surf 28

Combination 29

Surface Effect 30

1D Mass 31

Axisymmetric Link 32

Axisym Shell 33

1D Preference 34

Planar Beam 35

3D Beam 36

PCL and CustomizationAdding New Element Types/Properties

484

Analysis Code Specific Element Types

Now that all the generic element attributes have been defined, create the analysis code specific element type definitions. First, determine the element topology code using the functions described in MSC Patran Element Topology Codes (p. 488). Once the topology code has been determined, the analysis code specific element types can be created using the following function.

ISL ( in plane ) 37

ISL ( in space ) 38

Slide Line 39

IRS ( planar/axisym ) 40

IRS ( beam/pipe ) 41

RigidSurf ( Seg ) 42

RigidSurf ( Cyl ) 43

RigidSurf ( Axi ) 44

RigidSurf ( Bz2D ) 45

Shell 51

Thin Shell 52

Thick Shell 53

Plate 54

Bending Panel 55

2D Solid 56

Membrane 57

Shear Panel 58

Twist Panel 59

Rigid Surface 60

2D Preference 61

IRS ( shell/solid ) 62

RigidSurf ( Bz3D ) 63

Solid 71

3D Preference 72

<type_name> <type_id>

485Chapter 7: Modifying the Database Using PCLAdding New Element Types/Properties

A summary table containing all the element types for all analysis codes and analysis types exists in the Patran database. Therefore, when element type definitions have been added to a new template database (i.e., after all “db_create_selected_etype” calls) the summary table must be re-created. The PCL function used to create this summary table is described below:

db_create_selected_etype_wc ( <analy_type_id>, <analy_code_id>, <geom_id>, <condense_id>, <form_id>, <lam_id>, <topo_code>, <dof_set_id>, <mat_lin_id>, <mat_dir_id>, <type_id>, <config_code> )

Input:

INTEGER <analy_type_id> The ID of the analysis type.

INTEGER <analy_code_id>

The ID of the analysis code.

INTEGER <geom_id> The ID of the element geometric option.

INTEGER <condense_id> The ID of the element condensation option.

INTEGER <form_id> The ID of the element formulation option.

INTEGER <lam_id> The ID of the laminate option.

INTEGER <topo_code> The appropriate element topology code. These codes can be determined from the functions described in MSC Patran Element Topology Codes (p. 488).

INTEGER <dof_set_id> The ID of the degree-of-freedom set.

INTEGER <mat_lin_id> The material linearity code.

INTEGER <mat_dir_id> The material directionality code.

INTEGER <type_id> The generic element type ID.

INTEGER <config_code> The PATRAN 2.5 configuration code to be used for elements of this type when writing out a PATRAN 2.5 neutral file. Zero if the PATRAN 2.5 neutral file is not to be used as a mode of model data communication.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

Note: The above function not only defines analysis code specific element types, but also assigns PATRAN 2.5 element configuration codes to these element types.

PCL and CustomizationAdding New Element Types/Properties

486

Generic Property Words

In order to define element properties first define generic element property words. This is done via the function described below.

Associating Property Sets with Element Types

The first step in associating property sets to element types is to determine the appropriate element topology codes followed by the definition of property words and ids.

Before the function db_create_selected_property_set() can be used, the analysis code id, analysis type id, geometric options, condense options, element formulation options, laminate options, topology codes, degrees of freedom sets and set ids for the preference have to be defined. A minimum procedure is to get topology codes, define element types, define property words and the property sets.

The functions which have to preceed this function and are a part of any new preference creation are as listed below. The function load_generics( ) loads the default options and then the default values can be used. This eliminates use of the functions 3 to 5, 7 and 8 below in the preference creation process. The functions 3 to 5, 7 and 8 may be used if user wants to define options other than the default options.

elementprops_def_create.make_elem_summary ( )

Input:

None.

Output:

INTEGER <return_status>

Error Conditions:

None.

db_create_phys_prop_defn ( <prop_id>, <prop_name> )

Input:

INTEGER <prop_id> The ID of the property word. This ID must be unique with respect to all previously defined property words.

STRING <prop_name> The generic name of the property word.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

487Chapter 7: Modifying the Database Using PCLAdding New Element Types/Properties

1.) db_create_analysis_code, 455 for generating the code id.

2.) db_create_analysis_type, 454 for creating the analysis type.

3.) db_create_geometric_opt, 480 for creating geom_id.

4.) db_create_formulation_opt, 478 for creating the form_ids.

5.) db_create_laminate_opt, 474 for lam_ids.

6.) fem_get_patran25_etop() or db_get_elem_topology_data, 614() for getting the topology codes.

7.) db_create_dof_set, 470 for creating the degrees of freedom set for the elements

8.) db_create_pp_set_defn_wnord, 503 for getting the set_ids.

Once the appropriate topology codes are determined and the property word definition complete, the function described below will associate property sets to element types. See example for the function.

The list of generic property words defined by “load_generics()” is:

db_create_selected_prop_set (<analy_type_id>, <analy_code_id>, <geom_id>, <condense_id>, <form_id>, <lam_id>, <topo_code>, <dof_set_id>, <set_id>)

Input:

INTEGER <analy_type_id> The ID of the analysis type.

INTEGER <analy_code_id> The ID of the analysis code.

INTEGER <geom_id> The ID of the element geometric option.

INTEGER <condense_id> The ID of the element condensation option.

INTEGER <form_id> The ID of the element formulation option.

INTEGER <lam_id> The ID of the laminate option.

INTEGER <topo_code> The topology code for this type of element. These codes can be determined from the functions described in MSC Patran Element

Topology Codes (p. 488).INTEGER <dof_set_id> The ID of the appropriate degree-of-freedom set.

INTEGER <set_id> The ID of the property set to be associated with the element type defined by all the above generic element attributes.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

PCL and CustomizationAdding New Element Types/Properties

488

<word_name> <word_id>

Area 1

Beam Orientation 2

Center of Rotation 3

Closure Direction 4

Damping Coefficient 5

Definition of XY Plane 6

Dof at Node 1 7

Dof at Node 2 8

Emissivity 9

Inertia 1,1 10

Inertia 2,2 11

Inertia 3,3 12

Material Name 13

Translation Inertia,X 14

Translation Inertia,Y 15

Translation Inertia,Z 16

Ixx 17

Iyy 18

Izz 19

Orientation Angle 20

Orientation System 21

Pipe Thickness 22

Rotary Inertia,XX 23

Rotary Inertia,YY 24

Rotary Inertia,ZZ 25

Section Height 27

Section Radius (ave) 28

Section Width 29

Shear Area-2 30

Shear Area-3 31

Shear Area-y 32

Shear Area-z 33

Stefan-Boltzmann Constant 34

489Chapter 7: Modifying the Database Using PCLAdding New Element Types/Properties

Stiffness 35

Thickness 36

Degree-of-freedom 1002

Element Set Name 1003

Shear Factor 1004

Reference Temperature 1005

X-Sectional area 1006

Mass Magnitude 1010

Mass Damping Factor 1011

Crit Damping Factor 1012

Force/Displcmnt Tble 1013

Force/Velocity Table 1014

Channel Thickness 1015

Initial Clearence 1016

Stiffness in Stick 1017

Equiv Shear Strs Lim 1018

Friction in Dir_1 1019

Friction in Dir_2 1020

Area Moment I1 1021

Area Moment I2 1022

Area Moment I11 1023

Area Moment I22 1024

Area Moment I12 1025

Torsional Constant 1026

Outside Radius 1027

Thickness_RHS 1031

Thickness_TOP 1032

<word_name> <word_id>

PCL and CustomizationAdding New Element Types/Properties

490

<word_name> <word_id>

Thickness_LHS 1033

Thickness_BOT 1034

Centroidal Height 1036

Bottom Web Width 1038

Top Web Width 1039

Bottom Web Thickness 1040

Top Web Thickness 1041

Middle Web Thickness 1042

Circumscrbing Radius 1043

Wall Thickness 1045

Torus Radius 1046

Bottom Width 1047

Top Width 1048

Horizontal Width 1049

Vertical Height 1050

Horizontal Thickness 1051

Vertical Thickness 1052

Surfce Contct Softnd 1054

Clearence Zero-Press 1055

Contact Pressure 1056

Maximum Overclosure 1057

Maximum -ve Pressure 1058

Gap Conductance Tble 1059

Rad Constant Fa 1060

Rad Constant Fb 1061

Absolute Zero Temp 1062

Hourglss Stiff Param 1063

Shear Stiffness K13 1064

Shear Stiffness K23 1065

Ave Shear Stiffness 1066

Membrne Hourglss Stif 1067

Normal Hourglss Stiff 1068

Bending Hourglss Stiff 1069

491Chapter 7: Modifying the Database Using PCLAdding New Element Types/Properties

Density, mass/area 1070

# Integration Points 1071

Poisson Parameter 1072

Point Tangents Intersection 1073

Integ Points thru Thickness 1074

Integ Points around Pipe 1075

# Ovalization Modes 1076

Section Points 1077

Orientation Axis 1079

Membrane Thickness 1081

Shell Thickness 1080

Distance Centroid to Bottom at I 2015

Distance Centroid to Bottom at J 2016

Cable or Gap Option 2017

Cable Stiffness Options 2018

Convection Function Constant 2019

Compression Options 2020

Heat Gen. Rate Const1 2021

Heat Gen. Rate Const2 2022

Heat Gen. Rate Const3 2023

Heat Gen. Rate Const4 2024

Heat Gen. Rate Const5 2025

Heat Gen. Rate Const6 2026

<word_name> <word_id>

PCL and CustomizationAdding New Element Types/Properties

492

<word_name> <word_id>

Convergence Tolerance 2027

Damping Coefficient 1 2028

Damping Coefficient 2 2029

Deflection 2030

Delta Temperature 2031

Degree(s) of Freedom 2032

Shear Center Offset Y at I 2033

Shear Center Offset Y at J 2034

Shear Center Offset Z at I 2035

Shear Center Offset Z at J 2036

Application Type 2037

Y Elastic Foundation Stiffness 2042

Z Elastic Foundation Stiffness 2043

Elastic Foundation Stiffness 2044

Empirical Convection Term Expone 2046

End I Releases 2047

End J Releases 2048

Extra Shapes Option 2049

Force 2050

Geometric Form Factor 2051

Gap Size 2052

Gap Size Opion 2053

Heat Rate 2054

Height 2055

Initial Displacement 2056

Initial Status 2057

Initial Strain 2058

Layer Input Format 2059

Torsional Moment of Inertia at I 2060

Torsional Moment of Inertia at J 2061

Y Moment of Inertia at I 2062

Y Moment of Inertia at J 2063

Z Moment of Inertia at I 2064

493Chapter 7: Modifying the Database Using PCLAdding New Element Types/Properties

Z Moment of Inertia at J 2065

Large Deflection Coordinate Opti 2066

Segment Point Y Location(s) 2067

Segment Point Z Location(s) 2068

Mass 2069

Mass Distribution 2070

Mass Matrix Options 2071

Bending Moment Of Inertia Ratio 2076

Node Location Options 2080

X Nodal Offset at I 2081

X Nodal Offset at J 2082

Normal Stiffness 2083

Outer Diameter 2084

Pressure Direction Options 2085

Pressure Loading Options 2086

Pressure Sign Options 2087

Radiation Equation Types 2088

Radius 2089

Shear Area at I 2093

Shear Area at J 2094

Y Direction Shear Constant 2097

Z Direction Shear Constant 2098

Slide Force Limit 2099

Stability Options 2100

<word_name> <word_id>

PCL and CustomizationAdding New Element Types/Properties

494

<word_name> <word_id>

Sticking Options 2102

Sticking Stiffness 2103

Spring Constant 1 2104

Spring constant 2 2105

Stifness Direction Options 2106

Strain Representation Options 2108

Temperature Loading Options 2109

Thermal Capacitance 2110

Theta 2111

Thickness at I 2113

Thickness at J 2114

Y Direction Thickness 2115

Z Direction Thickness 2116

Y Bottom Thickness at I 2117

Y Bottom Thickness at J 2118

Y Top Thickness at I 2119

Y Top Thickness at J 2120

Z Bottom Thickness at I 2121

Z Bottom Thickness at J 2122

Z Top Thickness at I 2123

Z Top Thickness at J 2124

Distance Centroid to Top 2125

Distance Centroid to Top at I 2126

Distance Centroid to Top at J 2127

Torsional Shear Factor at I 2128

Torsional Shear Factor at J 2129

Ultimate Shear Stress 2130

Unloading Path Options 2131

Absolute Temp Conversion 3001

Angular Vel at Center of Rot 3002

Branch Length 3003

Closure Distance 3004

Direction of Rotation Axis 3005

495Chapter 7: Modifying the Database Using PCLAdding New Element Types/Properties

dx/ds where Branches Begin 3006

dx/ds where Branches End 3007

dy/ds where Branches Begin 3008

dy/ds where Branches End 3009

Element Length 3010

Film Coefficient 3011

Friction Coefficient 3012

Initially Open or Closed 3013

Initial Stress 3014

K Normal (closed) 3015

K Tangent (closed) 3016

Limiting Distance 3017

Min or Max Limit Type 3018

Number Divisions ea Branch 3019

Thicknesses where Branches Begin 3020

Thicknesses where Branches End 3021

Tied Shell Thickness 3022

Activation Time 3023

Deactivation Time 3024

Vel at Center of Rotation 3025

X Coords where Branches Begin 3026

X Coords where Branches End 3027

<word_name> <word_id>

PCL and CustomizationAdding New Element Types/Properties

496

<word_name> <word_id>

Y Coords where Branches Begin 3028

Y Coords where Branches End 3029

Mass Orientation 4001

Mass Component 1,1 4002

Mass Component 2,1 4003

Mass Component 2,2 4004

Mass Component 3,1 4005

Mass Component 3,2 4006

Mass Component 3,3 4007

Mass Component 4,1 4008

Mass Component 4,2 4009

Mass Component 4,3 4010

Mass Component 4,4 4011

Mass Component 5,1 4012

Mass Component 5,2 4013

Mass Component 5,3 4014

Mass Component 5,4 4015

Mass Component 5,5 4016

Mass Component 6,1 4017

Mass Component 6,2 4018

Mass Component 6,3 4019

Mass Component 6,4 4020

Mass Component 6,5 4021

Mass Component 6,6 4022

Spring Constant 4023

Mass Offset 4024

Inertia 2,1 4026

Inertia 3,1 4028

Inertia 3,2 4029

Stress Coefficient 4032

Ext. Viscous Coeff. 4033

Rot. Viscous Coeff. 4034

Tors. Stress Coeff. 4036

497Chapter 7: Modifying the Database Using PCLAdding New Element Types/Properties

Nonstructural Mass 4037

Outer Diam. @ Node 2 4039

Offset @ Node 1 4042

Offset @ Node 2 4043

Shear Stiff. Y 4044

Shear Stiff. Z 4045

Shear Stiff. R 4046

Y of Point C 4047

Z of Point C 4048

R of Point C 4049

Y of Point D 4050

Z of Point D 4051

R of Point D 4052

Y of Point E 4053

Z of Point E 4054

R of Point E 4055

Y of Point F 4056

Z of Point F 4057

R of Point F 4058

Ys of C Points 4059

Zs of C Points 4060

Station Distances 4061

Ys of D Points 4062

Zs of D Points 4063

Warp DOF @ Node 1 4064

Ys of E Points 4065

Zs of E Points 4066

<word_name> <word_id>

PCL and CustomizationAdding New Element Types/Properties

498

<word_name> <word_id>

Warp DOF @ Node 2 4067

Ys of F Points 4068

Zs of F Points 4069

Cross Sect. Areas 4070

Initial Opening 4071

Preload 4072

Opened Stiffness 4073

Closed Stiffness 4074

Sliding Stiffness 4075

Friction Coeff. Y 4076

Friction Coeff. Z 4077

Inertias 1,1 4078

Inertias 1,2 4079

Inertias 2,2 4080

Torsional Constants 4081

Nonstructural Masses 4082

Shear Relief Y 4083

Shear Relief Z 4084

NSM Inertia @ Node 1 4085

NSM Inertia @ Node 2 4086

Warp Coeff. @ Node 1 4087

Warp Coeff. @ Node 2 4088

Y of NSM @ Node 1 4089

Z of NSM @ Node 1 4090

Y of NSM @ Node 2 4091

Z of NSM @ Node 2 4092

Y of NSM 4093

Z of NSM 4094

Y of NA @ Node 1 4095

Z of NA @ Node 1 4096

Y of NA @ Node 2 4097

Z of NA @ Node 2 4098

Y of Neut. Axis 4099

499Chapter 7: Modifying the Database Using PCLAdding New Element Types/Properties

Z of Neut. Axis 4100

Center of Curvature 4101

Radial NA Offset 4102

Mean Pipe Radius 4103

Internal Pipe Press. 4104

Stress Intensific. 4105

Symmetry Option 4106

Ys of Lumped Areas 4107

Zs of Lumped Areas 4108

Area Factors 4109

Plate Offset 4111

Membrane Material 4112

Bending Material 4113

Shear Material 4114

Coupling Material 4115

Bending Stiffness 4116

Thickness Ratio 4117

Fiber Dist. 1 4118

Fiber Dist. 2 4119

Extensional Stiff. 12 4121

Extensional Stiff. 14 4122

Integration Network 4124

Output Locations 4125

Integration Scheme 4126

Gap Orientation 4127

Axial Bar Offset 4128

Radial Bar Offset 4129

ID_PROP_BUSH_ORIENTATION 4174

ID_PROP_OFFSET_LOCATION 4177

ID_PROP_STIFFNESS_3 4178

ID_PROP_STRESS_RECOVER_TRAN 4181

ID_PROP_STRESS_RECOVER_ROT 4182

ID_PROP_STRAIN_RECOVER_TRAN 4183

<word_name> <word_id>

PCL and CustomizationAdding New Element Types/Properties

500

Calculating Mass Properties from Element Properties Based on User-Defined Analysis Preferences

Patran can calculate mass properties even if the Analysis Preference is user-defined. In order for thicknesses, areas, concentrated masses, and moments of inertia to be recognized for mass property calculations, the following generic property words must be used to specify those physical properties in the element property record:

If you fail to use the recommended generic property word ID for thickness (36), you can still have mass properties calculated for your shells if the material referenced by the shell element property record is a laminate.

ID_PROP_STRAIN_RECOVER_ROT 4184

ID_PROP_BUSH_ORIENT_SYS 4185

Word Name Word ID

Mass Moment Of Inertia Ixx 17

Mass Moment Of Inertia Iyy 18

Mass Moment Of Inertia Izz 19

Mass 2069

Thickness 36

Area 1

<word_name> <word_id>

501Chapter 7: Modifying the Database Using PCLAdding New Element Types/Properties

Analysis Code Specific Attributes of Property Words

Once all the necessary generic element property words have been defined, assign analysis code specific attributes to the word, such as acceptable data types and data ranges and an analysis specific name for the property word. This is done through the following routine.

db_create_allowable_phys_prop ( <analy_code_id>, <word_id>, <word_name>, <required_flag>, <allow_types>, <default_type>, <dummy_arg>, <accept_int>, <accept_real>, <accept_char> )

Input:

INTEGER <analy_code_id> The analysis code ID.

INTEGER <word_id> The ID of the property word.

CHARACTER STRING

<word_name> The analysis code specific name of the property word.

INTEGER <required_flag> Flag specifying whether this property word is required or optional:

0 = optional

1 = required by analysis code

INTEGER ARRAY

<allow_types> Array of 10 flags specifying what the allowable data types for this property word are. This array is zero filled, (e.g., [1,4,0,0,0,0,0,0,0,0]). The meaning of the flags are:

0 = no more valid data types

1 = real scalar

2 = real vector

3 = integer

4 = character string

5 = material reference

6 = real or integer list

7 = real nodal field

8 = node reference

9 = coordinate frame reference

PCL and CustomizationAdding New Element Types/Properties

502

INTEGER <default_type> Flag specifying the default data type. The meaning of these flags are the same as above.

INTEGER <dummy_arg> This argument is no longer meaningful. In previous releases this argument was used to define the PATRAN 2.5 neutral file order of the property word being defined. Now, the PATRAN 2.5 neutral file order of the property words of a property set should be defined using the <nf_order> argument of the db_create_pp_set_defn_wnord, 503 function.

CHARACTER STRING

<accept_int> PCL string expressing the valid range for any integer input. This string can be any valid PCL logical expression with “prop” used as the keyword. For example, if the value has to be from one to five <accept_int> would be “prop > 0 && prop <= 5.” A blank string implies that all values are valid.

CHARACTER STRING

<accept_real> PCL string expressing the valid range for any real data input. This string can be any valid PCL logical expression with “prop” used as the keyword for scalar real words. and “prop1”, “prop2” and “prop3” used as the keywords for each component of a real vector. For example, if the real value must be positive and greater than zero, “prop > 0” could be used. A blank string implies that all values are valid.

CHARACTER STRING

<accept_char> string inputs. This string can be a list of valid choices separated by commas with “*” signifying that any other input is also valid. For example, if the string must be one of “Tom,” “Dick” or “Harry” then <accept_char> would be “Tom, Dick, Harry”. Whereas, if the string could be “One,” “Two” or “Three” and any other user input, <accept_char> would be “One, Two, Three, *”. A blank string implies that all user input is valid.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

503Chapter 7: Modifying the Database Using PCLAdding New Element Types/Properties

Property Sets

Now, combine the property words into property sets which are merely groupings of property words. This grouping is performed by the function described below.

db_create_pp_set_defn_wnord (<set_id>, <set_name>, <num_prop_words>, <prop_word_ids>, <nf_order> )

Input:

INTEGER <set_id> The ID used for referencing this property set. This ID must be unique with respect to all previously defined property set IDs. Users and third-parties should define IDs in the range 20000 to 29999 to avoid conflicts with MSC-defined IDs.

CHARACTER STRING

<set_name> The name of this property set.

INTEGER <num_prop_words> The number of property words belonging to this property set.

INTEGER ARRAY

<prop_word_ids> An array containing the <num_prop_words> property word IDs of all the property words belonging to this property set.

INTEGER ARRAY

<nf_order> An array containing the word order for all the <num_prop_words> property words assigned to this property set. For example, if a property set has three property words which are to be listed consecutively in Packet 4 of the neutral file, the <nf_order> array would be [1, 2, 3]. If the PATRAN 2.5 neutral file is not going to be used as a mode of model communication, this array can be filled with zeroes or negative ones, e.g., [0, 0, 0] or [-1,-1,-1].If the neutral file order flag is zero for a property word, the property word will be written in the order it is defined in the property set. If you wish a particular property word not to be written to the neutral file, set the corresponding neutral file order flag to -1. For example, if in the example above you don’t want the first word to be written to the neutral file but want the second and third word to be written to the neutral file in consecutive order, the neutral file order array would be [-1,1,2].

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

PCL and CustomizationAdding New Element Types/Properties

504

Error Conditions:

None.

Note: Not only does the above function group property words into a property set, but it also assigns PATRAN 2.5 neutral file order to the property words belonging to this set.

The list of property sets used by MSC supplied analysis interfaces is given below. The IDs of user defined property sets should be distinct form the IDs in this list

505Chapter 7: Modifying the Database Using PCLAdding New Element Types/Properties

.<set_name> <set_id> <set_name> <set_id>

3D Link Gasket 1001 3D Therm Solid (SOLID70,87,90) 2042

2D Link Gasket 1002 Thermal Mass (MASS71) 2043

Axisym Link Gasket 1003 16-Layer Struct Shell (SHELL91) 2044

Plane Strain Gasket 1004 100-Layer Struct Shell(SHELL99) 2045

Plane Stress Gasket 1005 2D Axisymmetric (PLANE2,42,82) 2046

Axisymmetric Gasket 1006 3D Struct Mass (MASS21) 2047

3D Line Gasket 1007 Twist Panel (SHELL28) 2048

Solid Gasket 1008 Bending Panel (SHELL63) 2049

3D Link Gasket (Thick only) 1009 Struct/Therm Surf Effect(SURF6) 2050

2D Link Gasket (Thick only) 1010 2D Axisym Therm (PLANE35,55,77)

2051

Axisym Link Gasket (Thick only)

1011 Struct Solid w/ Rot(SOLID72,73) 2056

Plane Stress Gasket (Thick only)

1013 2D Planar Therm-Elec (PLANE67) 2058

Axisymmetric Gasket (Thick only)

1014 2D Axisym Therm-Elec (PLANE67)

2059

3D Line Gasket (Thick only) 1015 Thermal-Electric Link (LINK68) 2060

Solid Gasket (Thick only) 1016 Thermal-Electric Solid(SOLID69) 2061

3D Link Gasket (Material) 1017 Elastic Straight Pipe (PIPE16) 2062

2D Link Gasket (Material) 1018 Curved Pipe (PIPE18) 2063

Axisym Link Gasket (Material)

1019 Coupled Field Solid (SOLID5,98) 2064

Plane Strain Gasket (Material)

1020 2D Pln Strain Cpld-Fld(PLANE13) 2065

Plane Stress Gasket (Material)

1021 2D Pln Stress Cpld-Fld(PLANE13) 2066

Axisymmetric Gasket (Material)

1022 2D Axisym Coupled-Fld (PLANE13)

2067

3D Line Gasket (Material) 1023 Finite Strain Beam(BEAM188,189) 2069

Solid Gasket (Material) 1024 Finite Strain Beam(BEAM188,189) 2070

Point Mass 1101 Assumed Plane Strain Solid (11) 3001

Rotary Inertia 1102 Assumed Plane Stress Solid (3) 3002

Linear Spring (Grounded) 1111 Assumed Solid (7) 3003

PCL and CustomizationAdding New Element Types/Properties

506

Non-Linear Spring (Grounded)

1112 Assumed Solid w/Auto Tie (7) 3004

Linear Damper (Grounded) 1121 Constant/Assumed w/Auto Tie (7) 3005

Non-Linear Damper (Grounded)

1122 Constant Solid w/Auto Tie (7) 3006

Linear Spring (Axial) 1201 Element 57 - wedge/15 3007

Non-Linear Spring (Axial) 1202 Elements (7,21) - wedge6/15 3008

Linear Spring (Fixed Direction)

1206 Elements (1,89) - bar2/3 3009

Non-Linear Spring (Fixed Direction)

1207 Element 14 - bar2 3010

Rigid Elements (Lbc) 1209 Element 25 - bar2 3011

Rigid Elements (Lbc) 1210 Elements (78,76) - bar2/3 3012

Linear Damper (Axial) 1211 Elements (36,65) - bar2/3 3013

Non-Linear Damper (Axial) 1212 Constant/Assumed Plane Strn(11) 3014

Linear Damper (Fixed Direction)

1216 Constant/Assumed Solid (7) 3015

Non-Linear Damper (Fixed Direction)

1217 Constant Axisymmetric Solid(10) 3016

Gap (Uniaxial) 1221 Constant Plane Strain (11) 3017

Gap (Cylindrical) 1222 Constant Solid (7) 3018

Gap (Spherical) 1223 Damper - (SPRING) 3019

Truss 1231 Element 31 - bar2 3020

Truss (Hybrid) 1232 Element 31 - bar2 3021

General Std in Plane 1251 Element 31 - bar2 3022

General Hyb in Plane 1252 Element 31 - bar2 3023

Box Std in Plane 1253 Element 98 - bar2 3024

Box Hyb in Plane 1254 Element 52 - bar2 3025

Circular Std in Plane 1255 Element 98 - bar2 3026

Circular Hyb in Plane 1256 Element 31 - bar2 3027

I-Sec Std in Plane 1257 Element 31 - bar2 3028

I-Sec Hyb in Plane 1258 Element 12 - bar2 3029

Rectangular Std in Plane 1259 Elements (82,156,33,129) 3030

Rectangular Hyb in Plane 1260 Elements (80,155,32,128) 3031

Hexagonal Std in Plane 1261 Elements (119,156,59) 3032

<set_name> <set_id> <set_name> <set_id>

507Chapter 7: Modifying the Database Using PCLAdding New Element Types/Properties

Hexagonal Hyb in Plane 1262 Elements (118,58) - q4/t3,q8/t6 3033

Trapezoid Std in Plane 1263 Elements (84,157,35,130) 3035

Trapezoid Hyb in Plane 1264 Element 51 - bar2 3036

General Cubic in Plane 1265 Elements (1,89) - bar2/3 3037

General Section CH_2D 1266 Elements (88,87) - bar2/3 3038

Box Cubic in Plane 1267 Elements (85,50,86)-q4,t3,q8/t6 3039

Box Cub_Hyb in plane 1268 Elements (88,87) - bar2/3 3040

Circular Cubic in Plane 1269 Elements (85,50,86)-q4,t3,q8/t6 3041

Circular Cub_Hyb in plane 1270 Elements (75,22) - q4/t3,q8/t6 3042

I-Sec Cubic in Plane 1271 Laminated Plate (49,50) 3043

I-Sec Cub_Hyb in plane 1272 Elements (139,138,72,49) 3044

Rectangular Cubic in Plane 1273 Elements (75,22) - q4/t3,q8/t6 3045

Rectangular Cub_Hyb in plane

1274 Element 25 - bar2 3046

Hexagonal Cubic in Plane 1275 Elements (88,87) - bar2/3 3047

Hexagonal Cub_Hyb in plane

1276 Elements (85,50,86)-q4,t3,q8/t6 3048

Trapezoid Cubic in Plane 1277 Elements (36,65)- bar2/3 3049

Trapezoid Cub_Hyb in plane 1278 Mass - (MASS) 3050

Pipe Std in Plane 1281 Elements (18,30) - q4/t3,q8 3051

Pipe Hyb in Plane 1282 Elements (79,77) - bar2/3 3052

Pipe Cubic in Plane 1283 Elements (75,22) - q4/t3,q8/t6 3053

Pipe Cub_Hyb in Plane 1284 Element 14 - bar2 3054

Rigid Surface (Segments) 1296 Elements (78,76) -bar2/3 3055

Rigid Surface (Bezier 2D) 1297 Plate (49,50) 3056

General Std in Space 1301 Elements (88,87) - bar2/3 3057

General Hyb in Space 1302 Elements (85,50,86)-q4,t3,q8/t6 3058

Box Std in Space 1303 Elements (116,55) - q4/t3,q8/t6 3059

Box Hyb in Space 1304 Elements (122,70) - q4/t3,q8/t6 3060

Circular Std in Space 1305 Elements (115,54) - q4/t3,q8/t6 3061

Circular Hyb in Space 1306 Elements (114,53) - q4/t3,q8/t6 3062

I-Sec Std in Space 1307 Elements (121,69) - q4/t3,q8/t6 3063

I-Sec Hyb in Space 1308 Elements (117,134,57,127) 3064

Rectangular Std in Space 1309 Elements (123,135,71,133) 3065

<set_name> <set_id> <set_name> <set_id>

PCL and CustomizationAdding New Element Types/Properties

508

Rectangular Hyb in Space 1310 Element 68 - quad4 3066

Hexagonal Std in Space 1311 Elements (43,135,44,133) 3067

Hexagonal Hyb in Space 1312 Spring - (SPRING) 3068

Trapezoid Std in Space 1313 Elements (10,2,28,126) 3069

Trapezoid Hyb in Space 1314 Elements (40,38,42,132) 3070

L-Sec Std in Space 1315 Elements (11,6,27,125) 3071

L-Sec Hyb in Space 1316 Elements (3,26,124) 3072

Arbitrary Std in Space 1317 Elements (39,37,41,131) 3073

Arbitrary Hyb in Space 1318 Elements (7,134,21,127) 3074

General Cubic in Space 1319 Elements (75,22) - q4/t3,q8/t6 3075

General Cub_Hyb in Space 1320 Element 51 - bar2 3076

General Cub_Str in Space 1321 Elements (139,138,72,49) 3077

Box Cubic in Space 1322 Elements (9,64) - bar2/3 3078

Box Cub_Hyb in Space 1323 Element 12 - bar2 3079

Box Cub_Str in Space 1324 Elements (20,67) - q4/t3,q8/t6 3080

Circular Cubic in Space 1325 Constant Vol Axi/Twist (20)- Q4 3081

Circular Cub_Hyb in Space 1326 Elements (83,66) - q4/t3,q8/t6 3082

Circular Cub_Str in Space 1327 Elements (5,45) - bar2/3 3083

I-Sec Cubic in Space 1328 Element 45 - bar3 3084

I-Sec Cub_Hyb in Space 1329 Element 45 - bar3 3085

I-Sec Cub_Str in Space 1330 Elements (5,45) - bar2/3 3086

Rectangular Cubic in Space 1331 2D Rigid Contact Surface 3087

Rectangular Cub_Hyb in Space

1332 3D Rigid Contact Surface 3088

Rectangular Cub_Str in Space

1333 Elements (19,29) - q4/t3,q8/t6 3089

Hexagonal Cubic in Space 1334 General/Constant Plane Strn(19) 3090

Hexagonal Cub_Hyb in Space

1335 Element 56 - quad8/tri6 3091

Hexagonal Cub_Str in Space 1336 Elements (119,156,59) 3092

Trapezoid Cubic in Space 1337 Elements (118,155,58) 3093

Trapezoid Cub_Hyb in Space

1338 Elements (120,157,61,130) 3094

Trapezoid Cub_Str in Space 1339 Elements(149,150)-h8/w6,h20/w15 3095

<set_name> <set_id> <set_name> <set_id>

509Chapter 7: Modifying the Database Using PCLAdding New Element Types/Properties

L-Sec Cubic in Space 1340 Elements (107,108) - h8,h20/27 3096

L-Sec Cub_Hyb in Space 1341 Elements (105,106) - h8,h20/27 3097

L-Sec Cub_Str in Space 1342 Element 140 - quad4/tri3 3098

Arbitrary Cubic in Space 1343 Element 140 - quad4/tri3 3099

Arbitrary Cub_Hyb in Space 1344 Elements(81,34)-q4/5/t3/4,q8/t6 3100

Arbitrary Cub_Str in Space 1345 Element 60 - quad8/tri6 3101

Open Std in Space 1351 Elements (151,153)-q4/t3,q8/t6 3102

Open Hyb in Space 1352 Elements (91,93) - q4,q8/9 3103

Pipe Std in Space 1353 Element 62 - quad8/tri6 3104

Pipe Hyb in Space 1354 Element 63 - quad8/tri6 3105

Beam ELBOW31/ELBOW32

1355 Element 73 - quad8/tri6 3106

Beam ELBOW31B 1356 Element 74 - quad8/tri6 3107

Beam ELBOW31C 1357 Elements (95,96) - q4/t3,q8/t6 3108

Pipe Cubic in Space 1358 Elements (152,154)-q4/t3,q8/t6 3109

Pipe Cub_Hyb in Space 1359 Elements (92,94) - q4,q8/9 3110

Pipe Cub_Str in Space 1360 Elements (101,103) - q4,q8/9 3111

Axisymmetric Shell 1371 Elements (102,104) - q4,q8/9 3112

Axisymmetric Shell (Laminated)

1372 Element 13 - bar2 3113

Slide Line 1395 Element 97 - bar2 3114

Rigid Surface (Cylindrical) 1398 Element 90 - bar3 3115

Rigid Surface (Axisymmetric)

1399 Element 15 - bar2 3116

Thermal Link 1401 Element 90 - bar3 3117

Axisym Link w/ Convection 1402 Element 15 - bar2 3118

Axisym Link w/ Conv/Dispersion

1403 Element 16 - bar2 3119

Thermal Axisym Shell 1411 Dummy for 1D Rigid Elements 3120

Thermal Axisym Shell(Laminated)

1412 Dummy for 2D Rigid Elements 3121

Thermal Interface (General) 1491 Damper/Spring (0D) 3125

Axisymmetric Solid 1501 Damper/Spring (1D) 3126

Axisymmetric Solid (Hybrid) 1502 Damper/Spring (Thermal 0D) 3127

<set_name> <set_id> <set_name> <set_id>

PCL and CustomizationAdding New Element Types/Properties

510

Axisymmetric Solid (Red_Int)

1503 Damper/Spring (Thermal 1D) 3128

Axisymmetric Solid (Red_Hyb)

1504 Rebar Elements (165, 168) 3129

Axisymmetric Solid (Incompatible Modes)

1505 Rebar Elements (166, 169) 3130

Axisymmetric Solid (Hybrid Incomp)

1506 Rebar Elements (167, 170) 3131

Axisymmetric Solid (Modified)

1507 Rebar Elements (147, 148) 3132

Axisymmetric Solid (Mod./Hybrid)

1508 Elements(175,176)-h8/w6,h20/w15 3133

Plane Strain 1511 Elements (177,179)-q4/t3,q8/t6 3134

Plane Strain (Hybrid) 1512 Elements (178,180)-q4/t3,q8/t6 3135

Plane Strain (Red_Int) 1513 Lumped Point Mass ( CONM2 ) 4001

Plane Strain (Red_Hyb) 1514 Coupled Point Mass ( CONM1 ) 4002

Plane Strain (Incompatible Modes)

1515 Grounded Scalar Mass ( CMASS1 ) 4003

Plane Strain (Hybrid Incompatible)

1516 Grounded Scalar Spring (CELAS1) 4004

Plane Strain (Modified) 1517 Grounded Scalar Damper (CDAMP1)

4005

Plane Strain (Mod./Hybrid) 1518 Scalar Spring ( CELAS1 ) 4006

Plane Stress (Modified) 1519 Scalar Damper ( CDAMP1 ) 4007

Plane Stress 1521 Viscous Damper ( CVISC ) 4008

Plane Stress (Red_Int) 1522 Scalar Mass ( CMASS1 ) 4009

Plane Stress (Incompatible Modes)

1523 General Section Rod ( CROD ) 4011

General Thick Shell 1531 Pipe Section Rod ( CTUBE ) 4012

General Thin Shell 1532 General Section Beam ( CBAR ) 4013

Thick Shell 1533 Tapered Beam ( CBEAM ) 4014

Thick Shell (Laminated) 1534 Curved General Sec. Beam(CBEND)

4015

Thin Shell 1535 Curved Pipe Section Beam(CBEND)

4016

Thin Shell (Laminated) 1536 Lumped Area Beam (CBEAM/PBCOMP)

4017

Large Strain Shell 1537 Stn. Plane Strain Solid(CQUAD4) 4019

<set_name> <set_id> <set_name> <set_id>

511Chapter 7: Modifying the Database Using PCLAdding New Element Types/Properties

General Large Strain Shell 1538 Rev. Plane Strain Solid(CQUADR) 4020

General Thick Shell (Laminated)

1539 Shear Panel ( CSHEAR ) 4021

General Thin Shell (Laminated)

1540 Stan. Homogeneous Plate(CQUAD4)

4022

Membrane 1551 Stan. Equiv. Sec. Plate(CQUAD4) 4023

Membrane (Red_int) 1552 Stan. Lam. Plate (CQUAD4/PCOMP)

4024

Gen Axi Solid 1561 Rev. Homogeneous Plate (CQUADR)

4025

Gen Axi Solid (Hybrid) 1562 Rev. Equiv. Sect. Plate(CQUADR) 4026

Gen Axi Solid (Red_Int) 1563 Rev. Lam. Plate (CQUADR/PCOMP)

4027

Gen Axi Solid (Red_Hyb) 1564 Stan. Membrane ( CQUAD4 ) 4028

General Plane Strain 1611 Rev. Membrane ( CQUADR ) 4029

General Plane Strain (Hybrid)

1612 Stan. Bending Panel ( CQUAD4 ) 4030

General Plane Strain (Red_Int)

1613 Rev. Bending Panel ( CQUADR ) 4031

General Plane Strain (Red_Hyb)

1614 Solid ( CHEXA ) 4032

General Plane Strain (Incompatible)

1615 Nonadaptive Gap ( CGAP ) 4033

General Plane Strain (Hybrid Incomp.)

1616 Stan. Axisym Solid ( CTRIAX6 ) 4034

Rigid Surface (Bezier 3D) 1696 Adaptive Gap ( CGAP ) 4035

Therm Axisym Solid 1701 P- Formulation Solid 4036

Therm Axisym Solid w/ Convection

1702 General Section Rod ( CONROD ) 4037

Therm Axi_Solid w/ Conv/Dispersion

1703 P- Form. Homogeneous Plate 4038

Therm Planar Solid 1711 P- Form. Equiv. Sec. Plate 4039

Therm Planar Solid w/ Convection

1712 P- Formulation Bending Panel 4040

Therm Pln_Solid w/ Conv/Dispersion

1713 P- Formulation Membrane 4041

Thermal Shell 1721 P- Form. Plane Strain Solid 4042

Thermal Shell (Laminated) 1722 P- Form. Plane Stress Solid 4043

<set_name> <set_id> <set_name> <set_id>

PCL and CustomizationAdding New Element Types/Properties

512

Thermal Interface (Axisym) 1791 P- Formulation General Beam 4044

Thermal Interface (Planar) 1792 Grounded Conductor ( CELAS1 ) 4045

Solid 1801 Grounded Capacitor ( CDAMP1 ) 4046

Solid (Hybrid) 1802 Conductor ( CELAS1 ) 4047

Solid (Reduced_Integration) 1803 Capacitor ( CDAMP1 ) 4048

Solid (Red_Int & Hybrid) 1804 General Section Rod ( CROD ) 4049

Solid (Incompatible Modes) 1805 Pipe Section Rod ( CTUBE ) 4050

Solid (Hybrid Incompatible) 1806 General Section Beam ( CBAR ) 4051

Composite Solid 1807 Tapered Beam ( CBEAM ) 4052

Composite Solid (Hybrid) 1808 Curved General Sec. Beam(CBEND)

4053

Composite Solid (Red_Integration)

1809 Curved Pipe Section Beam(CBEND)

4054

Composite Solid (Red_Int & Hybrid)

1810 Flow Tube ( CHBDYP ) 4055

Composite Solid (Incompat. Modes)

1811 Axisym Solid ( CTRIAX6 ) 4056

Composite Solid (Hybrid Incompat.)

1812 Stan. Homogeneous Plate(CQUAD4)

4057

Solid (Modified) 1821 Solid ( CHEXA ) 4058

Solid (Modified/Hybrid) 1822 PLOTEL element 4059

Thermal Solid 1901 Aero Flat Plate 4060

Thermal Solid w/ Convection 1902 Aero Body Flat 4061

Thermal Solid w/ Conv/Dispersion

1903 Aero Lift Curved 4062

CONN3D2 -- ALIGN 1921 Grounded Bush Joint 4063

CONN3D2 -- AXIAL 1922 Scalar Bush Joint 4064

CONN3D2 -- BEAM 1923 Hyp. Axis Solid(CTRIAX,CQUADX)

4065

CONN3D2 -- CARDAN 1924 Hyp. Plane Strain Solid(CQUAD4) 4066

CONN3D2 -- CARTESIAN 1925 Hyperelastic Solid ( CHEXA ) 4067

CONN3D2 -- CONSTANT VELOCITY

1926 P- Form Tapered Beam ( CBEAM ) 4068

CONN3D2 -- CVJOINT 1927 P- Formulation General Beam 4069

CONN3D2 -- CYLINDRICAL

1928 P- Form. Homogeneous Plate 4070

<set_name> <set_id> <set_name> <set_id>

513Chapter 7: Modifying the Database Using PCLAdding New Element Types/Properties

CONN3D2 -- EULER 1929 P- Formulation Solid 4071

CONN3D2 -- FLEXION-TORSION

1930 General Beam ( CBEAM ) 4072

CONN3D2 -- HINGE 1931 Std. Plane Stress Solid(CQUAD4) 4073

CONN3D2 -- JOIN 1932 Rev. Plane Stress Solid(CQUAD4) 4074

JOINTC -- 3D 1933 Solid (Laminated) 4075

CONN3D2 -- LINK 1934 Axisym Solid (CTRIAX, CQUADX) 4076

CONN3D2 -- PLANAR 1935 3D Mass w/ Rotary Inertia 5001

CONN3D2 -- RADIAL-THRUST

1936 2D Point Mass 5002

CONN3D2 -- REVOLUTE 1937 3D Beam 5003

CONN3D2 -- ROTATION 1938 3D Spar (Truss) 5004

CONN3D2 -- SLIDE-PLANE

1939 Rigid Element 5005

CONN3D2 -- SLOT 1940 Translational/Torsional Spring 5006

CONN3D2 -- TRANSLATOR

1941 3D Gap 5007

CONN3D2 -- UJOINT 1942 2D Axisymmetric 5008

CONN3D2 -- UNIVERSAL 1943 2D Plane Strain 5009

CONN3D2 -- WELD 1944 2D Plane Stress 5010

CONN2D2 -- ALIGN 1971 Homogeneous Shell 5011

CONN2D2 -- AXIAL 1972 MEMBRANE 5012

CONN2D2 -- BEAM 1973 Shear Panel 5013

CONN2D2 -- CARTESIAN 1974 3D Solid 5014

CONN2D2 -- JOIN 1975 Translational/Torsional Damper 5015

JOINTC -- 2D 1976 Laminated Shell 5016

CONN2D2 -- LINK 1977 Rigid Bar (Bar/2/4) 5017

CONN2D2 -- ROTATION 1978 SHELL 7001

CONN2D2 -- SLOT 1979 2D 7002

CONN2D2 -- TRANSLATOR

1980 AXISYMMETRIC 7003

CONN2D2 -- WELD 1981 3D SOLID 7004

Generalized Axisym Rebar 1982 CONDUCTION BAR 7005

Axisymmetric Rebar 1983 ADVECTION BAR 7006

Cylindrical Rebar 1984 FLOW NETWORK BAR 7007

<set_name> <set_id> <set_name> <set_id>

PCL and CustomizationAdding New Element Types/Properties

514

General Rebar 1985 RADIATION SYM BAR ROTATION

7008

General Rebar (Reduced) 1986 PIPE 7009

Thermal Interface (Solid) 1991 TURBINE 7010

2D Spar (LINK1) 2001 PUMP 7011

2D Plane Strain (PLANE2,42,82)

2002 HEAD LOSS ELEMENT 7012

2D Plane Stress (PLANE2,42,82)

2003 CHECK VALVE 7013

2D Elastic Beam (BEAM3) 2004 PLENUM 7014

3D Elastic Beam (BEAM4) 2005 FINITE DIFF. HEX 7015

Struct Surface Effect (SURF6)

2006 SPHERE ELEMENT 7016

Thermal Surface Effect (SURF6)

2007 NODE TYPE 7017

3D Spar (LINK8) 2008 CONVECTIVE QUAD 7018

Cable (LINK10) 2009 CONVECTIVE HEX/WEDGE 7019

2D Pt-Pt Contact (CONTAC12)

2010 RAD SYM TRI - No Data Required 7020

Spring-Damper Axial (COMBIN14)

2011 AXISYMMETRIC BAR 7021

Spring-Damper Fixed (COMBIN14)

2012 REFLC SYM BAR, No Data Required

7022

Thermal Spring-Damper(COMBIN14)

2013 CONSTANT PROPERTY PIPE 7023

2D Structural Mass (MASS21)

2014 CONST PROP PIPE W/MOODY CURVE

7024

2D Struct Mass w/ Rot (MASS21)

2015 VARIABLE PROPERTY PIPE 7025

3D Struct Mass w/ Rot (MASS21)

2016 Scaled Bar Element 7026

2D Beam-Rect Section (BEAM23)

2017 Scaled Shell Element 7027

2D Beam-Pipe Section (BEAM23)

2018 Scaled Solid Element 7028

2D Beam-Circ Section (BEAM23)

2019 Specified Axisym Bar Rotation 7029

2D Beam-General Sect (BEAM23)

2020 Specified Axisym Rotation 7030

<set_name> <set_id> <set_name> <set_id>

515Chapter 7: Modifying the Database Using PCLAdding New Element Types/Properties

3D Thin-Walled Beam (BEAM24)

2021 Thermal 2D Condition Bar 7031

2D Pt-Grnd Contact (CONTAC26)

2022 Thermal 2D Scaled Condition Bar 7032

Shear Panel (SHELL28) 2023 CMA HEX Element Properties 7033

Radiation Link (LINK31) 2024 Axisymmetric Solid 8001

Conduction Bar (LINK32/33)

2025 2D Solid 8002

Convection Link (LINK34) 2026 Solid 8003

2D Planar Therm (PLANE35,55,77)

2027 Generic 0D 9001

Non-Linear Spring (COMBIN39)

2028 Generic 1D 9002

Thermal Spring (COMBIN39)

2029 Generic 2D 9003

Combination (COMBIN40) 2030 Generic 3D 9004

Thermal Combination (COMBIN40)

2031

Membrane Shell (SHELL41) 2032

Structural Shell (SHELL43/93)

2033

Tapered Unsym Beam (BEAM44)

2034

Struct Solid (SOLID45,92,95)

2035

Layered Struct Solid (SOLID46)

2036

Axisymmetric Shell (SHELL51)

2037

3D Pt-Pt Contact (CONTACT52)

2038

Tapered Unsym Beam (BEAM54)

2039

Thermal Shell (SHELL57) 2040

Elastic Shell (SHELL63) 2041

<set_name> <set_id> <set_name> <set_id>

PCL and CustomizationAdding New Element Types/Properties

516

Associating Property Sets with Element Types

The first step in associating property sets to element types is to determine the appropriate element topology codes. This can be done using the functions described in MSC Patran Element Topology Codes (p. 488).

517Chapter 7: Modifying the Database Using PCLAdding the New Material Properties

Adding the New Material PropertiesThe steps taken to define material properties are:

• Define the material categories (e.g., Isotropic, 2D Orthotropic, Composite) applicable to the analysis code.

• Define the material models (e.g., Elastic, Plastic, Creep) applicable to each material category.

• Define the material options (e.g., stress/strain curve versus hardening slope for plasticity) and the material option categories (e.g., Yield Function, Hardening Rule, Failure Theory) and then associate them with the material models.

• Define the generic material property words (e.g., Poisson Ratio 12), assign analysis code specific attributes to the material words.

• Group the material words into material records.

Material Categories

First, identify which material categories are valid for the new analysis code. Material categories are generally synonymous with material directionalities such as Isotropic and 2D Orthotropic. There are two steps in the process of defining material categories: defining the material categories and then associating these material categories to the analysis code.

Composite is also a material category. But, unlike the standard material categories Composite is automatically associated to all analysis codes. Composite is not user definable and should not be referenced in any of the material property definition commands described in this chapter.

The PCL function to define the material categories is::

db_create_matl_category (<analy_code_id>, <cat_id>, <cat_name>, <dir_code>)

Input:

INTEGER <analy_code_id> The ID of the new analysis code. Analysis code IDs are described in Adding A New Analysis Preference, 454.

INTEGER <cat_id> The ID to be used for referencing this material category. This ID must be unique with respect to all material category IDs previously defined in this analysis code but can and should be duplicates of material category IDs used in other analysis codes.

CHARACTER STRING

<cat_name> The analysis code specific name of this material category.

INTEGER <dir_code> A code specifying the directionality of this material category. Material directionality codes are described in Material Directionalities, 472.

Output:

PCL and CustomizationAdding the New Material Properties

518

Unlike most of the element property data, material categories must be uniquely defined for a specific analysis code. But, for the sake of data transfer the material category IDs used should remain the same. For example, it would take two definition (“db_create_matl_category”) calls to define a given material category in both MSC Nastran and MSC.Marc, but the same material category ID would be used in both calls. The IDs which should be used for specific material categories are given below. If the material category of interest does not exist in the following list, a new and unique ID should be used.

To associate the material categories with the analysis code, the following PCL function should be used.

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

<cat_name> <cat_id>

Isotropic 1

3D Orthotropic 2

3D Anisotropic 3

2D Orthotropic 5

2D Anisotropic 4

db_create_valid_mtl_categories (<analy_code_id>, <analy_type_id>, <cat_ids>, <num_cats>)

Input:

INTEGER <analy_code_id> The ID of the new analysis code. Analysis code IDs are described in Adding A New Analysis Preference, 454.

INTEGER <analy_type_id> The ID of the analysis type. Analysis type IDs are described in Adding A New Analysis Preference (p. 357).

INTEGER ARRAY

<cat_ids> The <num_cats> IDs of all the material categories valid for this analysis code.

INTEGER <num_cats> The number of material categories valid for this analysis code not including Composite which is automatically associated with all analysis codes.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

519Chapter 7: Modifying the Database Using PCLAdding the New Material Properties

Error Conditions:

None.

PCL and CustomizationAdding the New Material Properties

520

Material Models

Next, define the material models used in the new analysis code and associate these material models with the appropriate material categories. In many cases, the material model is synonymous with the material linearity (e.g., elastic or plastic).

The PCL function to define the material models is:

Unlike most of the element property data, material models must be uniquely defined for a specific analysis code. But, for the sake of data transfer the material model IDs used should remain the same. For example, it would take two definition (“db_create_constitutive_model”) calls to define a given material model in both MSC Nastran and MSC.Marc, but the same material model ID would be used in both calls. The IDs which should be used for specific material models are given below. If the material model of interest does not exist in the following list, a new and unique ID should be used.

db_create_constitutive_model (<analy_code_id>, <model_id>, <model_name>, <lin_code>)

Input:

INTEGER <analy_code_id> The ID of the new analysis code. Analysis code IDs are described in Adding A New Analysis Preference, 454.

INTEGER <model_id> The ID to be used for referencing this material model. This ID must be unique with respect to all material model IDs previously defined in this analysis code but can and should be duplicates of material model IDs used in other analysis codes.

CHARACTER STRING

<model_name> The analysis code specific name of this material model.

INTEGER <lin_code> A code specifying the linearity of this material model. Material linearity codes are described in Material Linearities, 472.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

521Chapter 7: Modifying the Database Using PCLAdding the New Material Properties

To associate the material models with the appropriate material categories, the following PCL function is used.

<model_name> <model_id>

Linear Elastic 1

Nonlinear Elastic 2

Elastoplastic 3

Failure 4

Creep 5

Viscoelastic 7

Swelling 8

Thermal 10

Hyperelastic 11

db_create_valid_const_models (<analy_code_id>, <analy_type_id>, <cat_id>, <model_ids>, <num_models>)

Input:

INTEGER <analy_code_id> The ID of the new analysis code. Analysis code IDs are described in Adding A New Analysis Preference, 454.

INTEGER <analy_type_id> The ID of the analysis type. Analysis type IDs are described in Adding A New Analysis Preference (p. 357).

INTEGER <cat_id> The material category ID as described in Material Categories, 517.

INTEGER ARRAY

<model_ids> The <num_models> IDs of all the material models associated with this material category.

INTEGER <num_models> The number of material models valid for this material category.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

PCL and CustomizationAdding the New Material Properties

522

Material Options and Material Option Categories

Now that the material models and material categories have been defined, create the material options and material option categories. Associate the right material options with each material option category and associate the appropriate material option categories with each of the material categories and material models.

The following function is used to define the material option categories.

Material option categories must be uniquely defined for a specific analysis code. But, for the sake of data transfer the material option category IDs used should remain the same. For example, it would take two definition (“db_create_mtl_magics_defn”) calls to define a given material option category in both MSC Nastran and MSC.Marc, but the same material option category ID would be used in both calls. The IDs which should be used for specific material option categories are given below. If the material option category of interest does not exist in the following list, a new and unique ID should be used.Users and third-parties should define IDs in the range 20000 to 29999 to avoid conflicts with MSC-defined IDs.

db_create_mtl_magics_defn (<analy_code_id>, <analy_type_id>, <opt_cat_id>, <opt_cat_name>)

Input:

INTEGER <analy_code_id> The ID of the new analysis code. Analysis code IDs are described in Adding A New Analysis Preference, 454.

INTEGER <analy_type_id> The ID of the analysis type. Analysis type IDs are described in Adding A New Analysis Preference (p. 357).

INTEGER <opt_cat_id> The ID to be used for referencing this material option category. This ID must be unique with respect to all material option category IDs previously defined in this analysis code but can and should be duplicates of material option category IDs used in other analysis codes.

CHARACTER STRING

<opt_cat_name> The analysis code specific name for this material option category.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

523Chapter 7: Modifying the Database Using PCLAdding the New Material Properties

The PCL function used to define the material options is described below:

<opt_cat_name> <opt_cat_id>

Composite Failure Theory 1

Failure Criteria 2

Plastic Data Input 3

Yield Function 4

Hardening Rule 5

Creep Data Input 6

Elastic Data Input 7

Creep Law 8

Rate Dependency 9

Domain Type 10

Definition Type 11

Anisotropic Yield Criteria 12

Order of Polynomial 13

Strain Energy Potential 14

Orthotropic Yield Criteria 15

PCL and CustomizationAdding the New Material Properties

524

Material options must be uniquely defined for a specific analysis code. But, for the sake of data transfer the material option IDs used should remain the same. For example, it would take two definition (“db_create_mtl_magics_options”) calls to define a given material option in both MSC Nastran and MSC.Marc, but the same material option ID would be used in both calls. The IDs which should be used for specific material options are given below. If the material option of interest does not exist in the following list, a new and unique ID should be used. Users and third-parties should define IDs in the range 20000 to 29999 to avoid conflicts with MSC-defined IDs

db_create_mtl_magics_options (<analy_code_id>,<opt_id>,<opt_name>)

Input:

INTEGER <analy_code_id> The ID of the new analysis code. Analysis code IDs are described in Adding A New Analysis Preference, 454.

INTEGER <opt_id> The ID to be used for referencing this material option. This ID must be unique with respect to all material option IDs previously defined in this analysis code but can and should be duplicate of material option IDs used in other analysis codes.

CHARACTER STRING

<opt_name> The analysis code specific name for this material option.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

525Chapter 7: Modifying the Database Using PCLAdding the New Material Properties

.

<opt_name> <opt_id>

Not Applicable 1

Hill Failure Theory 2

Hoffman Failue Theory 3

Tsai-Wu Failure Theory 4

Maximum Strain Theory 5

Stress Failure Criteria 6

Strain Failure Criteria 7

Stress/Strain Curve 8

Hardening Slope 9

VonMises Yield Function 10

Tresca Yield Function 11

Mohr-Coulomb Yield 12

Drucker-Prager Yield 13

Isotropic Hardening 14

Kinematic Hardening 15

Combined Hardening 16

Tabular Creep Input 17

Creep Law 111 18

Creep Law 112 19

Creep Law 121 20

Creep Law 122 21

Creep Law 211 22

Creep Law 212 23

Creep Law 221 24

<opt_name> <opt_id>

Creep Law 222 25

Creep Law 300 26

Parabolic Drucker-Prager 27

Perfectly Plastic 28

Maximum Stress Theory 29

None 30

PCL and CustomizationAdding the New Material Properties

526

Now specify which material options belong to which material option category. The PCL function described below performs this function.

Add 31

Deformation 32

Modified Drucker/Cap 33

ORNL 34

Cap Hardening 37

Compression 38

Tension 39

Shear 40

10 Cycle 41

100 Cycle 42

ORNL Hardening 43

Engineering Constants 44

[D] Matrix 45

Time 46

Frequency 47

Strain 48

Hyperbolic 49

Formula 50

Tabular 51

Prony 52

Test Data 53

First Order Polynomial 54

Second Order Polynomial 55

Third Order Polynomial 56

Fourth Order Polynomial 57

Fifth Order Polynomial 58

Sixth Order Polynomial 59

Polynomial 60

Ogden 61

<opt_name> <opt_id>

527Chapter 7: Modifying the Database Using PCLAdding the New Material Properties

The material option categories are associated with the appropriate material categories and material models with the following PCL function.

db_create_mtl_allowable_magics (<analy_code_id>, <cat_id>, <opt_cat_id>, <opt_ids>, <num_opts>)

Input:

INTEGER <analy_code_id> The ID of the new analysis code. Analysis code IDs are described in Adding A New Analysis Preference, 454.

INTEGER <cat_id> The ID of the Material Categories, 517.

INTEGER <opt_cat_id> The ID of the material option category.

INTEGER ARRAY

<opt_ids> The <num_opts> IDs of all the material options grouped under this material option category.

INTEGER <num_opts> The number of material options grouped under this material option category.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

db_create_mtl_magics (<analy_code_id>, <analy_type_id>, <cat_id>, <model_id>, <opt_cat_ids>, <num_opt_cats>)

Input:

INTEGER <analy_code_id> The ID of the new analysis code. Analysis code IDs are described in Adding A New Analysis Preference, 454.

INTEGER <analy_type_id> The ID of the analysis type. Analysis type IDs are described in Adding A New Analysis Preference (p. 357).

INTEGER <cat_id> The ID of the material category. See Material Categories, 517.

INTEGER <model_id> The ID of the material model. See Material Models, 520.

INTEGER ARRAY

<opt_cat_ids> The <num_opt_cats> IDs of the material option categories to be associated with this material model under this material category.

INTEGER <num_opt_cats> The number of material option categories to be associated with this material model under this material category.

Output:

PCL and CustomizationAdding the New Material Properties

528

Material Property Words

To create material property words, first define the material words generically, if they have not already been defined, and then assign analysis code specific attributes to these material words such as an analysis code specific name and allowable field types. The function used to define new material words is described below.

The list of material property words defined by “load_generics()” is:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

db_create_matl_prop_defn (<word_id>, <word_name> )

Input:

INTEGER <word_id> The ID used to reference this material property word. This ID must be unique with respect to all previously defined material property word IDs. Users and third-parties should define IDs in the range 20000 to 29999 to avoid conflicts with MSC-defined IDs.

CHARACTER STRING

<word_name> The generic name of this material property word.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

529Chapter 7: Modifying the Database Using PCLAdding the New Material Properties

<word_name> <word_id>

Reference Temperature 1

Elastic Modulus 2

Elastic Modulus 22 3

Elastic Modulus 33 4

Poisson Ratio 5

Poisson Ratio 23 6

Poisson Ratio 31 7

Shear Modulus 8

Shear Modulus 23 9

Shear Modulus 31 10

Poisson Ratio 13 13

Bulk Modulus 14

Lame Constant 15

Density 16

Conductivity 17

Conductivity 12 18

Conductivity 13 19

Conductivity 22 20

Conductivity 23 21

Conductivity 33 22

Specific Heat 23

Thermal Expansion Coeff 24

Thermal Expansion Coeff 22 25

Thermal Expansion Coeff 33 26

Thermal Expansion Coeff 12 27

Thermal Expansion Coeff 23 28

Thermal Expansion Coeff 31 29

Structural Damping Coeff 30

Emissivity 31

Rate Dependent Param D 1013

Rate Dependent Param p 1014

Dilation Angle 1016

Ratio of Flow Stresses 1017

PCL and CustomizationAdding the New Material Properties

530

Absolute Plastic Strain 1018

Exponent 1019

Yield Offset 1020

Material Cohesion 1023

Eccentricity Parameter 1024

Yield Surface Transition 1025

Surface Radius Parameter 1026

<word_name> <word_id>

531Chapter 7: Modifying the Database Using PCLAdding the New Material Properties

<word_name> <word_id>

Hydrostatic Yield Stress 1027

Volumetric Plastic Strain 1028

Real Part of g1 1101

Imaginary Part of g1 1102

Value of a 1103

Real Part of k1 1104

Imaginary Part of k1 1105

Value of b 1106

Value of A 1201

Value of B 1202

Value of n 1203

Value of m 1204

Value of delta_H 1205

Value of R 1206

Coefficient C10 1301

Coefficient C20 1302

Coefficient C30 1303

Coefficient C40 1304

Coefficient C50 1305

Coefficient C60 1306

Coefficient C01 1311

Coefficient C02 1312

Coefficient C03 1313

Coefficient C04 1314

Coefficient C05 1315

Coefficient C06 1316

Coefficient C11 1321

Coefficient C21 1322

Coefficient C12 1323

Coefficient C31 1324

Coefficient C22 1325

Coefficient C13 1326

Coefficient C41 1327

PCL and CustomizationAdding the New Material Properties

532

Coefficient C32 1328

Coefficient C23 1329

Coefficient C14 1330

Coefficient C51 1331

Coefficient C42 1332

Coefficient C33 1333

Coefficient C24 1334

Coefficient C15 1335

Coefficient MU1 1401

Coefficient MU2 1402

Coefficient MU3 1403

Coefficient MU4 1404

Coefficient MU5 1405

Coefficient MU6 1406

Coefficient ALPHA_1 1411

Coefficient ALPHA_2 1412

Coefficient ALPHA_3 1413

Coefficient ALPHA_4 1414

Coefficient ALPHA_5 1415

Coefficient ALPHA_6 1416

Coupling Stiffness 22 96

Coupling Stiffness 23 97

Coupling Stiffness 33 98

<word_name> <word_id>

533Chapter 7: Modifying the Database Using PCLAdding the New Material Properties

<word_name> <word_id>

Tension Stress Limit 99

Compression Stress Limit 100

Shear Stress Limit 101

Tension Stress Limit 22 102

Compression Stress Limit 22 103

Shear Stress Limit 23 104

Tension Stress Limit 33 105

Compression Stress Limit 33 106

Shear Stress Limit 31 107

Tension Strain Limit 108

Compression Strain Limit 109

Shear Strain Limit 110

Tension Strain Limit 22 111

Compression Strain Limit 22 112

Shear Strain Limit 23 113

Tension Strain Limit 33 114

Compression Strain Limit 33 115

Shear Strain Limit 31 116

Ht Ratio 117

Hardening Slope 120

Yield Point 121

Equivalent Yield Stress (J1=0) 122

Alpha 123

Beta 124

Stress 11 Yield Ratio 125

Stress 22 Yield Ratio 126

Stress 33 Yield Ratio 127

Stress 12 Yield Ratio 128

Stress 23 Yield Ratio 129

Stress 31 Yield Ratio 130

Internal Friction Angle 131

Bonding Shear Stress Limit 132

Interaction Term 133

PCL and CustomizationAdding the New Material Properties

534

Failure Index 134

Creep Reference Temperature 135

Creep Threshold Factor 136

Temperature Dependence Exponent 137

Primary Creep Stiffness 138

Primary Creep Damping 139

Secondary Creep Damping 140

Coefficient A 141

Coefficient B 142

Coefficient C 143

Coefficient D 144

Coefficient E 145

Coefficient F 146

Coefficient G 147

Interaction Term 23 148

Interaction Term 31 149

Stress/Strain Curve 503

Mass Propornl Damping 1001

2nd. Yield Stress 1011

Plastic Strain 1012

<word_name> <word_id>

535Chapter 7: Modifying the Database Using PCLAdding the New Material Properties

<word_name> <word_id>

Stiffness Propornl Damping 1002

Fraction Critical Damping 1003

Composite Options Flag 37

Positive Definite Flag 38

Total Laminate Thickness 39

Number of Plies 40

Laminate Offset 41

Moisture Expansion Coeff 11 42

Moisture Expansion Coeff 22 43

Moisture Expansion Coeff 33 44

Moisture Expansion Coeff 12 45

Moisture Expansion Coeff 23 46

Moisture Expansion Coeff 31 47

Force Resultant (N1) per Temp 48

Force Resultant (N2) per Temp 49

Force Resultant (N12) per Temp 50

Moment Resultant (M1) per Temp 51

Moment Resultant (M2) per Temp 52

Moment Resultant (M12) per Temp 53

Stiffness 11 54

Stiffness 12 55

Stiffness 13 56

Stiffness 22 57

Stiffness 23 58

Stiffness 33 59

Stiffness 44 60

Stiffness 45 61

Stiffness 46 62

Stiffness 55 63

Stiffness 56 64

Stiffness 66 65

Stiffness 14 66

Stiffness 15 67

PCL and CustomizationAdding the New Material Properties

536

Stiffness 16

Stiffness 24 69

Stiffness 25 70

Stiffness 26 71

Stiffness 34 72

Stiffness 35 73

Stiffness 36 74

Stiffness 11 75

Stiffness 12 76

Stiffness 13 77

Stiffness 22 78

Stiffness 23 79

Stiffness 33 80

Membrane Stiffness 11 81

Membrane Stiffness 12 82

Membrane Stiffness 13 83

Membrane Stiffness 22 84

Membrane Stiffness 23 85

Membrane Stiffness 33 86

Bending Stiffness 11 87

Bending Stiffness 12 88

Bending Stiffness 13 89

<word_name> <word_id>

537Chapter 7: Modifying the Database Using PCLAdding the New Material Properties

To assign analysis code specific attributes to the material word the following function should be used.

<word_name> <word_id>

Bending Stiffness 22 90

Bending Stiffness 23 91

Bending Stiffness 33 92

Coupling Stiffness 11 93

Coupling Stiffness 12 94

Coupling Stiffness 13 95

Coefficient D1 1421

Coefficient D2 1422

Coefficient D3 1423

Coefficient D4 1424

+Coefficient D5 1425

Coefficient D6 1426

SigmaYY/Strain Curve 2002

SigmaZZ/Strain Curve 2003

SigmaXY/Strain Curve 2004

SigmaYZ/Strain Curve 2005

SigmaZX/Strain Curve 2006

db_create_matl_prop_alias (<analy_code_id>, <analy_type_id>, <cat_id>, <model_id>, <word_id>, <word_name>, <table_type> )

Input:

INTEGER <analy_code_id> The ID of the new analysis code. Analysis code IDs are described in Adding A New Analysis Preference, 454.

INTEGER <analy_type_id> The ID of the analysis type. Analysis type IDs are described in Adding A New Analysis Preference (p. 357).

INTEGER <cat_id> The ID of the material category. See Material Categories, 517.

INTEGER <model_id> The ID of the material model. See Material Models, 520.

INTEGER <word_id> The generic ID of the material word.

CHARACTER STRING

<word_name> The analysis code specific name of the material word.

PCL and CustomizationAdding the New Material Properties

538

Material Records

The last step in defining material properties is to group the material property words into material property records, i.e., specify which material words are valid for a unique choice of material category, material model and material options. This task is accomplished with the following PCL function.

INTEGER <table_type> A flag specifying which type of fields can be referenced by this material word. The meaning of this flag is as follows:

0 = No type of field allowed.

1 = Stress dependent field allowed.

2 = Strain dependent field allowed.

3 = Strain dependent or strain and temperature dependent fields allowed.

4 = Temperature dependent fields allowed.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

db_create_allowable_matl_prop (<analy_code_id>, <analy_type_id>, <cat_id>, <model_id>, <opt_ids>, <word_ids>, <num_words> )

Input:

INTEGER <analy_code_id> The ID of the new analysis code. Analysis code IDs are described in Adding A New Analysis Preference, 454.

INTEGER <analy_type_id> The ID of the analysis type. Analysis type IDs are described in Adding A New Analysis Preference (p. 357).

INTEGER <cat_id> The ID of the material category. See Material Categories, 517.

INTEGER <model_id> The ID of the material model. See Material Models, 520.

539Chapter 7: Modifying the Database Using PCLAdding the New Material Properties

INTEGER ARRAY

<opt_ids> The IDs of the five material option choices for the possible five material option categories related to this material model under this material category by db_create_mtl_magics, 527. This array is blank filed and in the same order as the material option categories defined by db_create_mtl_magics. For example, if there are two material option categories defined with this material model under this material category and the choices are option_cat_1( 1, 2 ) and option_cat_2( 5, 6, 7 ) then the six calls needed to fully define this material record would have the <opt_ids> arrays of [1,5,0,0,0], [1,6,0,0,0], [1,7,0,0,0], [2,5,0,0,0], [2,6,0,0,0] and [2,7,0,0,0]. If some of these combinations were invalid, say choices 1 and 8 were not compatible, this fact can be expressed to Patran by either not making the function call with array [1,8,0,0,0] in it or by specifying zero material words ( <num_words> = 0 ) in this call. Material option IDs are further discussed in the Material Options and Material Option Categories, 522.

INTEGER ARRAY

<word_ids> The <num_words> IDs of the material words which are valid for this specified combination of material category, material model and material options. See Material Property Words, 528 for more information.

INTEGER <num_words> The number of material words valid for the specified combination of material category, material model and material options. Zero signifies that this specified combination of material options is invalid.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

PCL and CustomizationAdding New Loads and Boundary Conditions

540

Adding New Loads and Boundary ConditionsTo create loads and boundary condition definitions, define the load type, assign application regions, element data attributes and node data attributes to the new load and then associate the load type to the analysis code of interest. The full definitions for all the load types listed under the description of the load_id argument for “db_create_lbc_type_defn” exist in all Patran databases. You may either associate these already existing load types to your new analysis code or you may define unique load types. To define a new load, the functions lbc_defn_create.lbc_defn, 550 and lbc_defn_create.lbc_var_defn, 553 should be used.

Common ID Numbers used in LBC Functions

The following tables present ID numbers used in various loads and boundary conditions throughout this section.

.

Table 7-1 Graphics Symbols for LBCs

ID/TypeID ID/Type

0 = arrow without a head. 103 = X.

1 = one headed arrow. 104 = cross.

2 = two headed arrow. 105 = filled circle.

3 = three headed arrow. 106 = square.

4 = one head, no arrow. 107 = filled square.

5 = two heads, no arrow. 108 = triangle.

6 = three heads, no arrow. 109 = filled triangle.

101 = dot. 110 = diamond.

102 = circle. 111 = filled diamond.

Table 7-2 Standard Colors for LBCs*

ID/Color ID/Color

0 = black. 8 = dark red. The user may change the ID to color association. See Color Palette (p. 376) in the Patran Reference Manual. If changed, all or part of this table will be invalid.

1 = red. 9 = bright red.

2 = green. 10 = dark green.

3 = yellow. 11 = bright green.

4 = blue. 12 = dark blue.

5 = red. 13 = bright blue.

6 = cyan. 14 = dark red.

7 = white. 15 = bright red.

541Chapter 7: Modifying the Database Using PCLAdding New Loads and Boundary Conditions

Table 7-3 Patran Internally Assigned LBCs Color Box IDs

Color Box ID

Analysis Type

Structural CFD Thermal

601 displacement

602 force, voltage voltage

603 pressure

604 temperature

605 inertial load

606 initial displacement

607 initial velocity

608 velocity

609 acceleration

610 temperature

611 convection

612 heat flux

613 heat source

614 initial temperature

615 inflow (incompressible)

616 outflow (incompressible)

temperature

617 volumetric heat

618 solid wall (incompressible)

619 distributed total heat load

620 symmetry

621 inflow (compressible)

622 outflow (compressible)

623 open (compressible)

624 solid wall (compressible)

625 temperature

626 convection

PCL and CustomizationAdding New Loads and Boundary Conditions

542

627 heat flux

628 heat source

629 volume. heat source

630 pressure

631 mass flow rate

632 view factors, radiation

Table 7-4 Patran Internally Assigned LBCs Load Type IDs

ID/Load Types ID/Load Types

1 = inflow (incompressible) 19 = initial temperature

2 = outflow (incompressible) 21 = inflow (compressible)

4 = solid wall (incompressible) 22 = outflow (compressible)

5 = symmetry 23 = open flow (compressible)

6 = displacement 24 = solid wall (compressible)

7 = force 34 = distributed load

8 = pressure 35 = voltage

9 = temperature 36 = voltage (thermal)

10 = inertial load 40 = friction

11 = initial displacement 41 = contact (absolute)

12 = initial velocity 42 = contact (relative)

13 = velocity 43 = temperature (Samcef)

14 = acceleration 44 = displacement retained (Samcef)

15 = thermal temperature 45 = load (Samcef)

16 = convection 46 = flux (Samcef)

17 = heat flux 47 = hybrid deformation (Samcef)

18 = heat source 48 = append

Table 7-3 Patran Internally Assigned LBCs Color Box IDs (continued)

Color Box ID

Analysis Type

Structural CFD Thermal

543Chapter 7: Modifying the Database Using PCLAdding New Loads and Boundary Conditions

LBC Functions for Customization

51 = Temperature (PThermal)[Fixed] 78 = inertial load (Patran TEAM)

52 = Temperature (PThermal)[Time Table]

91 = volumetric heat

54 = Temperature (PThermal)[Coupled] 92 = total heat load

55 = Temperature (PThermal)[Initial] 101 = Convection (PThermal)[Fixed Coefficient]

56 = Temperature (PThermal)[Template] 102 = Convection (PThermal)[Time Table]

60 = Heating (PThermal)[]Flux, Fixed 103 = Convection (PThermal)[Temperature Table]

61 = Heating (PThermal)[Flux, Time Table]

105 = Convection (PThermal)[Template, Convection]

62 = Heating (PThermal)[Flux, Temperature Table]

110 = Radiation (PThermal)[Gap Radiation]

67 = Heating (PThermal)[Template, Fluxes]

112 = Radiation (PThermal)[Template, View Factors]

68 = Heating (PThermal)[Template, Volumetric Heat]

116 = Pressure (PThermal)[Fixed]

69 = Heating (PThermal)[Template, Nodal Source]

117 = Pressure (PThermal)[Time Table]

71 = displacement (Patran TEAM) 119 = Pressure (PThermal)[Initial]

72 = displacement/point (Patran TEAM) 120 = Pressure (PThermal)[Template]

73 = displacement/local (Patran TEAM) 124 = Mass Flow Rate (PThermal)[Fixed]

74 = traction (Patran TEAM) 125 = Mass Flow Rate (PThermal)[Time Table]

75 = traction/local (Patran TEAM) 127 = Mass Flow Rate (PThermal)[Initial]

76 = pressure (Patran TEAM) 128 = Mass Flow Rate (PThermal)[Template]

77 = force (Patran TEAM)

Table 7-4 Patran Internally Assigned LBCs Load Type IDs (continued)

ID/Load Types ID/Load Types

db_create_lbc_type_defn (<load_name>, <analy_type_id>, <applic_type>, <glob_flag>, <coord_flag>, <graph_sym>, <scal_vect>, <null_vect>, <num_analy_codes>, <analy_code_ids>, <def_color>, <color_box>, <anchor>, <load_id> )

Note: This function is still usable but obsolete, and should be replaced by lbc_defn_create.lbc_defn, 550 and lbc_defn_create.lbc_var_defn, 553.

PCL and CustomizationAdding New Loads and Boundary Conditions

544

Input:

CHARACTER STRING

<load_name> The name of the new load type, e.g., “Temperature.”

INTEGER <analy_type_id> Flag specifying the analysis type:

1 = Structural.

2 = Thermal.

3 = Fluid Dynamics.

INTEGER <applic_type> Flag specifying the effect of this load type:

0 = Body Load.

1 = Boundary Load.

INTEGER <glob_flag> Flag specifying whether the load has global application or not:

0 = Only application region affected.

1 = Global load: affects everything.

INTEGER <coord_flag> Flag specifying whether the load can be oriented in a given local frame or not:

0 = No alternate coordinate frame orientation allowed.

1 = Alternate coordinate frame orientation accepted.

-1 = Local

INTEGER <graph_sym> Flag specifying what graphic symbol should be used for this load type. See Table 7-1.

INTEGER <scal_vect> Flag specifying the data form of the load:

0 = scalar.

1= vector.

INTEGER <null_vect> Flag specifying whether blank components of a vector load are to be interpreted as zeroes (as with forces) or nulls (as with displacements):

0 = interpret blank components as zeroes.

1 = interpret blank components as nulls.

INTEGER <num_analy_codes> No longer used. Input zero.

545Chapter 7: Modifying the Database Using PCLAdding New Loads and Boundary Conditions

To assign application regions to the load type, the following function is used. This call is only needed for new load types since the load types which already exist in the database have application regions already assigned to them.

INTEGER ARRAY

<analy_code_ids> No longer used. Input an array of none zero [0].

INTEGER <def_color> Flag specifying the default color to be used for this load type. See Table 7-2.

INTEGER <color_box> The number of the color box to be used to modify the load type color. Must range from 601 to 640 and be unique for a given analysis code. See Table 7-3 for IDs used by Patran

INTEGER <anchor> Flag which specifies the anchor style for vector load types:

1= anchor at base.

2 = anchor at tip.

3 = anchor at middle.

INTEGER <load_id> Load type IDs must be unique with respect to all other load type IDs previously defined. Load IDs 1-100 are currently being used by Patran. It is likely that IDs up to 1000 will be used for future Patran requirements. It is advisable that customers defining custom loads and boundary condition definitions use load IDs >1000. The load IDs currently being used by Patran are listed in Table 7-4.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

db_create_app_region_defn ( <load_id>, <region_label> )

Note: This function is still usable but obsolete, and should be replaced by lbc_defn_create.lbc_defn, 550

PCL and CustomizationAdding New Loads and Boundary Conditions

546

Element load data input attributes are assigned to the new load type with the following function. This call is only needed for new load types since the load types which already exist in the database have data input attributes assigned to them.

Input:

INTEGER <load_id> The ID of the load type of interest.

CHARACTER STRING

<region_label> The name of the application region, typically simply “Application Region”.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

db_create_elem_lbc_var_defn ( <load_id>, <variability>, <elem_dim>, <data_label> )

Note: This function is still usable but obsolete, and should be replaced by lbc_defn_create.lbc_defn, 550 and lbc_defn_create.lbc_var_defn, 553.

547Chapter 7: Modifying the Database Using PCLAdding New Loads and Boundary Conditions

Node load data input attributes are assigned to the new load type with the following function. This call is only needed for new load types since the load types which already exist in the database have data input attributes assigned to them.

Input:

INTEGER <load_id> The ID of the load type of interest.

INTEGER <variability> The variability of the input load:

2 = uniform across the element body, element face or element edge.

3 = varying across the element body, element face or element edge.

INTEGER <elem_dim> Dimensionality of the valid element types:

1 = line elements.

2 = surface elements.

3 = solid elements.

CHARACTER STRING

<data_label> The label used to describe the data input such as “Top Pressure” or “Bottom Pressure”.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

Note: Each call to this function creates a new data input ID, sequentially starting from 1, for each unique combination of load_id, variability, and elem_dim.

db_create_nodal_lbc_var_defn ( <load_id>, <data_label> )

Note: This function is still usable but obsolete, and should be replaced by lbc_defn_create.lbc_defn, 550 and lbc_defn_create.lbc_var_defn, 553.

PCL and CustomizationAdding New Loads and Boundary Conditions

548

To associate newly defined or previously existing load types to your new analysis code, use the following function.

To associate custom PCL input and application regions to an analysis code, use the following function.

Input:

INTEGER <load_id> The ID of the load type of interest.

CHARACTER STRING

<data_label> The label used to describe the data input such as “Force ( F1 F2 F3 )” or “Temperature”.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

Note: Each call to this function creates a new data input ID, sequentially starting from 1, for each unique load_id.

db_add_lbc_type_for_ac ( <load_id>, <data_label> )

Note: This function is still usable but obsolete, and should be replaced by db_add_lbc_defn_for_ac, 549

Input:

INTEGER <analy_code_id> The ID of the new analysis code as described under db_create_analysis_code, 455.

INTEGER <load_type_id> The ID of the load type to be associated with the new analysis code. See db_create_lbc_type_defn, 543 (argument <load_id>, 545 for more details.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

549Chapter 7: Modifying the Database Using PCLAdding New Loads and Boundary Conditions

To associate newly defined or previously existing load types to analysis codes, use the following function.

db_add_lbc_c_and_t_for_ac ( <analy_code_id>, <load_type_id>, <target_elem_flag>, <input_data_pcl>, <app_reg_data_pcl> )

Note: This target_elem_flag, input_data_pcl and app_reg_data_pcl arguments to this function override those of lbc_defn_create.lbc_defn, 550.

Input:

INTEGER <analy_code_id> The ID of the analysis code as described under db_create_analysis_code, 455.

INTEGER <load_type_id> The ID of the load type to be associated with the new analysis code. See db_create_lbc_type_defn, 543 (argument <load_id>, 545 for more details.

INTEGER <target_elem_flag> Flag specifying whether the Target Element menu should be displayed.

0 = don’t display.

1 = display.

STRING[31] <input_data_pcl> Name of non-standard (custom) input data form PCL class. (See Custom Data and Application Region Sub-Forms, 459.)

STRING[31] <app_reg_data_pcl> Name of non-standard (custom) application region form PCL class. (See Custom Data and Application Region Sub-Forms, 459.)

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

db_add_lbc_defn_for_ac ( <analy_code_id>, <load_id>, <count>, <categories> )

Input:

INTEGER <analy_code_id> The ID of the analysis code as described under db_create_analysis_code, 455.

INTEGER <load_id> The ID of the load type to be associated with the analysis code.

PCL and CustomizationAdding New Loads and Boundary Conditions

550

To define a new load type, the following function is used.

INTEGER <count> The number of valid categories. This should always be set to 3.

INTEGER(3) <categories> An array of up to 3 valid categories. The elements may be set to the following values:

1 = Nodal.

2 = Element Uniform.

3 = Element Variable.

If 3 categories are not used, the remaining elements should be set to zero.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

lbc_defn_create.lbc_defn ( <load_name>, <option_name>, <analy_type_id>, <applic_type>, <glob_flag>, <coord_flag>, <scal_or_vect>, <null_flag>, <def_color>, <color_box>, <n_app_region>, <appl_reg_labels>, <no_data_flag>, <input_data_pcl>, <app_reg_data_pcl>, <target_elem_flag>, <dyn_data_form>, <acid_mod>, <equiv_flag>, <load_id> )

Input:

STRING[31] <load_name> The name of the new load type, e.g., “Temperature.”

STRING[31] <option_name> The option name associated to the new load type.

This name is optional. A blank string specifies no

options. If a name is specified, an “Option:” menu

will be added to the appropriate LBC forms. If two or more load types are defined with the same

load_name, the load_name will only appear once in the LBC form “Object:” menu. The “Option:” menu is used to choose between them. If the option_name is blank, the load_name will have its own entry in the “Object:” menu.

551Chapter 7: Modifying the Database Using PCLAdding New Loads and Boundary Conditions

INTEGER <analy_type_id> Flag specifying the analysis type:

1 = Structural.

2 = Thermal.

3 = Fluid Dynamics.

INTEGER <applic_type> Flag specifying the effect of this load type:

0 = Body Load.

1 = Boundary Load.

INTEGER <glob_flag> Flag specifying whether the load has global application or not:

0 = Only application region affected.

1 = Global load: affects everything.

INTEGER <coord_flag> Flag specifying whether the load can be oriented in a given local frame or not:

0 = No alternate coordinate frame orientation allowed.

1 = Alternate coordinate frame orientation accepted.

-1 = Use local entity coordinate frame.

INTEGER <scal_or_vect> Flag specifying the data form of the load:

0 = scalar.

1= vector.

2= combined scalar and vector.

INTEGER <null_flag> No longer used. Input zero.

INTEGER <def_color> Flag specifying the default color to be used for this load type. Refer to Table 7-2 for color definitions.

INTEGER <color_box> The number of the color box to be used to modify the load type color. Must range from 601 to 640 and be unique within an analysis type. Refer to Table 7-3 for color box IDs currently used by Patran.

INTEGER <n_app_region> The number of application regions for this load type.

STRING[31]() <appl_reg_labels> Array of napp application region labels.

PCL and CustomizationAdding New Loads and Boundary Conditions

552

INTEGER <no_data_flag> Flag specifying whether data input is required. If data input is not required, a blank variable label must be specified in a call to lbc_defn_create.lbc_var_defn

0= input data is required.

1= input data is not required.

STRING[31] <input_data_pcl> Name of non-standard (custom) input data form PCL class. See Custom Data and Application Region Sub-Forms, 459.

Note: This argument is overridden by <input_data_pcl> in the function db_add_lbc_c_and_t_for_ac, 549.

STRING[31] <app_reg_data_pcl> Name of non-standard (custom) application region form PCL class. See Custom Data and Application Region Sub-Forms (p. 360).

Note: This argument is overridden by <app_reg_data_pcl> in the function db_add_lbc_c_and_t_for_ac, 549.

INTEGER <target_elem_flag> Flag specifying whether the Target Element menu should be displayed. This flag only applies if non-standard (custom) forms are used. Both input_data_pcl and app_reg_data_pcl must be non-blank.

0 = don’t display.

1 = display.

Note: This argument is overridden by the <target_elem_flag> in the function db_add_lbc_c_and_t_for_ac, 549.

INTEGER <dyn_data_form> Flag specifying whether to use a double sized input data form for dynamic load cases.

0 = use single width.

1 = use double width.

INTEGER <acid_mod> Flag specifying whether this load type has the potential to modify the analysis coordinate frame of a node.

0 = cannot modify.

1 = can modify.

553Chapter 7: Modifying the Database Using PCLAdding New Loads and Boundary Conditions

To assign input data definitions to the load type, the following function is used. This call is only needed for new load types since the load types which already exist in the database have input data definitions already assigned to them.

INTEGER <equiv_flag> Flag specifying whether to prevent equivalencing nodes between application regions. Only applies if there is more than one application region

0 = don’t equivalence.

1 = equivalence.

INTEGER <load_id> The ID of this load type. This ID must be unique with respect to all other load type IDs previously defined. It is recommended that you use ids >1000. The following load type ids are reserved:

Generic: 1-50

Thermal: 51-70

Patran TEAM: 71-90

Fluid Dynamics: 91-100

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

lbc_defn_create.lbc_var_defn (load_id, category, targ_elem_dim, variable_label, variable_id, display_order, data_type, scalar_or_vector, null_type, normal_direction, graph_symbol, connect_label, anchor, conflict_resolution, display_style, evaluation_location )

Description:

This function will assign input data variable definitions to a load type.

Input:

INTEGER load_id This value specifies the load type identifier. This identifier must reference an existing load type.

PCL and CustomizationAdding New Loads and Boundary Conditions

554

INTEGER category This value specifies the type of entities at which the loads and boundary conditions will be evaluated. This value can be set to 1 for nodal entities, 2 for uniform element entities, or 3 for variable element entities.

INTEGER targ_elem_dim This value specifies the dimensionality of the element to which the load and boundary condition will be applied. This value can be set to 1 for one dimension, 2 for two dimensions, or 3 for three dimensions.

When the input value category is set to 1 for nodal entities, this value is not used because the dimensionality for nodes is undefined and this input value should be set to 0.

STRING variable_label [31] This value specifies the text that will be associated with the input value variable_id. This text will be used to label the display of the information associated with the input value variable_id. If input data is not specified for this load type then this value must be an empty string.

INTEGER variable_id This value specifies the identifier for the variables associated with this load type. This identifier must be unique within each load type.

INTEGER display_order This value specifies the order in which variables associated with this load type would be displayed in a data box. This value can range from 1 to the number of variables associated with the identifier specified by the input variable variable_id.

INTEGER data_type This value specifies the data type for the variables associated with the input value variable_id. This value can be set to 1 for integers, 3 for real or field values evaluated by the loads and boundary conditions, 5 for a node identifier, or 7 for a field that is not evaluated by the loads and boundary conditions.

INTEGER scalar_or_vector This value specifies when set to 0 that the data type is a scalar value or when set to 1 that the data type is a vector value.

This value is used only if the input argument data_type is set to 3 for real or field values evaluated by the loads and boundary conditions.

INTEGER null_type This value specifies, when set to 0, that blank components of a vector load are to be interpreted as zeros, as with forces. When this value is set to 1, blank components of a vector load will be interpreted as nulls, as with displacements.

555Chapter 7: Modifying the Database Using PCLAdding New Loads and Boundary Conditions

INTEGER normal_direction This value specifies, when set to 0 that a local normal is not used. When this value is set to 1, the positive direction for a local normal vector will be into the body. When this value is set to 2, the positive direction for a local normal will be out of the body.

INTEGER graph_symbol(3) This value specifies the graphic symbols to be used for the variable assigned to the load type. The first array element specifies the symbol for the first application region, the second element the symbol for the second application region, and the third element is reserved for future use. The second element is not used unless two application regions are specified. Refer to Table 7-1 for the definitions of the graphic symbols that can be used with this value.

INTEGER connect_label(4) This value specifies the label used to connect the application regions. This value applies to load types with multiple application regions only.

The first array element can be set to 0 to specify that no connection is displayed between the application regions or 1 to specify that a solid line is displayed connecting the application regions with the label specified in the second array element of this input value.

The second array element can be set to 2 to specify that a label is not displayed, 3 to specify that the load and boundary condition set name is used as a label, or 7 to indicate that the variable field name is to be used as a label.

The third array element should always be set to 0 and is reserved for future use.

The fourth array element is reserved for future use.

INTEGER) anchor(3) This value specifies the anchor style for vectors.

The first array element specifies the anchor style for the first application region.

The second array element specifies the anchor style for the second application region.

The third array element is reserved for future use.

The following anchor style values are available: 1 to anchor at the vector base, 2 to anchor at the vector tip, and 3 to anchor at the middle of the vector.

PCL and CustomizationAdding New Loads and Boundary Conditions

556

INTEGER conflict_resolution This value specifies, when set to 0, that variable conflicts will not be resolved. Setting this value to 1 will allow variable conflicts to be resolved.

INTEGER display_style(3) This value specifies the display style that will be used to display the values specified with the input argument graph_symbol. The display style controls the use of symbols and labels plotted with the variable definitions.

This value can be used to specify the use of the loads and boundary condition set name or field name that can be displayed as a label.

The first array element specifies the display style for the first application region.

The second array element specifies the display style for the second application region and is used only if two application regions are specified.

The third array element is reserved for future use.

The following display style values can be used: 0 for no display, 1 for a display with markers with standard or variable quantity labels, 2 for a display with no marker labels, 3 for a display with markers with loads and boundary condition set name labels, 4 for a display with labels with no markers, 5 for a display with a graphics symbol at the node with the node id, 6 for a display with markers with constrained degree of freedom and coordinate frame id labels, or 7 for a display with markers with field name labels.

A display style value of 5 can be used with an input value data_type that specifies node identifiers only. A display style value of 6 can be used with a null_type input value of 1 only.

INTEGER evaluation_location This value specifies the application regions at which entity fields will be evaluated. This value is used only with load types that specify multiple application regions. The following values can be used: 0 to evaluate the entity fields in all application regions, 1 to evaluate the entity fields in the first application region, or 2 to evaluate the entity fields in the second application region.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

557Chapter 7: Modifying the Database Using PCLAdding New Loads and Boundary Conditions

To assign valid target FEM types to the load type application regions, the following function is used. This call is only needed for new load types since the load types which already exist in the database have valid target FEM types already assigned to them.

Error Conditions:

None.

Remarks:

This function should be called only for new load types. Existing load types will already have an input data definition assigned.

lbc_defn_create.valid_targets ( <load_id>, <category>, <type_count>, <node_flags>, <zero_d_flags>, <one_d_flags>, <two_d_flags>, <three_d_flags>, <n_app_region>, <app_region_ids>, <geo_datatypes>, <fem_datatypes> )

Input:

INTEGER <load_id> The ID of this load type. This ID must have been previously defined.

INTEGER <category> Specifies what type of entities the LBC will eventually be evaluated at.

1 = Nodal.

2 = Element Uniform.

3 = Element Variable.

INTEGER <type_count> Number of sets of valid target types. Specify a value of 1 for load types with 1 application region. For two application regions specify 6.

LOGICAL(6) <node_flags> Flags for nodal targets. See Comments:, 559.

LOGICAL(6) <zero_d_flags> Flags for 0D element targets. See Comments:, 559.

LOGICAL(6) <one_d_flags> Flags for 1D element targets. See Comments:, 559.

LOGICAL(6) <two_d_flags> Flags for 2D element targets. See Comments:, 559.

LOGICAL(6) <three_d_flags> Flags for 3D element targets. See Comments:, 559.

INTEGER <n_app_region> The number of application regions for this load type.

INTEGER() <app_region_ids> Application region ids. Usually 1 for app region 1 and 2 for app region 2.

PCL and CustomizationAdding New Loads and Boundary Conditions

558

STRING[31]() <geo_datatypes> Geometric select datatypes. Valid strings are:

“SURFACE_EDGE”

“GEO_NODAL”

“GEO_BEAM”

“GEO_SHELL”

“GEO_SOLID”

“GEO_SHELL_BNDRY”

“GEO_SOLID_BNDRY”

“GEO_BEAM_BNDRY”

“CURVE_SIDE”

“CURVE_VERTEX”

“SURFACE_EDGE”

“SURFACE_SIDE”

“GEO_SHELL_SIDE_BNDRY”

559Chapter 7: Modifying the Database Using PCLAdding New Loads and Boundary Conditions

Comments:

More on node_flags, zero_d_flags, one_d_flags, two_d_flags and three_d_flags:

These flags specify what FEM targets are valid in application region 1 and, the corresponding valid targets in application region 2. They control the display of the Target Element Dimension option menu for each application region. The valid targets in application region 2 are dependent on which target is selected for region 1. Thus there is a set of region 2 flags for each region 1 flag.

If there is only 1 application region, set the first element in each flag array (i.e. node_flags(1), zero_d_flags(1)...) TRUE for each valid target. Set all remaining flags FALSE, and set type_count to 1.

If there are 2 application regions, set the first element in each flag array TRUE for each valid target in application region 1. Flag array elements 2 through 6 correspond to nodal, 0D, 1D, 2D and 3D targets for

STRING[31]() <fem_datatypes> FEM select datatypes. Valid strings are:

“ELEM_EDGE_2D”

“FEM_NODAL”

“BEAMELEM”

“ELEM2D”

“ELEM3D”

“FEM_SHELL_BNDRY”

“FEM_SOLID_BNDRY”

“FEM_BEAM_BNDRY”

“BEAM_SIDE”

“BEAM_VERTEX”

“ELEM_EDGE_2D”

“ELEM_2D_SIDE”

“FEM_SHELL_SIDE_BNDRY”

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

PCL and CustomizationAdding New Loads and Boundary Conditions

560

application region 2. Set the second element in each flag array (i.e. node_flags(2), zero_d_flags(2)...) TRUE for each target type in the application region 2 that may be associated to nodes in application region 1. If node_flags(1) is FALSE, set the second element in each flag array FALSE. Set the third element in each flag array TRUE for each target type in the application region 2 that may be associated to 0D elements in application region 1. If zero_d_flags(1) is FALSE, set the third element in each flag array FALSE. Follow the same pattern for the remaining flag array elements.

Example 1:

This code fragment sets nodes and 2D elements valid in application region 1, and associates nodes in region 1 to 2D elements in region 2, and 2D elements in region 1 to 3D elements in region 2.

$ Region ---------- Region 2 -------------$ 1 Node 0D 1D 2D 3D$----------------------------------------------------------------LOGICAL node_flag(6)= TRUE, FALSE, FALSE, FALSE, FALSE, FALSELOGICAL zerod_flag(6)= FALSE, FALSE, FALSE, FALSE, FALSE, FALSELOGICAL oned_flag(6)= FALSE, FALSE, FALSE, FALSE, FALSE, FALSELOGICAL twod_flag(6)= TRUE, TRUE, FALSE, FALSE, FALSE, FALSELOGICAL threed_flag(6)= FALSE, FALSE, FALSE, FALSE, TRUE, FALSE

Example 2:

This is the complete code to create a new load type with:

1. 1 application region and valid FEM targets of nodes or 2D elements.

2. 2 variables, one scalar and one vector.

3. the scalar labeled with a circle and its magnitude.

4. the vector labeled with a single headed arrow and its magnitude.

FUNCTION define_my_load_type( load_id ) STRING load_name[31], option_name[31]STRING inp_data_pcl[31], app_region_data_pcl[31]STRING variable_label[31]STRING appl_reg_labels[31](2)INTEGER load_id, app_ids(2)STRING geo_datatypes[31](5,2), fem_datatypes[31](5,2)INTEGER analy_type_id, applic_type, glob_flag, coord_flag, @graph_sym(3), scal_or_vect, null_flag, def_color, color_box, @n_app_region, no_data_flag, target_elem_flag, dyn_data_form, @acid_mod, equiv_flagINTEGER targ_elem_dim, variable_id, display_order, data_type,@norm_flag,connect_label(4), anchor(3), conflict_flag,@display_type(3),eval_flag, category, type_count, categories(3),@analy_code_idLOGICAL node_flags(6) = FALSE, FALSE, FALSE, FALSE, FALSE, FALSELOGICAL zero_d_flags(6) = FALSE, FALSE, FALSE, FALSE, FALSE, FALSELOGICAL one_d_flags(6) = FALSE, FALSE, FALSE, FALSE, FALSE, FALSELOGICAL two_d_flags(6) = FALSE, FALSE, FALSE, FALSE, FALSE, FALSELOGICAL three_d_flags(6) = FALSE, FALSE, FALSE, FALSE, FALSE, FALSE /* Define new load type.*/load_name = “New Type”option_name = ““

561Chapter 7: Modifying the Database Using PCLAdding New Loads and Boundary Conditions

analy_type_id = 1applic_type = 1glob_flag = 0coord_flag = 0scal_or_vect = 0null_flag = 0def_color = 2color_box = 626n_app_region = 1appl_reg_labels(1) = “Application Region”appl_reg_labels(2) = ““no_data_flag = 0inp_data_pcl = ““app_region_data_pcl = ““target_elem_flag = 1dyn_data_form = 1acid_mod = 0equiv_flag = 0 lbc_defn_create.lbc_defn( load_name, option_name, analy_type_id, @applic_type, glob_flag, coord_flag, scal_or_vect, null_flag,@def_color, color_box, n_app_region, appl_reg_labels, @no_data_flag,inp_data_pcl, app_region_data_pcl,@target_elem_flag,dyn_data_form,acid_mod,equiv_flag,load_id ) /* Define valid targets for new load type.*/category = 2type_count = 1 node_flags(1) = TRUEzero_d_flags(1) = FALSEone_d_flags(1) = FALSEtwo_d_flags(1) = TRUEthree_d_flags(1) = FALSE app_ids(1) = 1app_ids(2) = 0 geo_datatypes(1,1) = “GEO_NODAL”geo_datatypes(2,1) = ““geo_datatypes(3,1) = ““geo_datatypes(4,1) = “GEO_SHELL_BNDRY”geo_datatypes(5,1) = ““fem_datatypes(1,1) = “FEM_NODAL”fem_datatypes(2,1) = ““fem_datatypes(3,1) = ““fem_datatypes(4,1) = “FEM_SHELL_BNDRY”fem_datatypes(5,1) = ““ lbc_defn_create.valid_targets( load_id, category, type_count, @node_flags, zero_d_flags, one_d_flags,two_d_flags,three_d_flags,@n_app_region, app_ids, geo_datatypes, fem_datatypes ) /* Define variables for new load type for target type 0 ( nodal ).*/targ_elem_dim = 0variable_label = “Scalar Variable Id 1”variable_id = 1display_order = 1data_type = 3scal_or_vect = 0norm_flag = 0graph_sym(1) = 102graph_sym(2) = 0

PCL and CustomizationAdding New Loads and Boundary Conditions

562

graph_sym(3) = 0connect_label(1) = 0connect_label(2) = 0connect_label(3) = 0connect_label(4) = 0anchor(1) = 0anchor(2) = 0anchor(3) = 0conflict_flag = 1display_type(1) = 1display_type(2) = 0display_type(3) = 0eval_flag = 0 lbc_defn_create.lbc_var_defn( load_id, category, targ_elem_dim, @variable_label, variable_id, display_order, data_type,@scal_or_vect, null_flag, norm_flag, graph_sym, connect_label,@anchor, conflict_flag, display_type, eval_flag ) variable_label = “Vector Variable Id 2”variable_id = 2display_order = 2data_type = 3scal_or_vect = 1norm_flag = 0graph_sym(1) = 1graph_sym(2) = 0graph_sym(3) = 0connect_label(1) = 0connect_label(2) = 0connect_label(3) = 0connect_label(4) = 0anchor(1) = 1anchor(2) = 0anchor(3) = 0conflict_flag = 1display_type(1) = 1display_type(2) = 0display_type(3) = 0eval_flag = 0 lbc_defn_create.lbc_var_defn( load_id, category, targ_elem_dim, @variable_label, variable_id, display_order, data_type,@scal_or_vect, null_flag, norm_flag, graph_sym, connect_label,@anchor, conflict_flag, display_type, eval_flag )

/* Define variables for new load type for target type 2 ( 2D elements ).*/targ_elem_dim = 2variable_label = “Scalar Variable Id 1”variable_id = 1display_order = 1data_type = 3scal_or_vect = 0norm_flag = 0graph_sym(1) = 102graph_sym(2) = 0graph_sym(3) = 0connect_label(1) = 0connect_label(2) = 0connect_label(3) = 0connect_label(4) = 0anchor(1) = 0anchor(2) = 0anchor(3) = 0conflict_flag = 1display_type(1) = 1

563Chapter 7: Modifying the Database Using PCLAdding New Loads and Boundary Conditions

display_type(2) = 0display_type(3) = 0eval_flag = 0 lbc_defn_create.lbc_var_defn( load_id, category, targ_elem_dim, @variable_label, variable_id, display_order, data_type,@scal_or_vect, null_flag, norm_flag, graph_sym, connect_label,@anchor, conflict_flag, display_type, eval_flag ) variable_label = “Vector Variable Id 2”variable_id = 2display_order = 2data_type = 3scal_or_vect = 1norm_flag = 0graph_sym(1) = 1graph_sym(2) = 0graph_sym(3) = 0connect_label(1) = 0connect_label(2) = 0connect_label(3) = 0connect_label(4) = 0anchor(1) = 1anchor(2) = 0anchor(3) = 0conflict_flag = 1display_type(1) = 1display_type(2) = 0display_type(3) = 0eval_flag = 0 lbc_defn_create.lbc_var_defn( load_id, category, targ_elem_dim, @variable_label, variable_id, display_order, data_type,@scal_or_vect, null_flag, norm_flag, graph_sym, connect_label,@anchor, conflict_flag, display_type, eval_flag )/* Associate new load type and categories to analysis code NASTRAN.*/analy_code_id = 1categories(1) = 2categories(2) = 0categories(3) = 0db_add_lbc_defn_for_ac( analy_code_id, load_id, 3, categories ) END FUNCTION

Example 3:

This is the complete code to create a new load type with:

1. 2 application regions and valid FEM targets of nodes or 2D elements.

2. nodes and 2D elements valid in application region 1, and nodes in region 1 associated to nodes or 2D elements in region 2, and 2D elements in region 1 associated to nodes or 2D elements in region 2.

3. 1 vector variable labeled with a single headed arrow and its magnitude.

4. the application regions connected and labeled with the LBC set name.

FUNCTION define_my_2app_load_type ( load_id ) STRING load_name[31], option_name[31]STRING inp_data_pcl[31], app_region_data_pcl[31]

PCL and CustomizationAdding New Loads and Boundary Conditions

564

STRING variable_label[31]STRING appl_reg_labels[31](2)INTEGER load_id, app_ids(2)STRING geo_datatypes[31](5,2), fem_datatypes[31](5,2)INTEGER analy_type_id, applic_type, glob_flag, coord_flag, @graph_sym(3), scal_or_vect, null_flag, def_color, color_box, @n_app_region, no_data_flag, target_elem_flag, dyn_data_form, @acid_mod, equiv_flagINTEGER targ_elem_dim, variable_id, display_order, data_type, @norm_flag, connect_label(4), anchor(3), conflict_flag, @display_type(3), eval_flag, category, type_count, @categories(3), analy_code_idLOGICAL node_flags(6) LOGICAL zero_d_flags(6)LOGICAL one_d_flags(6)LOGICAL two_d_flags(6)LOGICAL three_d_flags(6) /* Define new load type.*/load_name = “New 2 App Type”option_name = ““analy_type_id = 1applic_type = 1glob_flag = 0coord_flag = 0scal_or_vect = 2null_flag = 0def_color = 2color_box = 626n_app_region = 2appl_reg_labels(1) = “App Region 1”appl_reg_labels(2) = “App Region 2”no_data_flag = 0inp_data_pcl = ““app_region_data_pcl = ““target_elem_flag = 1dyn_data_form = 1acid_mod = 0equiv_flag = 0 lbc_defn_create.lbc_defn( load_name, option_name, analy_type_id, @applic_type, glob_flag, coord_flag, scal_or_vect, null_flag, @def_color,color_box, n_app_region, appl_reg_labels, @no_data_flag, @inp_data_pcl, app_region_data_pcl, target_elem_flag, @dyn_data_form, acid_mod, equiv_flag, load_id )

/* Define valid targets for new load type.*/category = 2type_count = 6 node_flags(1) = TRUEzero_d_flags(1) = FALSEone_d_flags(1) = FALSEtwo_d_flags(1) = TRUEthree_d_flags(1) = FALSE node_flags(2) = TRUEzero_d_flags(2) = FALSEone_d_flags(2) = FALSEtwo_d_flags(2) = TRUEthree_d_flags(2) = FALSE

565Chapter 7: Modifying the Database Using PCLAdding New Loads and Boundary Conditions

node_flags(3) = FALSEzero_d_flags(3) = FALSEone_d_flags(3) = FALSEtwo_d_flags(3) = FALSEthree_d_flags(3) = FALSE node_flags(4) = FALSEzero_d_flags(4) = FALSEone_d_flags(4) = FALSEtwo_d_flags(4) = FALSEthree_d_flags(4) = FALSE node_flags(5) = TRUEzero_d_flags(5) = FALSEone_d_flags(5) = FALSEtwo_d_flags(5) = TRUEthree_d_flags(5) = FALSE node_flags(6) = FALSEzero_d_flags(6) = FALSEone_d_flags(6) = FALSEtwo_d_flags(6) = FALSEthree_d_flags(6) = FALSE app_ids(1) = 1app_ids(2) = 2 geo_datatypes(1,1) = “GEO_NODAL”geo_datatypes(2,1) = ““geo_datatypes(3,1) = “GEO_BEAM”geo_datatypes(4,1) = “GEO_SHELL_BNDRY”geo_datatypes(5,1) = “GEO_SOLID_BNDRY”fem_datatypes(1,1) = “FEM_NODAL”fem_datatypes(2,1) = ““fem_datatypes(3,1) = “BEAMELEM”fem_datatypes(4,1) = “FEM_SHELL_BNDRY”fem_datatypes(5,1) = “FEM_SOLID_BNDRY” geo_datatypes(1,2) = “GEO_NODAL”geo_datatypes(2,2) = ““geo_datatypes(3,2) = “GEO_BEAM”geo_datatypes(4,2) = “GEO_SHELL_SIDE_BNDRY”geo_datatypes(5,2) = “GEO_SOLID_BNDRY”fem_datatypes(1,2) = “FEM_NODAL”fem_datatypes(2,2) = ““fem_datatypes(3,2) = “BEAMELEM”fem_datatypes(4,2) = “FEM_SHELL_SIDE_BNDRY”fem_datatypes(5,2) = “FEM_SOLID_BNDRY” lbc_defn_create.valid_targets( load_id, category, type_count, @node_flags, zero_d_flags, one_d_flags, two_d_flags, @three_d_flags, @n_app_region, app_ids, geo_datatypes, fem_datatypes ) /* Define variables for new load type for target type 0 ( nodal ).*/targ_elem_dim = 0variable_label = “Vector Variable”variable_id = 1display_order = 1data_type = 3scal_or_vect = 1norm_flag = 0graph_sym(1) = 1graph_sym(2) = 1

PCL and CustomizationAdding New Loads and Boundary Conditions

566

graph_sym(3) = 0connect_label(1) = 1connect_label(2) = 3connect_label(3) = 0connect_label(4) = 0anchor(1) = 1anchor(2) = 1anchor(3) = 0conflict_flag = 1display_type(1) = 1display_type(2) = 1display_type(3) = 0eval_flag = 0 lbc_defn_create.lbc_var_defn( load_id, category, targ_elem_dim, @ variable_label, variable_id, display_order, data_type,@ scal_or_vect, @ null_flag, norm_flag, graph_sym, connect_label, anchor, @ conflict_flag, display_type, eval_flag ) /* Define variables for new load type for target type 2 ( 2D elements ).*/targ_elem_dim = 2variable_label = “Vector Variable Id 2”variable_id = 1display_order = 1data_type = 3scal_or_vect = 1norm_flag = 0graph_sym(1) = 1graph_sym(2) = 1graph_sym(3) = 0connect_label(1) = 1connect_label(2) = 3connect_label(3) = 0connect_label(4) = 0anchor(1) = 1anchor(2) = 1anchor(3) = 0conflict_flag = 1display_type(1) = 1display_type(2) = 1display_type(3) = 0eval_flag = 0 lbc_defn_create.lbc_var_defn( load_id, category, targ_elem_dim, @variable_label, variable_id, display_order, data_type,@scal_or_vect, @null_flag, norm_flag, graph_sym, connect_label, anchor, @conflict_flag, display_type, eval_flag )/* Associate new load type and categories to analysis code NASTRAN.*/analy_code_id = 1categories(1) = 2categories(2) = 0categories(3) = 0db_add_lbc_defn_for_ac( analy_code_id, load_id, 3, categories ) END FUNCTION

567Chapter 7: Modifying the Database Using PCLAdding Custom General Field Functions

Adding Custom General Field FunctionsGeneral Fields allow the user to define fields using custom PCL functions incorporated with the Patran menu system. The user/programmer can create any functionality desired for a field in PCL, and then create a custom set of forms to input data to the custom function.

Once defined in Patran, the custom function appears as a term in a General Field function expression. The custom function term may be used by itself, of in combination with other terms to constitute the field. The field can then be applied in various applications in Patran. Custom functions and forms can be created and used by a single user, or be available across an entire Patran installation.

All aspects of General Fields functions are controlled by the user/programmer. These include the function name and evaluation routine, the custom forms displayed for argument input, and the type of field for which the function is defined.

To create custom functions, the names and field type definitions must first be stored in the database. Then, the user must write a PCL evaluator function which returns the result. This evaluator will be called by the General Fields code automatically when evaluation is required. Finally, if custom forms are required for function input, the use/programmer must create a PCL class which manages the input data as specified in the rules given below. If no custom form is created, a generic argument input form will automatically display. The generic form displays only a databox for each argument, labeled with the expected data type. For this reason, the generic form should only be used with simple functions having self evident inputs.

PCL and CustomizationAdding Custom General Field Functions

568

Adding Functions to the Database Function names are displayed to the user in the General Fields Input Data form when the “term-type” option menu is set to “P3 Functions”. The list of functions displayed is determined by the current analysis code, the current field object type, (Spatial, Material Property or Non-Spatial) and the setting of the term “sub-type” option menu. Therefore, all three of these parameters must be specified for each function name when it is entered into the database. Note that the term “sub-type” is a user specified string (31 characters maximum) which provides a convenient way to group functions for display. All sub-type strings specified for a given analysis code and field object type will appear in the sub-types option menu.

To store a function in the database, use the following PCL function:

This routine specifies the four arguments which make up a unique function entry in the database. The arguments are detailed below:

• The analysis code id can be found with the function:

db_add_general_field_func (<analysis_code_id>, <object>, <sub_type>, <function_name>)

Input:

INTEGER <analysis_code_id> The analysis code ID.

INTEGER <object> The object type ID.

STRING[31] <sub_type> String displayed in the sub-type menu.

STRING[31] <function_name> Name of the Function.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if successful.

Error Conditions:

None.

db_count_general_field_func (anal_code_id, object, sub_type, count)

Description:

Counts the number of functions in the field general functions relation for given input parameters.

Input:

INTEGER anal_code_id Analysis Code ID.

INTEGER object Object type ID: 0 for Spatial, 1 for Material, 2 for Non Spatial

CHARACTER[31] sub_type Sub-type string.

Output:

569Chapter 7: Modifying the Database Using PCLAdding Custom General Field Functions

• The object type IDs are defined as:

• The sub-type string is a descriptive name which is displayed in the sub-type option menu. Typically, a single sub-type will be used to group multiple function names.

• The function name is a descriptive name for the function, but is also the name of the associated PCL code required for every function.

Every function must have a PCL evaluator function of the same name as the “function_name” argument. This function must return a single value for a set of input arguments. If the function is to have a custom form as well, a PCL class of the same name must also exist. Creation of the PCL class is detailed below.

INTEGER count Number of functions.

INTEGER <Return Value> = 0, success else error code.

Error Conditions:

Numerous.

Spatial = 0

Material Property = 1

Non-Spatial = 2

db_get_general_field_func (anal_code_id, object, sub_type, count, names)

Description:

Retrieves the function names in the field general functions relation for given input parameters.

Input:

INTEGER anal_code_id Analysis code ID.

INTEGER <object> Object type ID: 0 for Spatial, 1 for Material, 2 for Non Spatial.

CHARACTER[31] <sub_type> Sub-type string.

INTEGER count Number of functions.

Output:

CHARACTER[31]() names Function names.

INTEGER <Return Value> = 0, success else error code.

Error Conditions:

Numerous.

Note: The C name differs. It is DbGetGeneralFieldFunc.

PCL and CustomizationAdding Custom General Field Functions

570

Evaluator PCLEvery PCL function name added to the Patran database must have a corresponding PCL Evaluator Function. This function will take the stored argument data as an input and return a single result. The evaluator function may work with a custom PCL form, or it may use the Generic Function Data form provided by the General Fields Application.

The procedures for each case are slightly different, and instructions for the use of each method are given below.

Generic Function Form Use

The Generic form is useful for simple functions with few arguments. The General Fields code first looks for a PCL class for the function in question, and if it does not find one, it brings up the Generic form. The Generic form code interrogates the PCL function to determine its argument list, then creates a databox for each argument. Each databox is labeled as to the type of argument (integer, real, logical, string or widget) expected.

While the user is free to input data in each argument databox, all argument expressions must be valid PCL syntax. This is because the contents of each databox are used directly as inputs to the PCL evaluating function for the corresponding argument. When the user is finished filling out the generic form, all data from the form is stored as a character string in the database. The format of this string is:

<function_name>(argument_1 | argument_2 | argument_3 | ...)

The vertical bar “|” is used to denote the separation between databoxes (or arguments). When the function is evaluated, the “|” characters are replaced with commas, any independent variables are replaced with values and the line is evaluated via PCL. These details should be transparent to the user, as long as it is noted that the databoxes are created in the order of the argument list, and that the databox contents conform to PCL syntax.

571Chapter 7: Modifying the Database Using PCLAdding Custom General Field Functions

Custom Function Form Use

For complex or specialized custom functions, it will be useful to create custom argument input forms. Custom forms can be very powerful, and greatly facilitate specialized work. A custom form is created similarly to other custom PCL forms (See Example: Creating a Simple Customized Menu and Form, 293, but there are some specific requirements for compatibility with General Fields.

The first requirement is that the custom form class be of the same name as the function and evaluator function. Second, the class must contain both “display” and “exit” functions, as these are called by the General Fields code. Finally, the custom argument form must communicate with the General Fields code through the following routines:

• Whenever the custom form is closed, such as for “OK” or “Cancel”, the following call must be made to notify the General Fields code:

Comments:

The object of the custom form PCL is to present data to the user in such a way that he can compose an input argument string for the custom PCL evaluator function. Therefore, once the user input is complete and the user selects “OK”, the custom form PCL must compose the function input in the form of a character string. The format of this string must be:

<function_name>(argument_1 | argument_2 | argument_3 | ...)

The vertical bar “|” is used to denote the separation between databoxes (or arguments). When the function is evaluated, the “|” characters are replaced with commas, any independent variables are replaced with values and the line is evaluated via PCL. After the argument string is assembled by the custom form PCL, it must be written to the General Fields storage with the routine:

fields_genrl_inp_data.form_up (“<function_name>”, FALSE)

Input:

STRING[31] <function_name> Name of the function PCL class.

Output:

None.

Error Conditions:

None.

fields_genrl_inp_data.write_term_data (<argument_string>)

Input:

STRING[VIRTUAL] <argument_string> String composed by the custom form PCL.

Output:

PCL and CustomizationAdding Custom General Field Functions

572

Comments:

As the argument string is used to call the evaluator function, it must obey the following rules:

The string must start with the name of the evaluator function.

This is followed by PCL expressions for each term. Note that these expressions must be in order corresponding to the argument list and that the expressions are enclosed in parentheses. The argument expressions must be valid PCL syntax.

Each argument expression is separated in the argument string with a vertical bar character(“|”).

The allowable independent variables for various fields types may change; i.e., real independent variables are not allowed for parametric fields. To get the independent variables allowed by General Fields for a specific field case, call the function:

None.

Error Conditions:

None.

fields_genrl_inp_data.pass_ind_var_ids (spatial_vars, other_vars)

Input:

INTEGER(3) <spatial_vars> Array of spatial variable IDs.

INTEGER(6) <other_vars> Array of non-spatial variable IDs.

Output:

None.

Error Conditions:

None.

573Chapter 7: Modifying the Database Using PCLAdding Custom General Field Functions

Comments:

Further restriction of valid independent variables available to a custom function can be implemented by the user/programmer with this information. The custom PCL form code may be programmed to error check and reject any independent variables not desired.

The General fields code will call a custom form by calling its “.display” function. When called however, a custom form must determine if it needs to be initialized, (as in the case of a new field) or filled with existing data (as in the case of modifying an existing field). In order to do this, the “.display” must call the function:

Independent Variable Letter Designation Integer ID

Spatial “X” 1

Y Direction “Y” 2

Z Direction “Z” 3

R Direction “R” 4

T Direction “T” 5

P Direction “P” 6

C1 Direction “C1” 7

C2 Direction “C2” 8

C3 Direction “C3” 9

Temperature “T” 10

Strain “e” 11

Strain Rate “er” 12

Time “t” 13

Frequency “f” 14

Radiosity “RAD” 15

fields_genrl_inp_data.get_data (<name>, <data>, <term_id>)

Input:

None.

Output:

STRING[31] <name> Function name.

STRING[VIRTUAL] <data> Character string data for the current term id.

INTEGER <term_id> Next term id available.

PCL and CustomizationAdding Custom General Field Functions

574

Comments:

This function returns the currently loaded values of the arguments. If no existing General Field function is loaded, the “data” string will be blank. If that is the case, re-initialize the form. If the “data” string is not blank, parse the data string back into the individual argument strings and load the data into the databoxes.

An Example CaseFollowing is a short example illustrating the creation and use of custom General Field Functions. The use of both the Generic Function form and a simple custom form is explained.

Use of the Generic Function Form

In order to use the Generic form, it is necessary only to create an evaluator function and load the function name into the database. The example function, sum_func, will sum the input arguments. The evaluator function could be:

/*$$ FUNCTION sum_func** Purpose:* Sum the input arguments** Input:* Three integer arguments**/FUNCTION sum_func(arg1, arg2, arg3)/** Local Declarations*/INTEGER arg1INTEGER arg2INTEGER arg3

INTEGER answer

answer = arg1 + arg2 + arg3

RETURN answer

END FUNCTION /* sum_func */

If the user wished to load this function only under the Spatial and Non-Spatial field types, the function required to load this function into the database might look like this:

/*$$ FUNCTION load_func** Purpose:* load function sum_func into the database.** Input:

Error Conditions:

None.

575Chapter 7: Modifying the Database Using PCLAdding Custom General Field Functions

* < none >

**/FUNCTION load_func( )/** Local Declarations*/INTEGER statINTEGER acid

INTEGER FIELDS_SPATIAL_IDINTEGER FIELDS_MATERIAL_IDINTEGER FIELDS_NON_SPATIAL_ID

/** Initialize...*/stat = 0acid = 1 /* Nastran code ID */

FIELDS_SPATIAL_ID = 0FIELDS_MATERIAL_ID = 1FIELDS_NON_SPATIAL_ID = 2

/** Add Function "sum_func" for Spatial and Non-Spatial* Fields Object types.*/stat = db_add_general_field_func(acid, @FIELDS_SPATIAL_ID,@"Simple Functions",@"sum_func" )IF(stat != 0 )THEN!$ Error adding mt_tests, stat = ‘stat‘RETURN (-1)END IF

stat = db_add_general_field_func(acid,@FIELDS_NON_SPATIAL_ID,@"Simple Functions",@"sum_func" )IF(stat != 0 )THEN!$ Error adding mt_tests, stat = ‘stat‘RETURN (-1)END IF

RETURN (0)

END FUNCTION /* load_func */

In order to incorporate this custom function into Patran, two steps must be taken. First, a new database containing this function's name and definition is created and then used as the new template.db.

To create the new template.db:

• Open a new empty database.

• Compile “load_func” with the “!! input” command in Patran.

• Execute “load_func” with the “load_func()" command.

• Close the new database, and rename it “template.db”.

PCL and CustomizationAdding Custom General Field Functions

576

Then, the evaluator function must be compiled into the Patran PCL. This is most conveniently accomplished by adding the PCL with the “p3epilog.pcl” file. In the directory in which the user is running Patran, the “p3epilog.pcl” might look like this:

!Adding General Fields Functions to PCL...!! INPUT sum_func.pcl

As Patran is starting up, the first line of the p3epilog.pcl file will be written to the launching window as a warning that PCL is being added. Compile messages will also be written out.

Now, upon opening a database, the General Fields Input form will list the function “sum_func” in the Functions term type, under the “Simple Functions” subtype, for Spatial and Non-Spatial fields.

Use of a Custom Form

The incorporation of a custom form requires the addition of one step to the above procedure. A PCL class must be defined which displays and controls the input to the function. (For more information regarding custom PCL forms, see Example: Creating a Simple Customized Menu and Form, 293. This PCL code must follow the rules listed in Generic Function Form Use, 570 for custom forms.

577Chapter 7: Modifying the Database Using PCLAdding New Multi-Point Constraint Definitions

Adding New Multi-Point Constraint DefinitionsTo associate multi-point constraint definitions to a new analysis code, first define the generic MPC types and then assign these types to the analysis code. To define the generic MPC types the following PCL function is used.

db_create_mpc_type_def (<type_id>, <type_name>, <geom_flag>, <coord_flag>, <const_flag>, <const_label>, <sequen_flag>, <depend_coeff_flag>, <depend_dof_flag>, <max_depend_terms>, <min_depend_terms>, <dofs_per_depend>, <nodes_per_depend>, <indep_coeff_flag>, <indep_dof_flag>, <max_indep_terms>, <min_indep_terms>, <dofs_per_indep>, <nodes_per_indep>)

Input:

INTEGER <type_id> The ID to be used in referencing this MPC type. This ID must be unique with respect to all previously defined MPC type IDs.

CHARACTER STRING

<type_name> The name of this MPC type.

LOGICAL <geom_flag> A flag specifying whether this MPC type references geometry or nodes:

TRUE = references geometry.

FALSE = references nodes.

LOGICAL <coord_flag> A flag specifying whether this MPC type references a coordinate frame or not:

TRUE = references coordinate frame.

FALSE = does not reference frame.

LOGICAL <const_flag> A flag specifying whether this MPC type has a constant term or not:

TRUE = has constant term.

FALSE = does not have constant term.

CHARACTER STRING

<const_label> The label to be used for the constant term.

PCL and CustomizationAdding New Multi-Point Constraint Definitions

578

LOGICAL <sequen_flag> A flag specifying whether the order of term. definition should be maintained or not:

TRUE = maintain order.

FALSE = ignore order.

LOGICAL <depend_coeff_flag> A flag specifying whether the dependent terms have multiplicative constants assigned to them or not:

TRUE = have multiplicative constants.

FALSE = do not have constants.

LOGICAL <depend_dof_flag> A flag specifying whether the dependent terms have explicitly or implicitly specified degrees-of-freedom:

TRUE = degrees-of-freedom explicitly defined.

FALSE = implicit degrees-of-freedom.

INTEGER <max_depend_terms> The maximum number of dependent terms allowed. Zero if there is no limit.

INTEGER <min_depend_terms> The minimum number of dependent terms allowed.

INTEGER <dofs_per_depend> The maximum number of degrees-of-freedom that can be associated with a dependent term.

INTEGER <nodes_per_depend> The number of nodes to be associated with each dependent term. Zero if there is no definite number.

LOGICAL <indep_coeff_flag> A flag specifying whether the independent terms have multiplicative constants assigned to them or not:

TRUE = have multiplicative constants.

FALSE = do not have constants.

LOGICAL <indep_dof_flag> A flag specifying whether the independent terms have explicitly or implicitly specified degrees-of-freedom:

TRUE = degrees-of-freedom explicitly defined.

FALSE = implicit degrees-of-freedom.

INTEGER <max_indep_terms> The maximum number of independent terms allowed. Zero if there is no limit.

INTEGER <min_indep_terms> The minimum number of independent terms allowed.

INTEGER <dofs_per_indep> The maximum number of degrees-of-freedom that can be associated with an independent term.

579Chapter 7: Modifying the Database Using PCLAdding New Multi-Point Constraint Definitions

The list of MPC types used by MSC supplied analysis interfaces is given below. When defining his own MPC types, the user should use MPC type IDs distinct from those in this list, even if the type is synonymous to a type already in the list.

INTEGER <nodes_per_indep> The number of nodes to be associated with each independent term. Zero if there is no definite number.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

Error Conditions:

None.

PCL and CustomizationAdding New Multi-Point Constraint Definitions

580

<type_name> <type_id>

Explicit 1

Rigid ( Fixed ) 2

Rigid ( Pinned ) 3

Linear Surf-Surf 4

Linear Surf-Vol 5

Linear Vol-Vol 6

Quad. Surf-Surf 7

Quad. Surf-Vol 8

Quad. Vol-Vol 9

Slider (12) 10

RBAR 12

RBE1 13

RBE2 14

RBE3 15

RROD 16

RSPLINE 17

RTRPLT 18

Elbow (17) 19

Pin (9) 21

Tie (5) 22

Revolute 23

V Local 24

Universal 25

SS Linear (13) 26

SS Bilinear (14) 27

SSF Bilinear (15) 28

Tie DOFS 29

Axi Shell-Solid 30

Tri Plate-Plate 31

Quad Plate-Plate 32

Pinned Joint 33

Full Moment Joint 34

Rigid Link 35

581Chapter 7: Modifying the Database Using PCLAdding New Multi-Point Constraint Definitions

Now, that the generic MPC types have been defined, associate the MPC types of interest to the new analysis code.

CP 36

Cyclic Symmetry 37

Sliding Surface 38

<type_name> <type_id>

PCL and CustomizationAdding Element Verification Parameters

582

Adding Element Verification ParametersIn adding a new analysis code, the element verification criteria must be specified for the given code. This is done through the PCL function described below.

db_set_elem_verification_parms (<analy_code_name>, <test_id>, <threshold>)

Input:

CHARACTER STRING

<analy_code_name> The name of the new analysis code.

583Chapter 7: Modifying the Database Using PCLAdding Element Verification Parameters

INTEGER <test_id> The ID of the particular element verification test. The meaning of these IDs are:

1 = aspect ratio, triangular elements

2 = skew, triangular elements

3 = aspect ratio, quadrilateral elements

4 = skew, quadrilateral elements

5 = warp, quadrilateral elements

6 = taper, quadrilateral elements

7 = aspect ratio, tetrahedral elements

8 = face skew, tetrahedral elements

9 = collapse, tetrahedral elements

10 = edge angle, tetrahedral elements

11 = aspect ratio, pentahedral elements

12 = face skew, pentahedral elements

13 = face taper, pentahedral elements

14 = face warp, pentahedral elements

15 = twist, pentahedral elements

16 = edge angle, pentahedral elements

17 = face skew, hexahedral elements

18 = face warp, hexahedral elements

19 = face taper, hexahedral elements

20 = edge angle hexahedral elements

PCL and CustomizationAdding Element Verification Parameters

584

As an example, the threshold values employed when MSC Nastran is the analysis preference are given in the table below.

21 = aspect ratio, hexahedral elements

22 = twist, hexahedral elements

23 = mid-side node normal offset, all elements

24 = mid-side node tangent offset, all elements

REAL <threshold> Maximum acceptable value for the specified test. The threshold values for warp, skew, twist, face warp, face skew and edge angle should be in degrees.

Output:

INTEGER <Return Value> Status return value.

Error Conditions:

None.

<test_id> <threshold>

1 5.0

2 30.0

3 5.0

4 30.0

5 7.0

6 0.8

7 5.0

8 30.0

9 0.15

10 30.0

11 5.0

12 30.0

13 0.8

14 7.0

15 45.0

16 30.0

17 30.0

18 7.0

585Chapter 7: Modifying the Database Using PCLAdding Element Verification Parameters

19 0.8

20 30.0

21 5.0

22 45.0

23 0.15

24 0.15

<test_id> <threshold>

PCL and CustomizationExamples of Modifying the Database

586

Examples of Modifying the DatabaseThe following session file is an example of how the commands described in this chapter can be used to load analysis code specific data about a new analysis code into a Patran database.

codeindent10 1: “John Code”, a hypothetical structural analysis code

The following session file loads the open database with the analysis code definitions for “John Code”, a hypothetical and simplistic structural analysis code. This example is delivered with Patran in the $P3_HOME/customization directory under the name “load_johncode.ses.” In order to run this session file, follow these steps:

1. Within Patran, open the target database. This database can be devoid of analysis code examples, like “base.db” or can already contain analysis code definitions, like “template.db”.

2. Run the $P3_HOME/customization/load_johncode.ses session file through the “Play Session File” functionality on the main “File” menu.

$ Initialize variablesINTEGER status, bar_code, plate_code, solid_code$ Define new analysis codestatus = db_create_analysis_code(20001, “John Code”, “.in”, “.out”, 1, [1], 1 )!‘status‘$ Define the generic element types, element properties and material propertiesload_generics()$ Get PATRAN topology codesstatus = fem_get_patran25_etop(2,2,bar_code)!‘status‘status = fem_get_patran25_etop(4,4,plate_code)!‘status‘status = fem_get_patran25_etop(8,8,solid_code)!‘status‘$ Define element typesstatus = db_create_selected_etype_wc ( 1, 7, 13, 42, 1, 2, bar_code, 20, 1, 1, 36, 1 )!‘status‘status = db_create_selected_etype_wc(1,7,27, 42, 1, 2, bar_code, 20, 1, 1, 36, 2 )!‘status‘status = db_create_selected_etype_wc ( 1, 7, 1, 24, 1, 1, plate_code, 19, 1, @1, 54, 1 )!‘status‘status = db_create_selected_etype_wc( 1,7,1,24,1,3, plate_code, 19,1,4,54, 2)!‘status‘status = db_create_selected_etype_wc ( 1, 7, 1, 30, 1, 1, solid_code, 15, 1, 1, 71, 5)!‘status‘$ Re-create element type summary tablestatus = elementprops_def_create.make_elem_summary()!‘status‘$ Define element property wordsstatus = db_create_allowable_phys_prop( 7, 13, “Material Reference,” 1, @[5,0,0,0,0,0,0,0,0,0], 5, 0, “ ”, “ ”, “ ”)!‘status‘status = db_create_allowable_phys_prop( 7, 1027, “Outside Radius,” 1, @ [1,0,0,0,0,0,0,0,0,0], 1, 0, “ ”, “prop > 0.”, “ ” )!‘status‘status = db_create_allowable_phys_prop( 7, 1, “Cross Sectional Area,” 1, @

status = db_create_matl_prop_alias ( 7, 1, 1, 2, 503, “Stress/Strain Curve,” 3 )!‘status‘$ Define the material records

587Chapter 7: Modifying the Database Using PCLExamples of Modifying the Database

status = db_create_allowable_matl_prop ( 7, 1, 1, 1, [0,0,0,0,0], [1, 2, 5, 16, 24, 30], 6 )!‘status‘status = db_create_allowable_matl_prop ( 7, 1, 1, 2, [0,0,0,0,0], [503], 1 )!‘status‘$ Assign the already existing definitions for FORCE and DISPLACEMENT$ to John Codestatus = db_add_lbc_type_for_ac( 7, 6 )!‘status‘status = db_add_lbc_type_for_ac( 7, 7 )!‘status‘$ Define MPC types Explicit, Rigid(Fixed), Rigid(Pinned)status = db_create_mpc_type_def ( 41, “Explicit,” FALSE, FALSE, TRUE, “Constant Term,” @ FALSE, FALSE, TRUE, 1, 1, 1, 1, TRUE, TRUE, 0, 1, 1, 1 )!‘status‘status = db_create_mpc_type_def ( 42, “Rigid(Fixed),” FALSE, FALSE, FALSE, “ ”, @ FALSE, FALSE, FALSE, 0, 1, 0, 1, FALSE, FALSE, 1, 1, 0, 1 )!‘status‘status = db_create_mpc_type_def ( 43, “Rigid(Pinned),” FALSE, FALSE, FALSE, “ ”, @ FALSE, FALSE, FALSE, 0, 1, 0, 1, FALSE, FALSE, 1, 1, 0, 1 )!‘status‘$ Associate MPC types with the new analysis codestatus = db_create_valid_mpc_type ( 41, 7, 1, 6, [1, 2, 3, 4, 5, 6] )!‘status‘status = db_create_valid_mpc_type ( 42, 7, 1, 0, [0] )!‘status‘status = db_create_valid_mpc_type ( 43, 7, 1, 0, [0] )!‘status‘$ Define generic element property verification parametersstatus = db_set_elem_verification_parms ( “John Code”, 1, 5.0 )!‘status‘status = db_set_elem_verification_parms ( “John Code”, 2, 30.0 )!‘status‘status = db_set_elem_verification_parms ( “John Code”, 3, 5.0 )!‘status‘status = db_set_elem_verification_parms ( “John Code”, 4, 30.0 )!‘status‘status = db_set_elem_verification_parms ( “John Code”, 5, 7.0 )!‘status‘status = db_set_elem_verification_parms ( “John Code”, 6, 0.8 )!‘status‘status = db_set_elem_verification_parms ( “John Code”, 7, 5.0 )!‘status‘status = db_set_elem_verification_parms ( “John Code”, 8, 30.0 )!‘status‘status = db_set_elem_verification_parms ( “John Code”, 9, 0.15 )!‘status‘status = db_set_elem_verification_parms ( “John Code”, 10, 30.0 )!‘status‘status = db_set_elem_verification_parms ( “John Code”, 11, 5.0 )!‘status‘

status = db_set_elem_verification_parms ( “John Code”, 12, 30.0 )!‘status‘status = db_set_elem_verification_parms ( “John Code”, 13, 0.8 )

PCL and CustomizationExamples of Modifying the Database

588

Chapter 8: Accessing the Patran DatabasePCL and Customization

8 Accessing the Patran Database

Introduction

Syntax of Documented Calls

Calling the Database Access Functions from C and FORTRAN

External Access of the Patran Database

Miscellaneous Database Functions

Groups

Nodes

Coordinate Frames

Patran Element Topology Codes

Elements

Element Properties

PCL and Customization590

Association between Elements and Element Properties

Data Fields

Material Properties

Load Cases

Loads Multi-point Constraints

Importing Results

Examples of Translation

591Chapter 8: Accessing the Patran DatabaseIntroduction

IntroductionThe last step in developing an application interface to Patran is to create translators which will communicate model and results information from the Patran database to the application and from the application to the Patran database. Access to the database is required in order to create these translation programs. The functions which allow this access by extracting data from and placing data into the database are described below. These functions are organized into the following categories:

• Miscellaneous Database Functions

• Groups

• Nodes

• Coordinate Frames

• Patran Element Topology Codes

• Elements

• Association between Elements and Element Properties

• Element Properties

• Data Fields

• Material Properties

• Load Cases

• Loads

• Multi-point Constraints

• Importing Results

Examples of simple translators which extract information from a database and write the data to a file or read data from a file and place it into a database are provided.

The database querying program, QLI, can be very helpful in developing user applications or translators. Refer to Querying the Patran Database (p. 447) in the PCL and Customization for more information on this program.

PCL and CustomizationSyntax of Documented Calls

592

Syntax of Documented CallsThe PCL functions described in this chapter can be called from PCL, FORTRAN and C, unless otherwise noted. Typically, only the PCL syntax of the call will be documented. The name of the FORTRAN call can be derived from the PCL name by simply capitalizing the entire name. The name of the C call can be derived by capitalizing the first letter of each word in the name and removing all underscores. For example, if a function is documented as the PCL function db_get_group_id(), then the FORTRAN call name would be DB_GET_GROUP_ID() and the C call name would be DbGetGroupId(). Sometimes, there are slight differences between the PCL calls and their FORTRAN and C equivalents. Whenever the FORTRAN or C calls cannot be derived from the PCL call by using the rules stated above, the syntax of the actual C or FORTRAN call will be listed in addition to the PCL syntax. For example, the “Db” prefix in many C calls is followed by a capital F to signify that the function contains no C specific data types such as C pointers or structures. Such a function is db_count_nodes() and it would be documented as follows.

Remarks:

The FORTRAN call name for this function is DB_COUNT_NODES().

The C call name is DbFCountNodes() and has the following prototype:

int DbFCountNodes ( int * number_nodes );

db_count_nodes (number_nodes)

Description:

This function will count the number of nodes in the database.

Output:

INTEGER number_nodes This value will return the number of nodes defined in the database.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

Error Conditions:

None.

593Chapter 8: Accessing the Patran DatabaseCalling the Database Access Functions from C and FORTRAN

Calling the Database Access Functions from C and FORTRANUser written PCL functions can be incorporated into the main Patran program or can be part of an external program run using the p3pclcomp utility program. PCL which is incorporated into Patran will extract the functions documented in this chapter from the “p3patran.plb” PCL library. This happens automatically and requires no user intervention. Standalone PCL functions can satisfy references to functions described in this chapter with p3patran.plb or through other PCL libraries.

Any C or FORTRAN code written by the user cannot be incorporated into the main Patran program and thus must always be part of an external program. Run time support of the functions listed in this chapter is demonstrated by simple C and FORTRAN programs which are delivered in the $P3_HOME/customization directory. The source code filenames for these demonstration programs are CAccessCalls.c, fort_access_calls.F, fort_access_calls.f, wrapper_c.C, and wrapper_f.C.

Script files which demonstrate a compilation and link of these files are delivered in the $P3_HOME/customization directory under the filenames LinkCAccess, LinkCAccess.cmd, LinkFAccess, LinkFAccess.cmd, and dbxs_link. All of the header files, libraries, archive libraries, and shared objects needed to compile and link the example programs are located in $P3_HOME/customization, $P3_HOME/customizaton/CXX_LIBS, and $P3_HOME/lib directories.

The LinkCAccess script may have to be edited to reflect the location of the system FORTRAN libraries on your local machine before it will run correctly. To run either of the link scripts simply type its name. For example:

Prompt> $P3_HOME/customization/LinkCAccess

or

Prompt> $P3_HOME/customization/LinkFAccess

The run of the script is successful if it creates a “CAccessCalls” or “fort_access_calls” executable in your current directory without any link error messages. The C and FORTRAN utility programs which are created do not call the dbaccess functions that they use with the appropriate arguments. These utility programs are designed to demonstrate the compilation and link of an executable using dbaccess, not the use of the functions themselves. The main for the utility program written using C must be a C++ style main and be compiled using a C++ compiler to allow all links to be resolved correctly.

The internal structure of multidimensional arrays is the same for C and PCL but is different for FORTRAN. A multidimensional array in FORTRAN is the transpose of the same array in C. This can create problems if the underlying code for a function is C but is called from FORTRAN or vice versa. If an output multidimensional array is the transpose of what you expect, simply re-shuffle the contents or the array. If a function which has an input multidimensional array argument is not working correctly, input the transpose of the current array to see if that will work. Below is an example of a FORTRAN function with calls a database access function and then transposes the output multidimensional array. The “USABLE_ARRAY” would be the array actually used throughout the rest of the program.

SUBROUTINE XYZ ( )CC---Purpose: blah blah blahC

PCL and CustomizationCalling the Database Access Functions from C and FORTRAN

594

#define DIM1 3#define DIM2 5CINTEGER I, J, STATUS, DB_XYZCREAL OUTPUT_ARRAY(DIM2,DIM1), USABLE_ARRAY(DIM1,DIM2)CC---Tons of commentsCSTATUS = DB_XYZ ( OUTPUT_ARRAY )CC---Even more commentsCDO 30 I = 1, DIM1CDO 20 J = 1, DIM2CUSABLE_ARRAY(I,J) = OUTPUT_ARRAY(J,I)C20CONTINUEC30CONTINUECRETURNCEND

595Chapter 8: Accessing the Patran DatabaseExternal Access of the Patran Database

External Access of the Patran DatabaseThere cannot be multiple simultaneous transactions on an Patran database. This means that if an external program accesses a database which is currently opened by Patran, Patran must first end the transaction with the database with the “db_commit_raw” function described later in this chapter. Only when the external program is finished accessing the database should Patran resume a translation with the database using the “db_start_transaction_raw” function.

When an external program is modifying or adding data to a database which is currently open, the database must first be closed and then re-opened by Patran after the external program has finished. The database must be closed and re-opened because there is no mechanism for informing Patran of external changes to an already opened database. For example: if an external program were to add a node to a database while it was open, Patran would have no knowledge of this new node.

When accessing the database only to extract information, Patran need not close the database but should end the current transaction and restart it only after the external program is finished. Below is a example of PCL code which would spawn an external forward translator.

FUNCTION my_spawn()INTEGER statusstatus = db_commit_raw()status = utl_process_spawn ( “my_forward_translator argument_1 argument_2”, TRUE )IF ( utl_process_error ( status ) ) THENutl_display_process_error( status, 3 )END IFstatus = db_start_transaction_raw()END FUNCTION

When spawning an external program which is going to either add or modify data in the database such as a results translator, Patran should close and re-open the database as shown in the following example.

FUNCTION my_spawn()INTEGER statusSTRING database_name[256]status = db_name_get ( database_name )status = uil_file_close.go()status = utl_process_spawn ( “my_results_translator argument_1 argument_2”, TRUE )IF ( utl_process_error ( status ) ) THENutl_display_process_error( status, 3 )END IFstatus = uil_file_open.go( database_name )END FUNCTION

If the external process is time consuming, you may wish to have Patran close the database and not re-open it. This would allow you to exit Patran after the external process was initiated or open a new database and continue work on a different model. An example PCL function is given below.

FUNCTION my_spawn()INTEGER statusstatus = uil_file_close.go()status = utl_process_spawn ( “my_results_translator argument_1 argument_2”, FALSE )IF ( utl_process_error ( status ) ) THENutl_display_process_error( status, 3 )END IFEND FUNCTION

PCL and CustomizationMiscellaneous Database Functions

596

Miscellaneous Database FunctionsThere are many Patran functions which affect the overall behavior of a database. Through these function, it is possible to open a database, close a database, commit the latest change to a database or undo the latest change to a database. These functions are described below.

To open a database from an external program, the function is “db_open_database” is used. Only one database can be open to Patran functions at a given time.

Notes:

The C call is “DbOpenDatabase”.

int DbOpenDatabase ( database_name )char *database_name

To close the previously opened database from an external program, “db_close_database” is used. Closing a database automatically commits the latest change to the database. So, it is never necessary to explicitly commit changes to a database unless the application desires to do such.

Notes:

The C call is “DbCloseDatabase”.

int DbCloseDatabase ()

PCL functions which are incorporated into the main Patran program should not use the db_open_database and db_close_database functions. Only external programs should make use of these functions. In order to open or close databases from within the Patran program, use ui_file_close.go, uil_file_new.go and ui_file_open.go which are described in Viewport Menu (p. 223) in the PCL Reference Manual.

db_open_database ( <database_name> )

Input:

CHARACTER STRING <database_name> The name of the database to be opened.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

db_close_database ( )

Output:

INTEGER <Return Value>

This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

597Chapter 8: Accessing the Patran DatabaseMiscellaneous Database Functions

The last change made to a database is not committed to the database until another database change is made, the database is closed, or the change is explicitly committed to the database. The “db_commit” function will explicitly commit the last change to a database. Since, a new database change automatically commits the previous change and closing a database automatically commits the last change, the function “db_commit” is not required but can be used if the application desires. Possible reasons for explicitly committing changes to a database include ensuring that the changes will not be destroyed by a program or system failure or preventing you from undoing the latest change to the database.

Notes:

The C call is “Dbcommit”.

int Dbcommit ()The last change made to a database (if not explicitly committed by “db_commit”) can be undone. The “db_undo” function performs this operation.

Notes:

The C call is “DbUndo”.

int DbUndo ()

From within the Patran program it is preferable to use the uil_db_commit and uil_bd_undo functions described in Viewport Menu (p. 223) in the PCL Reference Manual. The db_count and db_undo functions are more intended for use by external programs.Opening a Patran database automatically begins a transaction between the program and the database. The db_commit and uil_db_commit programs not only commit the last transaction but also begin a new transaction. Sometimes it is necessary to commit the last transaction with beginning a new transaction. This is the case when an external program is to be spawned which extracts information from the database. The function described below ends the last transaction without beginning a new transaction.

Notes:

db_commit ( )

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

db_undo ( )

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

db_commit_raw ( )

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationMiscellaneous Database Functions

598

This function is not FORTRAN callable. The C call is “DbCommitRaw”.

int DbCommitRaw ()

Once a program has issued a db_commit_raw command it must start a new database transaction prior to issuing any other database commands. The function to start a new database traction is described below. The function should only be called if the last database command issued by the program is db_commit_raw..

Notes:

This function is not FORTRAN callable. The C call is “DbStartTransactionRaw”.

int DbStartTransactionRaw ()

To determine whether a program has a database currently open or not the following function should be used.

Notes:

This function is not FORTRAN callable. The C call is “DbIsOpen”.

int DbIsOpen ()

To get the name of the currently opened database use db_name_get.

db_start_transaction_raw ( )

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

db_is_open ( )

Output:

LOGICAL <Return Value> Flag which specifies whether a database is open (TRUE) or not (FALSE).

599Chapter 8: Accessing the Patran DatabaseMiscellaneous Database Functions

Notes:

This function is not FORTRAN callable. Also the C call differs in argument list.

The C call is as follows:

int DbNameGet ( maximum_length, database_name )int maximum_lengthchar *database_name

db_name_get ( <database_name> )

Output:

STRING <database_name>

The name of the currently opened database.

INTEGER <Return Value>

This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

DbNameGet ( <maximum_length>, <database_name> )

Input:

INTEGER <maximum_length>

The maximum length of the output database name.

Output:

STRING <database_name>

The name of the currently opened database.

INTEGER <Return Value>

This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationGroups

600

GroupsMany items can be translated from the database in a group-wise mode. In other words, it is possible to translate only the nodes belonging to a specified group. Also when adding certain entities to the database, like nodes or multi-point constraints, it is necessary to specify which group these entities are to belong. Membership to a group affects the visibility of many entity types. For example, if a node is created in the database but is not made a member of any groups, it will not be visible on the screen even though it exists. Similarly, if a node is created in the database and is made a member of a group which is not posted in any of the posted viewports, it will not be seen on the screen until the group to which it is a member is posted to a posted viewpost. Therefore, association to groups is important to the organization and visualization of a model.

Most likely, when entities are put into the database, all of these entities will be assigned to a specified group or to the current group. But, different types of entities can be put into different specified groups.

When translating entities from the database, all entities, regardless of group membership, entities belonging to a specific group or list of groups, or only the entities belonging to the current group can be translated.

If translating the current group, determine its internal ID from the following function.

Notes:

The C call is “DbGetCurrentGroupId”.

int DbGetCurrentGroupId ( group_id )int *group_id

To determine the internal IDs of a group specified by its name, the following function may be used.

db_get_current_group_id ( <group_id> )

Output:

INTEGER <group_id> The internal ID of the currently active group.

INTEGER <Return Value>

This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

601Chapter 8: Accessing the Patran DatabaseGroups

Notes:

The C call is “DbFGetGroupId”.

int DbFGetGroupId ( group_name, group_id ) chargroup_name [ ] int *group_id

Example:

integer gr_iddump db_get_current_group_id(gr_id)$# INTEGER = 0string name[32]dump db_get_group_name(gr_id,name)$# INTEGER = 0dump name$# STRING name[32] = "default_group"

db_get_group_id ( <group_name>, <group_id> )

Input:

CHARACTER STRING <group_name> The name of the group of interest.

Output:

INTEGER <group_id> The internal ID of the specified group.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

db_get_group_name (ID, name )

Input:

INTEGER ID The group id.

Output:

STRING name[31] The name of the specified group.

INTEGER <Return Value>

This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationNodes

602

Nodes

Exporting Node DataThere are three parts to extracting node data from a Patran database. First, a count of the number of nodes must be obtained in order to allocate memory for the storage of the node data. Second, the IDs of all the nodes of interest must be extracted. Third, the node data is retrieved. Nodes can be extracted on an individual basis if the node ID is already known or all the nodes of a specified group can be retrieved or all the nodes in the model can be extracted.

To get the count of nodes in the entire model the following function is used.

Notes:

The C name differs. It is DbFCountNodes.

int DbFCountNodes ( num_nodes )int *num_nodes

The function described below determines the number of nodes in a specified group.

Notes:

The C name differs. It is DbFCountNodesInGroup.

db_count_nodes ( <num_nodes> )

Output:

INTEGER <num_nodes> The internal ID of the currently active group.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

db_count_nodes_in_group ( <group_id>, <num_nodes> )

Input:

INTEGER <group_id> The internal ID of the group of which the nodes are to be members. This ID can be determined by either “db_get_group_id” or “db_get_current_group_id” as described in Groups, 600.

Output:

INTEGER <num_nodes> The number of nodes belonging to the specified group.

INTEGER <Return Value>

This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

603Chapter 8: Accessing the Patran DatabaseNodes

int DbFCountNodesInGroup ( group_id, num_nodes )intgroup_id int *num_nodes

The IDs of all the nodes in the database are retrieved through the following functions.

Notes:

The C name differs. It is DbFGetNodeIds.

int DbFGetNodeIds ( num_nodes, node_ids )int num_nodesint *node_ids

The IDs of the nodes belonging to a specified group are retrieved through the function below.

To extract the actual node data, the function described below is used. This function can be used to extract node information for individual nodes, for all the nodes of a group and for all the nodes in the database, depending on the number of node IDs input.

db_get_node_ids ( <num_nodes>, <node_ids> )

Input:

INTEGER <num_nodes> The number of nodes in the database.

Output:

INTEGER ARRAY <node_ids> The number of nodes belonging to the specified group.

INTEGER <Return Value>

This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

db_get_all_node_ids_in_group ( <num_nodes>,<group_id>,<node_ids>)

Input:

INTEGER <num_nodes> The number of nodes belonging to the specified group.

INTEGER <group_id> The internal ID of the group of which the nodes are to be members. This ID can be determined by either “db_get_group_id” or “db_get_current_group_id” as described in Groups, 600

Output:

INTEGER ARRAY <node_ids> An array containing the <num_nodes> IDs of all the nodes belonging to the specified group.

INTEGER <Return Value>

This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationNodes

604

Notes:

The C name differs. It is DbFGetAllNodeIdsInGroup.

int DbFGetAllNodeIdsInGroup ( num_nodes, group_id, node_ids )int num_nodesint group_idint *node_ids

Notes:

The C name differs. It is DbFGetNodes.

int DbFGetNodes ( num_nodes, node_ids, ref_coords, analy_coords, glob_xyzs )int num_nodesint *node_idsint *ref_coordsint *analy_coordsfloat *glob_xyzs

db_get_nodes (num_nodes, nodes_ids, ref_coords, analy_coords, glob_xyzs)

Input:

INTEGER num_nodes The number of nodes belonging to the specified group.

INTEGER node_ids(num_nodes) The IDs of the nodes of interest.

Output:

INTEGER ref_coords(num_nodes) The IDs of the reference coordinate frames for the nodes of interest. Zero if no reference.

INTEGER ARRAY analy_coords An array containing the analysis coordinate frame ID for each specified node.

REAL glob_xyzs(num_nodes,3) An array containing the global rectangular position vector for each node.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

605Chapter 8: Accessing the Patran DatabaseNodes

Remarks:

Memory is allocated for the output variable within this function. If memory was allocated prior to the call, it is released prior to re-allocation. Therefore, if this function is used within a loop, there is no need to release the memory of the output variable.

Example:

INTEGER status, element_count, element_id(100), node_count, @ node_id(VIRTUAL), i_elem, i_nodeelement_count = 100FOR (i_elem = 1 TO element_count) element_id(i_elem) = i_elemEND FORstatus = db_get_node_ass_elem(element_count, element_id, @ node_count, node_id)IF (0 < status) THEN msg_to_form(status, 4, 0, 0, 0.0, ““)ELSE IF (0 > status) THEN /* Error information already displayed */ ELSE write_line(“node_count =”, node_count) FOR (i_node = 1 TO node_count) write_line(“node_id(“, i_node, ”) =”, node_id(i_node)) END FOR END IFEND IF

db_get_node_ass_elem (element_count, element_id, node_count, node_id)

Description:

This function finds the nodes associated to the given elements.

Input:

INTEGER element_count This value specifies the number of elements.

INTEGER element_id (elem_count) This array specifies the element ids.

Output:

INTEGER node_count This value returns the number of nodes and the number of offsets in the node_id output value.

INTEGER node_id(VIRTUAL) This array returns the node ids.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate an error.

Error Conditions:

-1 This is an internal error status condition. There is no corresponding status message in the message database.

PCL and CustomizationNodes

606

Remarks:

Memory is allocated for the output variable within this function. If memory was allocated prior to the call, it is released prior to re-allocation. Therefore, if this function is used within a loop, there is no need to release the memory of the output variable.

Example:

INTEGER status, node_count, node_id(VIRTUAL), i_nodeSTRING lp_geo[100]

lp_geo = “Solid 1.2.3 Surface 4”status = db_get_node_ass_geo(lp_geo, node_count, node_id)IF (0 < status) THEN msg_to_form(status, 4, 0, 0, 0.0, ““)ELSE IF (0 > status) THEN /* Error information already displayed */ ELSE write_line(“node_count =”, node_count) FOR (i_node = 1 TO node_count) write_line(“node_id(“, i_node, ”) =”, node_id(i_node)) END FOR END IFEND IF

db_get_node_ass_geo (lp_geo, node_count, node_id)

Description:

This function finds the nodes associated to the given geometry.

Input:

STRING lp_geo [ ] This value contains the list processor string of geometric entities. Ex: “Surface 3.1 5.1”. This string can be empty or not allocated and the function will exit normally (Return Value=0).

Output:

INTEGER node_count This value returns the number of nodes and the number of offsets in the node_id output value.

INTEGER node_id(VIRTUAL) This array returns the node ids.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate an error.

Error Conditions:

-1 This is an internal error status condition. There is no corresponding status message in the message database.

607Chapter 8: Accessing the Patran DatabaseNodes

Remarks:

Memory is allocated for the output variable within this function. If memory was allocated prior to the call, it is released prior to re-allocation. Therefore, if this function is used within a loop, there is no need to release the memory of the output variable.

Example:

INTEGER status, mpc_count, mpc_id(100), node_count, @ node_id(VIRTUAL), i_mpc, i_node

mpc_count = 100FOR (i_mpc = 1 TO mpc_count) mpc_id(i_mpc) = i_mpcEND FORstatus = db_get_node_ass_mpc(mpc_count, mpc_id, node_count, @ node_id)IF (0 < status) THEN msg_to_form(status, 4, 0, 0, 0.0, ““)ELSE IF (0 > status) THEN /* Error information already displayed */ ELSE write_line(“node_count =”, node_count) FOR (i_node = 1 TO node_count) write_line(“node_id(“, i_node, ”) =”, node_id(i_node)) END FOR END IFEND IF

Importing Node DataThe function used to add node data to a database is as follows:

db_get_node_ass_mpc (mpc_count, mpc_id, node_count, node_id)

Description:

This function finds the nodes associated to the given MPCs.

Input:

INTEGER mpc_count This value specifies the number of MPCs.

INTEGER mpc_id (mpc_count)This array specifies the MPC ids.

Output:

INTEGER node_count This value returns the number of nodes and the number of offsets in the node_id output value.

INTEGER node_id(VIRTUAL) This array returns the node ids.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate an error.

Error Conditions:

-1 This is an internal error status condition. There is no corresponding status message in the message database.

PCL and CustomizationNodes

608

Notes:

The C name differs. It is DbFCreateNodes.

int DbFCreateNodes ( num_nodes, ref_coords, analy_coords, glob_xyzs, group_id, node_ids, node_exist )int num_nodesint *ref_coordsint *analy_coordsfloat *glob_xyzsint group_idint *node_idsint *node_exist

db_create_nodes ( <num_nodes>, <ref_coords>, <analy_coords>, <glob_xyzs>, <group_id>, <node_ids>, <node_exist> )

Input:

INTEGER <num_nodes> The number of nodes to be added to the database.

INTEGER ARRAY <ref_coords> The IDs of the reference coordinate frames for all <num_nodes> nodes. Zero if no reference.

INTEGER ARRAY <analy_coords> The IDs of the analysis coordinate frames for all <num_nodes> nodes. Zero if no reference.

REAL ARRAY <glob_xyzs> A 3x<num_nodes> array containing the global rectangular position vector for each node.

INTEGER <group_id> The internal ID of the group of which the nodes are to be members. This ID can be determined by either “db_get_group_id” or “db_get_current_group_id” as described in Groups, 600.

INTEGER ARRAY <node_ids> The <num_nodes> IDs of all the nodes.

Output:

INTEGER <node_exist> The ID of the first node which already exists in the database. Zero if no duplicates were encountered.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

609Chapter 8: Accessing the Patran DatabaseCoordinate Frames

Coordinate Frames

Exporting Coordinate Frame DataThe function used to extract coordinate frame information from the Patran database is given below.

Notes:

The C name differs. It is DbFGetCoordinateFrame.

int DbFGetCoordinateFrame ( coord_id, dummy_id, coord_type, coord_origin, coord_trans_mat) int coord_id int *dummy_id int *coord_typefloat *coord_originfloat coord_trans_mat[ ][3]

Importing Coordinate Frame DataWhen adding coordinate frame data to a database, not only does the frame data need to be added but the new frame must be posted. The function used to add frame data to the database is described below.

db_get_coord ( <coord_id>, <dummy_id>, <coord_type>, <coord_origin>, <coord_trans_mat> )

Input:

INTEGER <coord_id> The ID of the coordinate frame of interest.

Output:

INTEGER <dummy_id> A dummy internal ID which is no longer used.

INTEGER <coord_type> A flag specifying the type of coordinate frame:1 = Rectangular Frame2 = Cylindrical Frame3 = Spherical Frame

REAL ARRAY <coord_origin> The global rectangular position vector describing the origin of the frame

REAL ARRAY <coord_trans_mat> The 3x3 local to global transformation matrix of the frame.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationCoordinate Frames

610

Notes:

The C name differs. It is DbFCreateCoordinateFrame.

int DbFCreateCoordinateFrame ( coord_id, coord_type, coord_origin, coord_trans_mat, dummy_id )int *coord_idfloat coord_origin [ ]float coord_trans_mat [ ][3]int coord_typeint *dummy_id

db_create_coord ( <coord_id>, <coord_type>, <coord_origin>, <coord_trans_mat>, <dummy_id> )

Input:

INTEGER <coord_id> (only input if input value of <coord_id> > 0) the ID of the frame to be added to the database. If zero, Patran will assign a unique ID to this frame and return the value in <coord_id>.

INTEGER <coord_type> A flag specifying the type of coordinate frame:1 = Rectangular Frame2 = Cylindrical Frame3 = Spherical Frame

REAL ARRAY <coord_origin> The global rectangular position vector describing the origin of the frame.

REAL ARRAY <coord_trans_mat> The 3x3 local to global transformation matrix of the frame.

INTEGER <dummy_id> The internal ID of the coordinate frame. No longer used. Zero can be input here.

Output:

INTEGER <coord_id> (only output if input value of <coord_id> = 0) the unique ID assigned to this new frame by Patran.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

611Chapter 8: Accessing the Patran DatabaseCoordinate Frames

db_get_coord_ref_coord ( coord_id, refcid, xmat_lcl )

Description:

Get the reference frame for a specified coordinate frame definition

Input:

INTEGER coord_id The coordinate frame ID

Output:

INTEGER refcid The ID of the reference frame (zero if no reference found)

REAL xmat_lcl(4,4) The 4x4 transformation matrix of the coordinate frame relative to the reference frame (includes translation and rotation)

Error Conditions:

db_get_coord_ref_nodes ( coord_id, node_ids )

Description:

Get the reference nodes for a specified coordinate frame

Input:

INTEGER coord_id The coordinate frame ID

Output:

INTEGER node_ids(3) The IDs of the three node references (zeros if no references found)

INTEGER <Return Value>

This function returns a value of zero if successful.

Error Conditions:

db_set_coord_ref_coord ( coord_id, refcid, xmat_lcl )

Description:

Set the reference frame in a coordinate frame definition

Input:

INTEGER coord_id The coordinate frame ID

INTEGER refcid The ID of the reference frame (0 to remove an existing reference)

PCL and CustomizationCoordinate Frames

612

To post the newly created coordinate frame to graphics, use the function described below.

Notes:

The C name differs. It is DbFPostCoordinateFrame.

int DbFPostCoordinateFrame ( coord_id ) int coord_id

REAL xmat_lcl(4,4) The 4x4 transformation matrix of the coordinate frame relative to the reference frame (includes translation and rotation)

Output:

INTEGER <Return Value>

This function returns a value of zero if successful.

Error Conditions:

db_set_coord_ref_nodes ( coord_id, node_ids )

Description:

Set the reference nodes in a coordinate frame definition

Input:

INTEGER coord_id The coordinate frame ID

INTEGER node_ids(3) The IDs of the three node references (zeros to remove existing references)

Output:

INTEGER <Return Value> This function returns a value of zero if successful.

Error Conditions:

db_post_coord ( <coord_id> )

Input:

INTEGER <coord_id> The ID of the coordinate frame to be posted to graphics.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

613Chapter 8: Accessing the Patran DatabasePatran Element Topology Codes

Patran Element Topology CodesElement shape, maximum number of nodes, and node configuration for an element type is expressed through a Patran element topology code. In order to determine the appropriate element topology code for a given shape code and maximum number of nodes, use the following function: \

Notes:

The C call is “FemGetPatran25Etop”.

int FemGetPatran25Etop ( shape_code, num_of_nodes, topo_code )int shape_codeint num_of_nodesint *topo_code

In order to determine the PATRAN 2.5 shape code and maximum number of nodes for an element type given its element topology code, use the function described below.

fem_get_patran25_etop ( <shape_code>, <num_of_nodes>, <topo_code> )

Input:

INTEGER <shape_code> The PATRAN 2.5 shape code for this type of element:1 = Point Element2 = Bar Element3 = Triangular Element4 = Quadrilateral Element5 = Tetrahedral Element7 = Pentahedral Element8 = Hexahedral Element

INTEGER <num_of_nodes>

Output:

INTEGER <topo_code> The Patran element topology code to be used in referencing an element of this type.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationPatran Element Topology Codes

614

Notes:

The C name differs. It is DbFGetElemTopologyData.

int DbFGetElemTopologyData ( num_codes, topo_codes, shape_codes, nodes_per_elem )int num_codesint *topo_codesint *shape_codesint *nodes_per_elem

db_get_elem_topology_data ( <num_codes>, <topo_codes>, <shape_codes>, <nodes_per_elem> )

Input:

INTEGER <num_codes> The number of Patran topology codes input to this function.

INTEGER ARRAY <topo_codes> The <num_codes> topology codes being input to this function.

Output:

INTEGER ARRAY <shape_codes> The <num_codes> shape codes corresponding to the input topology codes. Their meaning is as follows:

1 = Point Element2 = Bar Element3 = Triangular Element4 = Quadrilateral Element5 = Tetrahedral Element7 = Pentahedral Element8 = Hexahedral Element

INTEGER ARRAY <nodes_per_elem> The Patran element topology code to be used in referencing an element of this type.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

615Chapter 8: Accessing the Patran DatabaseElements

ElementsElement data consists of element IDs, element topology information and element connectivity information. The functions needed to import and export element data to and from a Patran database are listed in the next two sections.

Exporting Element DataElement data can be extracted from the database for all elements in the database, for elements belonging to a specific group or for an individual element. To retrieve the data for all the elements in the database or for all elements belonging to a specified group, first determine the number of elements in the database or in the group for memory allocation purposes. To get the count of all the elements in the database, use the following function..

Notes:

The C name differs. It is DbFCountElems.

int DbFCountElems ( num_elems )int *num_elems

To determine the number of elements belonging to a specified group, use the function below.

db_count_elems ( <num_elems> )

Output:

INTEGER <num_elems> The number of elements in the database.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationElements

616

Notes:

The C name differs. It is DbFCountElemsInGroup.

int DbFCountElemsInGroup ( group_id, num_elems )int group_idint *num_elems

The following functions extract the IDs for all the elements in the database.

Notes:

The C name differs. It is DbFGetElemIds.

int DbFGetElemIds ( num_elems, elem_ids )int num_elemsint *elem_ids

To get the element IDs of all the elements belonging to a specific group, use the following function.

db_count_elems_in_group ( <group_id>, <num_elems> )

Input:

INTEGER <group_id> The internal ID of the group of interest. This ID can be determined by either “db_get_group_id” or “db_get_current_group_id” as described in Groups, 600.

Output:

INTEGER <num_elems> The number of elements belonging to the group specified by <group_id>.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

db_get_elem_ids ( <num_elems>, <elem_ids> )

Input:

INTEGER <num_elems> The total number of elements in the database.

Output:

INTEGER ARRAY <elem_ids> The IDs of all the <num_elems> elements in the database.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

617Chapter 8: Accessing the Patran DatabaseElements

Notes:

The C name differs. It is DbFGetElemIdsInGroup.

int DbFGetElemIdsInGroup ( num_elems, group_id, elem_ids )int num_elemsint group_idint *elem_ids

db_get_elem_ids_in_group ( <num_elems>, <group_id>, <elem_ids> )

Input:

INTEGER <num_elems> The number of elements belonging to the group of interest.

INTEGER <group_id> The internal ID of the group of interest. This ID can be determined by either “db_get_group_id” or “db_get_current_group_id” as described in Groups, 600.

Output:

INTEGER ARRAY <elem_ids> The <num_elems> IDs of all the elements belonging to the group specified by <group_id>.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationElements

618

Remarks:

The PCL function db_get_elem_top_def() can be used to interpret the values returned by the output value topo_codes.

The FORTRAN call name for this function is DB_GET_ELEM_ETOP.

The C call name for this function is DbFGetElemEtop() and has the following prototype:

int DbFGetElemEtop(int num_elems, int * elem_ids, int *topo_codes);

Example:

None.

db_get_elem_etop ( num_elems, elem_ids, topo_codes )

Description:

This function will determine the topology codes of a list of elements.

Input:

INTEGER num_elems This value specifies the number of offsets in the input value elem_ids.

INTEGER elem_ids(num_elems) This value specifies the element identifier’s title to put in the packet 25 title field.

Output:

INTEGER topo_codes This value returns the topological codes for the list of elements. See the remarks below for more information.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

Error Conditions:

This function may return a nonzero value if an error occurs.

619Chapter 8: Accessing the Patran DatabaseElements

db_get_elem_top_def (etop, etype, dimens, mxorder, nnodes, ncorner, nmidedge, nmidface, nmidbody, nedges, nfaces, nfedges, nfnodes, nacoords, nrcoords, shape, degen, edges, sense, faces, epacoords, eprcoords)

Description:

Gets the definition of an element topology in the database.

Input:

INTEGER etop The topology code of the definition created by this routine.

Output:

STRING etype[31] The name of the element topology.

INTEGER dimens Element Dimensionality.

INTEGER mxorder A code indicating the maximum order of any of the element edges, defined as follows:

Table 8-1

Value Edge Order Number of Nodes/Edge

0 N/A 1

1 Linear 2

2 Parabolic 3

3 Cubic 4

INTEGER nnodes The number nodes in each new type.

INTEGER ncorner Number of corner nodes.

INTEGER nmidedge Number of midedge nodes.

INTEGER nmidface Number of midface nodes.

INTEGER nmidbody Number of midbody nodes.

INTEGER nedges The number of edges in the new element.

INTEGER nfaces The number of faces in the new element.

INTEGER nfedges The maximum number of edges on each face.

INTEGER nfnodes The maximum number of midface nodes on each face.

INTEGER nacoords The number of area parametric coordinates which define each node.

INTEGER nrcoords The number of rectangular parametric coordinates which define each node.

INTEGER shape Element shape code.

PCL and CustomizationElements

620

Example:

STRING TOP_NAME INTEGER status INTEGER ELDIM, MXORDER, NCORNER, NMIDEDGE, NMIDFACE, NMIDBODY INTEGER NEDGES, NFACES, NFEDGES, NFNODES, NACOORDS, NRCOORDS INTEGER DEGEN, EDGES(_MAX_ELEM_EDGE_NODES*_MAX_ELEM_EDGES) INTEGER SENSE(_MAX_ELEM_FACES) INTEGER FACES(_MAX_ELEM_FACE_EDGES+4*_MAX_ELEM_FACES) REAL EPACOORDS(3) REAL EPRCOORDS(3)

INTEGER degen The topology code of degenerate form of element. Must be a previously defined topology.

INTEGER edges(mxorder+1, nedges) Edge definitions - a list of IDs of all nodes on each edge, in order of increasing parametric value. A value of 0 indicates a missing node.

INTEGER sense(faces) Code indicating whether face normal is pointing in or out:

Table 8-2

Value Direction of Face Normal

-1 In

0 Face in undefined

+1 Out

INTEGER faces(nfedges+nfnodes, nfaces)

Face definitions - a list of NFEDGES edge IDs, followed by a list of NFNODES node IDs. A value of 0 indicates a missing edge or node.

REAL epacoords(3) Element area parametric coordinates of each node in the element.

REAL eprcoords(3) Element rectangular parametric coordinates of each node in the element.

INTEGER <Return Value> Integer indicating success or failure of the routine. If the routine failed, this value contains an indication of the reason.

Error Conditions:

13000002 Unrecoverable database error

Self explanatory.

DB_ETOP_UNDEFINED The topology of element requested was not found.

DB_ETYPE_UNDEFINED The type of element requested was not found.

External Dependencies and Side Effects:

None.

621Chapter 8: Accessing the Patran DatabaseElements

/* * Get the element shape and number of nodes */

status = DB_GET_ELEM_TOP_DEF( EL_TOP_ID, TOP_NAME, ELDIM, @ MXORDER, NUM_NODES, NCORNER, NMIDEDGE, NMIDFACE, @ NMIDBODY, NEDGES, NFACES, NFEDGES, NFNODES, NACOORDS, @ NRCOORDS, LSHAPE, DEGEN, EDGES, SENSE, FACES, @ EPACOORDS, EPRCOORDS) IF ( status != 0 ) THEN RETURN status

Remarks:

Memory is allocated for the output variable within this function. If memory was allocated prior to the call, it is released prior to re-allocation. Therefore, if this function is used within a loop, there is no need to release the memory of the output variable.

Example:

INTEGER status, i_node, node_count, node_id(100), @ i_elem, element_count, element_id(VIRTUAL)

node_count = 100FOR (i_node = 1 TO node_count) node_id(i_node) = i_nodeEND FORstatus = db_get_elem_use_all_node(node_count, node_id, @ element_count, element_id)IF (0 < status) THEN msg_to_form(status, 4, 0, 0, 0.0, ““)ELSE IF (0 > status) THEN /* Error information already displayed */

db_get_elem_use_all_node (node_count, node_id, element_count, element_id)

Description:

This function finds the elements which nodes are all within the supplied list of node ids.

Input:

INTEGER node_count This value specifies the number of nodes.

INTEGER node_id (node_account) This array specifies the node ids.

Output:

INTEGER element_count This value returns the number of elements and the number of offsets in the element_id output value.

INTEGER element_id(VIRTUAL) This array returns the element ids.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate an error.

Error Conditions:

-1 This is an internal error status condition. There is no corresponding status message in the message database.

PCL and CustomizationElements

622

ELSE write_line(“element_count =”, element_count) FOR (i_elem = 1 TO element_count) write_line(“element_id(“, i_elem, ”) =”, @ element_id(i_elem)) END FOR END IFEND IF

To extract the IDs of the nodes associated to a list of elements or just a single element, use the function below..

Notes:

The C name differs. It is DbFGetNodesForElems.

int DbFGetNodesForElems ( num_elems, max_connect, elem_ids, connectivity )int num_elemsint max_connectint *elem_idsint *connectivity

Importing Element DataThe function used to import element data into a database is described below.

db_get_nodes_for_elems ( <num_elems>, <max_connect>, <elem_ids>, <connectivity> )

Input:

INTEGER <num_elems> The number of elements input to this function.

INTEGER <max_connect> The maximum number of nodes associated with any one of the input elements.

INTEGER ARRAY <elem_ids> The IDs of the <num_elems> elements input to this function.

Output:

INTEGER ARRAY <connectivity> A <max_connect>x<num_elems> array containing the IDs of all the nodes associated with each of the input element. The nodes are listed in standard Patran element connectivity ordering and each row is blank filled. For example, if there were two elements (a two noded bar and a four noded plate) then the connectivity array would be: [BarNodeI, BarNodeJ, 0, 0, PlateNodeI, PlateNodeJ, PlateNodeK, PlateNodeL].

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

623Chapter 8: Accessing the Patran DatabaseElements

.

db_create_elems ( <num_elems>, <max_connect>, <topo_codes>, <geom_type>, <geom_id>, <connectivity>, <group_id>, <elem_ids>, <exist_elem> )

Input:

INTEGER <num_elems> The number of elements to be added to the database.

INTEGER <max_connect> The maximum number of nodes associated with any one of the input elements.

INTEGER ARRAY <topo_codes> A <num_elems> array containing the topology codes associated with all of the input elements. These codes can be determined using the functions described in Patran Element Topology Codes (p. 613).

INTEGER ARRAY <geom_type> A <num_elems> array containing the geometry type each input element is to be associated with:0 = no geometry association2 = associated with a curve3 = associated with a surface4 = associated with a solid

INTEGER ARRAY <geom_id> A <num_elems> array containing the IDs of the geometry to which each element is associated. Zero if no geometry association exists.

INTEGER ARRAY <connectivity> The <max_connect>x<num_elems> array containing the IDs of all the nodes associated with each of the input element. The nodes are listed in standard Patran element connectivity ordering and each row is blank filled. For example, if there were two elements (a two noded bar and a four noded plate) then the connectivity array would be: [BarNodeI, BarNodeJ, 0, 0, PlateNodeI, PlateNodeJ, PlateNodeK, PlateNodeL].

INTEGER <group_id> The internal ID of the group to which these elements are to be added. The ID of a group can be determined by either “db_get_group_id” or “db_get_current_group_id” as described in Groups, 600.

INTEGER ARRAY <elem_ids> A <num_elems> array containing the IDs of all the elements to be added to the database.

Output:

INTEGER <exist_elem> The ID of the first duplicate element found. Zero if no duplicates were found.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationElements

624

Notes:

The C name differs. It is DbFCreateElems.

int DbFCreateElems ( num_elems, max_connect, topo_codes, geom_type, geom_id,connectivity, group_id, elem_ids, exist_elem )int num_elemsint max_connectint *topo_codesint *geom_typeint *geom_idint *connectivityint group_idint *elem_idsint *exist_elem

625Chapter 8: Accessing the Patran DatabaseElement Properties

Element Properties

Exporting Element Property DataElement properties are grouped together in element property regions. Determine the number of element property regions, extract the IDs of all the regions and then extract the property data associated with each region. The count of property regions in the Patran is given by the function described below.

Notes:

The C name differs. It is DbFCountRegionIds.

int DbFCountRegionIds ( num_regions ) int *num_regions

The IDs of all the element property regions defined in the database can be obtained by using “db_get_all_region_ids”.

db_count_region_ids ( <num_regions> )

Output:

INTEGER <num_regions>

The number of element property regions defined in the database.

INTEGER <Return Value>

This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

db_get_all_region_ids ( <num_regions>, <region_ids> )

Input:

INTEGER <num_regions> The number of regions defined in the database.

Output:

INTEGER ARRAY <region_ids> The <num_regions> IDs of all the element property regions defined in the database.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationElement Properties

626

Notes:

The C name differs. It is DbFGetAllRegionIds.

int DbFGetAllRegionIds ( num_regions, region_ids ) int num_regions int *region_ids

Next, examine the definition of the property region to determine the element attributes assigned to all the elements belonging thereto. The function used to extract element property region definitions is “db_get_region_definition”:

db_get_region_definition ( <region_id>, <set_name>, <gener_elem_type>, <set_id>, <dof_set_flag>, <condense_flag>, <geom_flag>, <form_flag>, <lam_flag>, <layer_count>, <material_id>, <material_lin>, material_dir> )

Input:

INTEGER <region_id> The ID of the element property region of interest.

Output:

CHARACTER ARRAY

<set_name> The name of the property set assigned to this property region.

INTEGER <gener_elem_type>

The ID of the generic element type of the elements belonging to this property region. See Generic Element Types, 481.

INTEGER <dof_set_flag> The ID of the degree-of-freedom set option chosen for this region.

INTEGER <condense_flag> The ID of the condensation option chosen for this region.

INTEGER <geom_flag> The ID of the geometric option chosen for this region.

INTEGER <form_flag> The ID of the formulation option chosen for this region.

INTEGER <lam_flag> The ID of the lamination option chosen for this region.

INTEGER <layer_count> Obsolete variable: should be ignored.

INTEGER <material_id> The internal ID of the first material reference in the property set. Zero if no material reference.

INTEGER <material_lin> The linearity code of the first material reference in the property set. Zero if no material reference.

INTEGER <material_dir> The directionality code of the first material reference in the property set. Zero if no material reference.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

627Chapter 8: Accessing the Patran DatabaseElement Properties

Notes:

The C name differs. It is DbFGetRegionDefinition.

int DbFGetRegionDefinition ( region_id, set_name, gener_elem_type, dof_set_flag, condense_flag, geom_flag, form_flag, lam_flag, layer_count, material_id, material_lin, material_dir ) int region_id char *set_name int *gener_elem_type int *dof_set_flag int *condense_flag int *geom_flag int *form_flag int *lam_flag int *layer_count int *material_id int *material_lin int *material_dir

The function “db_count_props” will determine the number of property words associated with the property region.

Notes:

The C name differs. It is DbFCountProps.

int DbFCountProps ( region_id, num_words ) int region_id int *num_words

The IDs of the property words associated with a specific property region are gotten through the use of “db_get_props_by_region”.

db_count_props ( <region_id>, <num_words> )

Input:

INTEGER <region_id> The ID of the element property region of interest.

Output:

INTEGER <num_words> The number of property words associated with this property region.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationElement Properties

628

Notes:

The C name differs. It is DbFGetPropsByRegion.

int DbFGetPropsByRegion ( num_words, region_id, word_ids) int num_words int region_id int *word_ids

The type and value assigned to each property word in a given property region can be extracted by using the following functions.

db_get_props_by_region ( <num_words>, <region_id>, <word_ids> )

Input:

INTEGER <num_words> The number of property words associated with the property region specified by <region_id>.

INTEGER <region_id> The internal ID of the element property region of interest.

Output:

INTEGER ARRAY <word_ids> The number of property words associated with this property region.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

629Chapter 8: Accessing the Patran DatabaseElement Properties

db_get_prop_value ( <region_id>, <word_id>, <material_id>, <data_type>, <integer_val>, <real_values>, <character_val>, <coord_id>, <node_id>, <field_id> )

Input:

INTEGER <region_id> The internal ID of the element property region of interest.

INTEGER <word_id> The internal ID of the element property word of interest.

Output:

INTEGER <material_id> The ID of the referenced material, if this word is a material reference.

INTEGER <data_type> A flag whose absolute value specifies the type of data assigned to this property word:1 = real scalar applied at element centroid2 = real vector3 = integer4 = character string5 = material reference6 = list of real values7 = real scalar applied at element nodes8 = node reference9 = coordinate frame reference11 = beam section. Translator is to use the section.12 = beam section props. Translator is to use the section’s properties.

If <data_type> is negative, the data was input through a field reference instead of through a constant value.

INTEGER <integer_val> The integer value assigned to the property word, if the word is an integer. The ID of the referenced beam section, if this word is a beam section or beam section props.

REAL ARRAY <real_values> A array of three values. If the word is a real scalar, the first component of the array will contain the value assigned to the property word and the other two components will be zero. If the word is a real vector, the array will contain the three components of the vector. If the data was input through a field instead as a constant value (i.e., <field_id> > 0), then the value of this property word should be determined through field evaluation, and the value stored in <real_values> should be ignored.

CHARACTER STRING

PCL and CustomizationElement Properties

630

Notes:

The C name differs. It is DbFGetPropValue.

int DbFGetPropValue ( region_id, word_id, material_id, data_type, integer_val, real_values, character_val, coord_id, node_id, field_id ) int region_id int word_id int *material_id int *data_type int *integer_val float *real_values char *character_val int *coord_id int *node_id int *field_id

For more on the evaluation or exportation of data fields, review to Data Fields, 643.

<character_val>[31] The character string assigned to this property word, if the word type is character string (<data_type> = 4).

INTEGER <coord_id> The ID of the referenced coordinate frame, if the word type is coordinate frame reference.

INTEGER <node_id> The ID of the referenced node, if the word type is node reference.

INTEGER <field_id> The ID of the field through which the property data is input. If zero, there is no field reference and the value of the word should be read from the appropriate output argument listed above (e.g., <real_values>). If a valid field reference (<field_id> > 0), then the value of the word should be determinedthrough field evaluation and the values supplied in the above output arguments (e.g., <real_values>) should be ignored.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

631Chapter 8: Accessing the Patran DatabaseElement Properties

Remarks:

Memory is allocated for the output variable within this function. If memory was allocated prior to the call, it is released prior to re-allocation. Therefore, if this function is used within a loop, there is no need to release the memory of the output variable.

Example:

INTEGER status, region_count, region_id(10)STRING return_list[VIRTUAL]

region_count = 1region_id(1) = 1status = ep_get_app_reg_str(region_count, region_id, return_list)IF (0 < status) THEN msg_to_form(status, 4, 0, 0, 0.0, ““)ELSE IF (0 > status) THEN /* Error information already displayed */ ELSE write_line(“return_list =”, return_list) END IFEND IF

ep_get_app_reg_str (region_count, region_id, app_reg_content)

Description:

This function retrieves the content of element property application regions.

Input:

INTEGER region_count This value specifies the number of element property region ids.

INTEGER region_id(region_count) This array specifies the element property region ids.

Output:

STRING return_list[VIRTUAL] This value returns a list processor string of entities.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate an error.

Error Conditions:

-1 This is an internal error status condition. There is no corresponding status message in the message database.

PCL and CustomizationElement Properties

632

ep_word_val_at_el_cen (word_id, word_component, search_element_count, search_element_id, found_element_count, found_element_id, found_element_value)

Description:

This function evaluates an element property word value at element centroids for all element property region..

Input:

INTEGER word_id This value specifies the element property word id. Element properties without this word_id will be ignored. See function db_create_phys_prop_defn() for word_id value table.

INTEGER word_component This value specifies the component of the data to extract (values can range from 1 to 3) this value is ignored in the case the data is scalar.

INTEGER search_element_count This value specifies the number of elements for which we seek an element property word value. In order to obtain values for all elements associated to the region_id, pass a value of -1. The purpose of having a list of elements for which we seek a value, is to limit the quantity of field evaluations for the elements associated to an element property because each evaluation will require to calculate the centroid of the elements when non entity data fields are involved.

INTEGER search_element_id() This array specifies the element ids for which we seek an element property word value. If search_elem_qtt=-1, this array is not used. Array must be sorted in an increasing order and duplicated must be removed. This is not done within the function for performance reasons, as this function may be used in a loop, using the same input array. Sort/duplicates is verified within the function.

Output:

INTEGER found_element_count This value returns the number of element associated to the region_id, which could be found in search_element_id.

633Chapter 8: Accessing the Patran DatabaseElement Properties

Remarks:

Memory is allocated for the output variables within this function. If memory was allocated prior to the call, it is released prior to re-allocation. Therefore, if this function is used within a loop, there is no need to release the memory of the output variable.

Example:

INTEGER status, word_id, word_component, @ search_element_count, search_element_id(1), found_element_count, found_element_id(VIRTUAL), i_elemREAL found_element_value(VIRTUAL)

word_id = 6 /* Definition of XY Plane */word_component = 3search_element_count = -1status = ep_word_val_at_el_cen(word_id, word_component, @ search_element_count, search_element_id, @ found_element_count, found_element_id, @ found_element_value)IF (0 < status) THEN msg_to_form(status, 4, 0, 0, 0.0, ““)ELSE IF (0 > status) THEN /* Error information already displayed */ ELSE write_line(“found_element_count =”, found_element_count) FOR (i_elem = 1 TO found_element_count) write_line(“found_element_id(“, i_elem, ”) =”, @ found_element_id(i_elem)) write_line(“found_element_value(“, i_elem, ”) =”, @ found_element_value(i_elem)) END FOR END IFEND IF

INTEGER found_element_id (VIRTUAL) This array returns the element ids associated to the region_id, which could be found in search_element_id.

REAL found_element_value (VIRTUAL)

This array returns the element property word component values at the centroid of the elements ids in found_element_id.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate an error.

Error Conditions:

-1 This is an internal error status condition. There is no corresponding status message in the message database.

PCL and CustomizationElement Properties

634

ep_word_val_at_el_cen_by_reg (region_id, word_id, word_component, search_element_count, search_element_id, found_element_count, found_element_id, found_element_value)

Description:

This function evaluates an element property word value at element centroids for one element property region.

Input:

INTEGER region_id This value specifies the element property region id.

INTEGER word_id This value specifies the element property word id. If the word_id is not found to be associated with the region_id, this function will exit normally (Return Value =0) without allocating memory for the output variable. See function db_create_phys_prop_defn() for word_id value table.

INTEGER word_component This value specifies the component of the data to extract (values can range from 1 to 3) this value is ignored in the case the data is scalar.

INTEGER search_element_count This value specifies the number of elements for which we seek an element property word value. In order to obtain values for all elements associated to the region_id, pass a value of -1. The purpose of having a list of elements for which we seek a value, is to limit the quantity of field evaluations for the elements associated to an element property because each evaluation will require to calculate the centroid of the elements (when non entity data fields are involved).

INTEGER search_element_id() This array specifies the element ids for which we seek an element property word value. If search_elem_qtt=-1, this array is not used. Array must be sorted in an increasing order and duplicated must be removed. This is not done within the function for performance reasons, as this function may be used in a loop, using the same input array. Sort/duplicates is verified within the function.

Output:

INTEGER found_element_count This value returns the number of element associated to the region_id, which could be found in search_element_id.

635Chapter 8: Accessing the Patran DatabaseElement Properties

Remarks:

Memory is allocated for the output variable within this function. If memory was allocated prior to the call, it is released prior to re-allocation. Therefore, if this function is used within a loop, there is no need to release the memory of the output variable.

Example:

INTEGER status, region_id, word_id, word_component, @ search_element_count, search_element_id(1), @ found_element_count, found_element_id(VIRTUAL), i_elemREAL found_element_value(VIRTUAL)

region_id = 1word_id = 6 /* Definition of XY Plane */word_component = 3search_element_count = -1status = ep_word_val_at_el_cen_by_reg(region_id, word_id, @ word_component, search_element_count, @ search_element_id, found_element_count, @ found_element_id, found_element_value)IF (0 < status) THEN msg_to_form(status, 4, 0, 0, 0.0, ““)ELSE IF (0 > status) THEN /* Error information already displayed */ ELSE write_line(“found_element_count =”, found_element_count) FOR (i_elem = 1 TO found_element_count) write_line(“found_element_id(“, i_elem, ”) =”, @ found_element_id(i_elem)) write_line(“found_element_value(“, i_elem, ”) =”, @ found_element_value(i_elem)) END FOR END IFEND IF

Importing Element Property DataIn order to create a element property record within Patran first define the property region and then associate property words to that region. The function to create a property region is described below.

INTEGER found_element_id (VIRTUAL)

This array returns the element ids associated to the region_id, which could be found in search_element_id.

REAL found_element_value (VIRTUAL)

This array returns the element property word component values at the centroid of the elements ids in found_element_id.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate an error.

Error Conditions:

-1 This is an internal error status condition. There is no corresponding status message in the message database.

PCL and CustomizationElement Properties

636

Notes:

The C name differs. It is DbFCreatePhysPropRegion.

int DbFCreatePhysPropRegion ( region_id, region_name, gener_elem_type, geom_id, condense_id, form_id, lam_id, dof_set_id )int region_idchar *region_nameint gener_elem_typeint geom_idint condense_idint form_idint lam_idint dof_set_id

<region_id> is an input in this case, not an output as is typical. In order to determine a valid value for <region_id> the user can use the following routing to retrieve the highest physical property region ID and then increment this value by one.

db_create_phys_prop_region ( <region_id>, <region_name>, <gener_elem_type>, <geom_id>, <condense_id>, <form_id>, <lam_id>, <dof_set_id> )

Input:

INTEGER <region_id> The internal ID assigned to the new element property region by Patran.

CHARACTER STRING

<region_name> The external name used to reference the element property region.

INTEGER <gener_elem_type>

The ID of the generic element type of the elements belonging to this property region. See Generic Element Types, 481.

INTEGER <geom_id> The ID of the geometry option of this property region.

INTEGER <condense_id> The ID of the condensation option of this property region.

INTEGER <form_id> The ID of the formulation option of this property region.

INTEGER <lam_id> The ID of the lamination option of this property region.

INTEGER <dof_set_id> The degree-of-freedom set ID of this property region.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

637Chapter 8: Accessing the Patran DatabaseElement Properties

Notes:

The C name is DbGetMaxPhysicalProperty.

int DbGetMaxPhysicalProperty ( max_region_id )int *max_region_id

The function which associates element property words with an element property region is “db_create_phys_prop_value”.

db_get_max_physical_property ( <max_region_id> )

Output:

INTEGER <max_region_id> The highest physical property region ID defined in the database.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationElement Properties

638

db_create_phys_prop_value ( <region_id>, <word_id>, <material_id>, <data_type>, <integer_val>, <real_val>, <character_val>, <node_id>, <coord_id>, <field_id> )

Input:

INTEGER <region_id> The internal ID of the element property region to which the specified element property word is to be added.

INTEGER <word_id> The ID of the property word to be added.

INTEGER <material_id> The ID of the referenced material. Only applicable when <data_type> is 5.

INTEGER <data_type> A flag whose absolute value specifies the type of data assigned to this property word. If the value of <data_type> is positive, the word references a constant value such as a real number or a node reference. If the value of <data_type> is negative, the word references a data field. The meaning of the absolute value of <data_type> is as follows:1 = real scalar applied at element centroid2 = real vector3 = integer4 = character string5 = material reference6 = list of real values7 = real scalar applied at element nodes8 = node reference9 = coordinate reference

INTEGER <integer_val> The integer value of the property word if <data_type> = 3.

REAL ARRAY <real_val> The array containing the three possible components of the real value. If <data_type> is 1 or 7, then only the first component has meaning and the other two components are zero. Values should only be input here if there is no field reference for this property word (<field_id> = 0 and/or <data_type> > 0).

CHARACTER STRING

<character_val> The character string value of the property word if <data_type> = 4. A blank string if not applicable. Maximum length of this string is 31 characters.

INTEGER <node_id> The ID of the referenced node if <data_type> = 8.

INTEGER <coord_id> The ID of the referenced coordinate frame if <data_type> = 9.

INTEGER <field_id> The ID of the referenced data field. Should be zero if there is no referenced data field.

639Chapter 8: Accessing the Patran DatabaseElement Properties

Notes:

The C name differs. It is DbFCreatePhysPropValue.

int DbFCreatePhysPropValue ( region_id, word_id, material_id, data_type, integer_val,real_val, character_val, node_id, coord_id, field_id )int region_idint word_idint material_idint data_typeint integer_valfloat real_val[ ]char *character_valint node_idint coord_idint field_id

For more on the importation of data fields, refer to Data Fields, 643.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

db_modify_phys_prop_region_name ( old_name, new_name )

Description:

This function renames a property set.

Input:

STRING[32] old_name Property name to be modified.

STRING[32] new_name New property name.

Output:

INTEGER <Return Value> 0=success, otherwise failure.

PCL and CustomizationAssociation between Elements and Element Properties

640

Association between Elements and Element Properties

Extracting Association between Elements and Element PropertiesThere are two methods of determining an element’s association to an element property region. Use “db_get_region_for_elements” in order to get the region IDs associated with each input element ID. The form of this function is as follows:

Notes:

The C name differs. It is DbFGetRegionForElements.

int DbFGetRegionForElements ( num_elems, element_ids, region_ids )int num_elemsint element_ids[ ]int region_ids[ ]

Alternatively, to get the count of all the elements associated to a given element property region and then extract the IDs of all the elements associated with the specified element property region. The two functions needed for this method are described below.

db_get_region_for_elements ( <num_elems>, <element_ids>, <region_ids> )

Input:

INTEGER <num_elems> The number of elements input to this function.

INTEGER ARRAY <element_ids> The <num_elems> IDs of all the input elements.

Output:

INTEGER ARRAY <region_ids> The <num_elems> IDs of all the element property regions associated with each input element.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

641Chapter 8: Accessing the Patran DatabaseAssociation between Elements and Element Properties

Notes:

The C name differs. It is DbFCountElementsInRegion.

int DbFCountElementsInRegion ( region_id, num_elems )int region_idint *num_elems

Notes:

The C name differs. It is DbFGetElementsInRegion.

int DbFGetElementsInRegion ( num_elems, region_id, element_ids )int *num_elemsint region_idint *element_ids

db_count_elements_in_region ( <region_id>, <num_elems> )

Input:

INTEGER <region_id> The internal ID of the element property region of interest.

Output:

INTEGER <num_elems> The number of elements associated with the element property region specified by <region_id>.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

db_get_elements_in_region ( <num_elems>,<region_id>,<element_ids> )

Input:

INTEGER <num_elems> Input only if the input value is not zero. The number of elements associated with the element property region specified by <region_id>.

INTEGER <region_id> The internal ID of the element property region of interest.

Output:

INTEGER <num_elems> Only output if the input value is zero. The number of elements associated with the element property region specified by <region_id>.

INTEGER ARRAY <element_ids> The <num_elems> IDs of all the elements associated with the element property region specified by <region_id>.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationAssociation between Elements and Element Properties

642

Note that there are two ways of incorporating the two functions mentioned above. To determine the exact number of elements associated to the region by using “db_count_elements_in_region” allocate exactly that much memory and then get the element IDs from “db_get_elements_in_region”. In this scenario, the <num_elems> argument input to “db_get_elements_in_region” would be non-zero and would be the value coming from “db_count_elements_in_region”. On the other hand, if a maximum limit is known for the number of elements associated with the property region, say the number of elements in the model, then skip the first function, allocate memory according to the maximum limit and then call “db_get_elements_in_region” with the input argument <num_elems> having the value of zero. The first approach takes more time but does not waste memory, whereas the second approach is faster but may allocate unnecessarily large chunks of memory.

Creating Association between Elements and Element Properties

The function used to create association between an element and an element property region is described below. Note that an element can only be associated to one element property region.

Notes:

The C name differs. It is DbFAssociateElementToRegion.

int DbFAssociateElementToRegion ( element_id, region_id )int element_idint region_id

db_associate_element_to_region ( element_id, region_id )

Input:

INTEGER num_elems The ID of the element to be associated to the specified element property region.

INTEGER element_ids The ID of the element property region to which the element is to be associated.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

643Chapter 8: Accessing the Patran DatabaseData Fields

Data FieldsData fields are used in element properties, material properties and loads and boundary conditions to express input data as a function of spatial position, time, temperature, stress, total strain, or any other variable or combination of variables, such as stress and temperature. There are four types of data fields, a PCL equation field, a tabular field, a result field and an entity field. The PCL equation field is a field defined by PCL equations. Only spatial variance can be expressed through a PCL equation table. The dependent values can be real scalars, real vectors, or, if the MSC Nastran Analysis Preference has been selected, complex scalars. A tabular field is a field defined by a table of data. Tabular fields can express variance with any variable (space, time, temperature, stress, frequency, total strain, displacement, velocity) or combination of variables (e.g., stress and temperature), even user defined variables which are not directly understood by Patran. The two restrictions with tabular fields are that the dependent values must be scalars (real or complex) and that discontinuities in the field are not allowed. Many times discontinuities exist in a field. For example, if thickness is related to elements in the analysis code of interest, then the thickness at a given point in space may have different values depending upon the element. The thickness at point [10.5, 1.2, 0.5] may be 0.25 for element 5, but the thickness at the same point in space may be 0.15 for element 6. The entity field accommodates these discontinuities by storing field data not only as a function of space but also a function of entity ID and position within the entity. The entity field is restricted to spatial variance. The dependent values of an entity field can be scalars, vectors or tensors. Result fields are fields created by Patran from result information. They are only spatially varying and can accommodate discontinuities in the same manner as entity fields. The dependent values for result fields can be scalars, vectors or tensors.

Typically, when exporting data field information, the user should evaluate the data field at the points of interest and export the results of that evaluation instead of directly exporting the data field definition. But, there are two instances where the user may wish to export the data field in its native form. If the end application can make use of the defining PCL equations, then the user may wish to directly export the PCL equations. Of course, this is only applicable for PCL equation data fields. Also, if the user application does not know what the “points of interest” are and simply wants to output the tabular data field in its native form, then he can export the table as input by the user. The “points of interest” for a spatially varying field should always be known, so this option should only be used for fields which vary according to time, temperature or any other non-spatial variable. This option is only applicable for tabular data fields since all other data field types are restricted to spatial variance. An example of this second case is temperature dependent data fields. The application interface probably doesn’t know which temperature values are of interest and should probably output the data points just as the user input them.

Evaluation of Data Fields

All four data field types can be evaluated with the following PCL function. Note that evaluation of fields which reference native Unigraphics geometry (i.e., parametric spatially varying data fields) will be incorrect for external programs. Fields which reference native Unigraphics geometry should be evaluated from within Patran (i.e., from PCL) and then the results of this evaluation somehow passed to the external process. Or, more simply, parametric spatially varying (C1, C2, C3) data fields which refer to native Unigraphics geometry should be avoided. Try using absolute (X, Y, Z) spatial variance instead.

PCL and CustomizationData Fields

644

get_field_values_25 ( <field_id>, <num_evals>, <eval_dim>, <field_dim>, <eval_points>, <entity_type>, <entity_ids>, <face_ids>, <edge_ids>, <node_positions>, <field_values>)

Input:

INTEGER <field_id> The internal ID of the data field to be evaluated.

INTEGER <num_evals> The number of points at which the data field is to be evaluated. To evaluate a temperature dependent field at temperatures of 300 and 350, then <num_evals> would be two. To evaluate a spatially varying field at the centroid and the four nodes of a quadrilateral surface element then <num_evals> would be 5.

INTEGER <eval_dim> The dimensionality of the points at which the field is to be evaluated. For example, <eval_dim> would be one for temperature but 3 for a point in space (x, y, z).

INTEGER <field_dim> The dimensionality of the data stored in the field. One for a scalar, three for a vector, and six for a tensor. Note that tabular data fields can only have scalar dependent values and PCL equation data fields are restricted to scalar and vector dependent values.

REAL ARRAY <eval_points> An array of size <eval_dim>x<num_evals> containing all the points at which the field is to be evaluated. this array is not used when evaluating entity data fields and should be filled with zeros in this case.

INTEGER <entity_type> Flag specifying which entity type this result data field or entity data field refers to. 123 for nodes, 124 for elements, 0 if not applicable. This array is only used when evaluating entity data fields.

INTEGER ARRAY <entity_ids> A vector of <num_evals> IDs specifying the entities to which the corresponding <eval_points> belong. A vector of <num_evals> zeroes if not applicable. This array is only used when evaluating entity data fields.

INTEGER ARRAY <face_ids> A vector of <num_evals> IDs specifying the face to which the corresponding <eval_points> belong. See Patran’s Element Library (p. 402) in the Reference Manual - Part III for details about face numbering. A vector of <num_evals> zeroes if not applicable. This array is only used when evaluating entity data fields.

645Chapter 8: Accessing the Patran DatabaseData Fields

Notes:

The C name is GetFieldValues25.

int GetFieldValues25 ( field_id, num_evals, eval_dim, field_dim, eval_points, entity_type, entity_ids, face_ids, edge_ids, node_positions, field_values )int field_idintnum_evalsint eval_dimint field_dimfloat eval_points [ ][3]int entity_typeint *entity_idsint *face_idsint*edge_idsint *node_positionsfloat*field_values

Exportation of Data Fields

First, the internal ID of a data field can be related to the external name of the field through the function below.

INTEGER ARRAY <edge_ids> A vector of <num_evals> IDs specifying the edge to which the corresponding <eval_points> belong. See Patran’s Element Library (p. 402) in the Reference Manual - Part III for details about edge numbering. A vector of <num_evals> zeroes if not applicable. This array is only used when evaluating entity data fields.

INTEGER ARRAY <node_positions> A vector of <num_evals> IDs specifying the node position in the element face or element edge to which the corresponding <eval_points> belong. These positions are with respect to the edge or face, not the entire element. For example, the first node on edge 2 of an element would have a <node_positions> of 1. See Patran’s Element Library (p. 402) in the Reference Manual - Part III for details about node positions. A vector of <num_evals> zeroes if not applicable. This array is only used when evaluating entity data fields.

Output:

REAL ARRAY <field_values> An array of size <field_dim>x<num_evals> containing the value of the field at the evaluation points.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationData Fields

646

Notes:

The C name differs. It is DbFGetFieldName.

int DbFGetFieldName ( field_id, field_name, field_var )int field_idchar *field_nameint *field_var

Use the following function to determine basic information about its type and size. This function is very useful in determining the needed memory to store a tabular data field.

db_get_field_name ( <field_id>, <field_name>, <field_var> )

Input:

INTEGER <field_id> The internal ID of the data field of interest.

Output:

CHARACTER STRING

<field_name> The name of the data field specified by <field_id>.

INTEGER <field_var> A flag specifying the type of variance of the data field:0 = spatially varying field1 = time/frequency dependent field2 = material data field which could depend on many variables including temperature, stress, total strain, plastic strain, etc., and certain combinations thereof.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

647Chapter 8: Accessing the Patran DatabaseData Fields

db_get_field ( <field_id>, <field_name>, <field_var>, <field_type>, <geom_type>, <geom_id>, <extrap_opt>, <data_type>, <coord_id>, <field_type>, <num_vars>, <var_type_1>, <var_type_2>, <var_type_3>, <func_1_size>, <func_2_size>, <func_3_size>, <lin_def>, <num_var_1>, <num_var_2>, <num_var_3> )

Input:

INTEGER <field_id> The internal ID of the data field of interest.

Output:

CHARACTER STRING

<field_name> The internal ID of the data field of interest.

INTEGER <field_var> The type of variance of the data field:0 = Spatially varying field1 = Material data field which could depend on many variables including temperature, stress, total strain, plastic strain, etc., and certain combinations thereof.2 = Non-Spatial field, for defining fields dependent on time, frequency, temperature, displacement, velocity, or user-defined independent variables.3 = Frequency dependent (Obsolete - Pre-Release 1.2 argument.)

INTEGER <field_type> Possible values are zero for a scalar field, one for a vector field, three for a tensor field, and ten for a complex scalar field. Note that tabular fields cannot be vector or tensor fields and that PCL equation data fields cannot be tensor fields.

INTEGER <geom_type> The type of geometry entity associated with this data field. Two for a line, three for a surface and four for a solid. This is only applicable for data fields with parametric (C1, C2, C3) independent variables.

INTEGER <geom_id> The ID of the geometry entity associated with this data field. This is only applicable for data fields with parametric (C1, C2, C3) independent variables.

INTEGER <extrap_opt> The type of data extrapolation method used (applicable only for data fields stored as tables):1 = use closest tabular value2 = use linear extrapolation3 = use zero for all points out of table range

INTEGER <data_type> The data type of the independent variable for spatially varying fields: 0 = real values, 1 = parametric values.

INTEGER <coord_id> The coordinate frame in which the independent variable should be interpreted for spatially varying fields with <data_type> = 0.

PCL and CustomizationData Fields

648

INTEGER <field_type> The type of data field:0 = PCL equation data field1 = tabular data field2 = results data field3 = entity data field

INTEGER <num_vars> The number of variables this field depends on. For example, <num_vars> = 3 for a 3D spatially varying field and <num_vars> = 1 for a time dependent field.

INTEGER <var_type_1> The type of independent variable # 1:1 = x2 = y3 = z4 = r5 = theta6 = phi7 = C18 = C29 = C310 = temperature11 = stress, total strain, or plastic strain12 = strain rate13 = time14= frequency15= radiosity16= displacement17= velocity18 = user-defined19 = frequency for real-imaginary complex field20 = frequency for magnitude-phase (degrees) complex field21 = frequency for magnitude-phase (radians) complex field

Note that the use of variable type IDs 19, 20, or 21 informs Patran that the field is complex-valued. Depending on which of these values is selected, the complex field values may be stored as real and imaginary values (19), as magnitudes and phases in degrees (20), or as magnitudes and phases in radians (21).

INTEGER <var_type_2> The type of independent variable # 2:The possible values are the same as those for var_type_1.

INTEGER <var_type_3> The type of independent variable # 3:The possible values are the same as those for var_type_1.

INTEGER <func_1_size> The length of the character string containing the PCL function defining the first component of the field data. Only applicable for non-tabular fields.

649Chapter 8: Accessing the Patran DatabaseData Fields

Notes:

The C name differs. It is DbFGetField.

int DbFGetField ( field_id, field_name, field_var, field_dim, geom_type, geom_id, extrap_opt, data_type, coord_id, field_type, num_vars, var_type_1, var_type_2, var_type_3, func_1_size, func_2_size, func_3_size, lin_def, num_var_1, num_var_2, num_var_3 )int field_idchar *field_nameint *field_varint *field_dimint *geom_typeint *geom_idint *extrap_optint *data_typeint *coord_idint *field_typeint *num_varsint *var_type_1int *var_type_2int *var_type_3int *func_1_sizeint *func_2_sizeint *func_3_sizeint *lin_defint *num_var_1int *num_var_2int *num_var_3

In order to extract tabular data fields in their native form, use the function described below. The db_get_field function should be used to determine the needed storage requirements of a data field prior to calling this function.

INTEGER <func_2_size> The length of the character string containing the PCL function defining the second component of the field data. Only applicable for non-tabular vector fields.

INTEGER <func_3_size> The length of the character string containing the PCL function defining the third component of the field data. Only applicable for non-tabular vector fields.

LOGICAL <lin_def> A flag specifying whether a data field with parametric independent variables is linear across the target geometry (TRUE) or not (FALSE).

INTEGER <num_var_1> The number of stored values for independent variable # 1. Only applicable for tabular fields.

INTEGER <num_var_2> The number of stored values for independent variable # 2. Only applicable for tabular fields.

INTEGER <num_var_3> The number of stored values for independent variable # 3. Only applicable for tabular fields.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationData Fields

650

Notes:

The C name differs. It is DbFGetFieldTable.

int DbFGetFieldTable ( field_id ,num_vars ,num_var_1, num_var_2, num_var_3, var_1_values, var_2_values, var_3_values, field_values ) int field_idint num_varsint num_var_1int num_var_2int num_var_3float *var_1_valuesfloat *var_2_valuesfloat *var_3_valuesfloat *field_values

db_get_field_table ( <field_id>, <num_vars>, <num_var_1>, <num_var_2>, <num_var_3>, <var_1_values>, <var_2_values>, <var_3_values>, <field_values> )

Input:

INTEGER <field_id> The internal ID of the data field of interest.

INTEGER <num_vars> The number of independent variables upon which this data field is dependent.

INTEGER <num_var_1> The number of data points for independent variable # 1.

INTEGER <num_var_2> The number of data points for independent variable # 2. One, if <num_vars> is less than two.

INTEGER <num_var_3> The number of data points for independent variable # 3. One, if <num_vars> is less than three.

Output:

REAL ARRAY

<var_1_values> An array containing the <num_var_1> data points for independent variable # 1.

REAL ARRAY

<var_2_values> An array containing the <num_var_2> data points for independent variable # 2. A single zero, if <num_vars> is less than two.

REAL ARRAY

<var_3_values> An array containing the <num_var_3> data points for independent variable # 3. A single zero, if <num_vars> is less than three.

REAL ARRAY

<field_values> This array contains the values of the data field at all prescribed data points. For real-valued fields, its length is <num_var_1>x<num_var_2>x<num_var_3>. For complex-valued fields, its length is twice that, with all of the first complex component terms preceding all second component terms. That is, all reals precede all imaginaries and all magnitudes precede all phases.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

651Chapter 8: Accessing the Patran DatabaseData Fields

In order to extract the PCL equations defining a PCL equation data field use the function described below. The db_get_field function should be used to determine the string size of these equations prior to calling this function.

Notes:

The C name differs. It is DbFGetFieldFunction.

int DbFGetFieldFunction (field_id, func_1_size, func_2_size, func_3_size, func_1, func_2, func_3)int field_idint func_1_sizeint func_2_sizeint func_3_sizechar *func_1char *func_2char *func_3

db_get_field_function ( <field_id>, <func_1_size>, <func_2_size>, <func_3_size>, <func_1>, <func_2>, <func_3> )

Input:

INTEGER <field_id> The internal ID of the data field of interest.

INTEGER <func_1_size> The number of characters in the string containing the PCL function for the first component of the data field.

INTEGER <func_2_size> The number of characters in the string containing the PCL function for the second component of the data field. One if this is a scalar field.

INTEGER <func_3_size> The number of characters in the string containing the PCL function for the third component of the data field. One if this is a scalar field.

INTEGER

Output:

CHARACTER STRING

<func_1> A character string containing the PCL function for the first component of the data field.

CHARACTER STRING

<func_2> A character string containing the PCL function for the second component of the data field. A blank string if this is a scalar field.

CHARACTER STRING

<func_3> A character string containing the PCL function for the third component of the data field. A blank string if this is a scalar field.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationData Fields

652

Notes:

The C name differs. It is DbFGetAllFieldNames.

Notes:

Use in a while loop with the condition WHILE( status == 0 ) get next.

The C name differs. It is DbFGetNextFieldName.

db_get_all_field_names ( object )

Function

Prepares the database to return the field names for a given object. Used to conjunction with db_get_next_field_name.

Input:

INTEGER object Object type ID: 0 for Spatial, 1 for Material, 2 for Non Spatial

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

db_get_next_field_name ( field_id, field_name )

Function

Used in a loop, after calling db_get_all_field_names, to retrieve the field ids and names of a given object.

Output:

INTEGER field_id Field ID.

STRING field_name[31] Field name.

INTEGER <Return Value> = 0, while there are more fields.

db_get_field_id ( field_name, field_id )

653Chapter 8: Accessing the Patran DatabaseData Fields

Notes:

The C name differs. It is DbFGetFieldId.

Importation of Data FieldsThe db_create_field function should be used to create PCL equation data fields or tabular data fields. The relevance of many of these functions arguments depends upon which type of data field is being created.

Function

Return the field ID given the name.

Input:

STRING field_name[31] Name of the field.

Output:

INTEGER field_id Internal field ID.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationData Fields

654

db_create_field ( <field_id>, <field_name>, <field_var>, <field_type>, <geom_type>, <geom_id>, <extrap_opt>, <data_type>, <coord_id>, <field_type>, <num_vars>, <var_type_1>, <var_type_2>, <var_type_3>, <func_1_size>, <func_2_size>, <func_3_size>, <func_1>, <func_2>, <func_3>, <lin_def>, <num_var_1>, <num_var_2>, <num_var_3>, <var_1_values>, <var_2_values>, <var_3_values>, <field_values> )

Input:

CHARACTER STRING

<field_name> The external name used to reference the data field.

INTEGER <field_var> The type of variance of the data field:0 = spatially varying field1 = material data field which could depend on many variables including temperature, stress, total strain, plastic strain, etc., and certain combinations thereof.2 = non-spatial data field which could depend on many variables including time, frequency, temperature, displacement, velocity, user-defined variables, and certain combinations thereof.

INTEGER <field_type> 0 = real scalar field; 1 = real vector field; 10 = complex scalar field.Note that tabular fields cannot be vector fields.

INTEGER <geom_type> The type of geometry entity associated with this data field. Two for a line, three for a surface and four for a solid. This is only applicable for data fields with parametric (<data_type> = 1: C1, C2, C3) independent variables.

INTEGER <geom_id> The ID of the geometry entity associated with this data field. This is only applicable for data fields with parametric (<data_type> = 1: C1, C2, C3) independent variables.

INTEGER <extrap_opt> The type of data extrapolation method used (applicable only for data fields stored as tables):1 = use closest tabular value2 = use linear extrapolation3 = use zero for all points out of table range

INTEGER <data_type> The data type of the independent variable for spatially varying fields: 0 = real values, 1 = parametric values.

INTEGER <coord_id> The coordinate frame in which the independent variable should be interpreted for spatially varying fields with <data_type> = 0.

INTEGER <field_type> The type of data field being created: 0 = as PCL equation, 1 = tabular data field.

655Chapter 8: Accessing the Patran DatabaseData Fields

INTEGER <num_vars> The number of variables this field depends on. For example, <num_vars> = 3 for a 3D spatially varying field and <num_vars> = 1 for a time dependent field.

INTEGER <var_type_1> The type of independent variable # 1 (zero if not applicable):1 = x2 = y3 = z4 = r5 = theta6 = phi7 = C18 = C29 = C310 = temperature11 = stress, total strain, or plastic strain12 = strain rate13 = time14= frequency15= radiosity16= displacement17= velocity18 = user-defined19 = frequency for real-imaginary complex field20 = frequency for magnitude-phase (degrees) complex field21 = frequency for magnitude-phase (radians) complex field

Note that the use of variable type IDs 19, 20, or 21 informs Patran that the field is complex-valued. Depending on which of these values is selected, the complex field values may be stored as real and imaginary values (19), as magnitudes and phases in degrees (20), or as magnitudes and phases in radians (21).

INTEGER <var_type_2> The type of independent variable # 2 (zero if not applicable):The possible values are the same as those for var_type_1.

INTEGER <var_type_3> The type of independent variable # 3 (zero if not applicable):The possible values are the same as those for var_type_1.

INTEGER <func_1_size> The length of the character string containing the PCL function defining the first component of the field data. Only applicable for non-tabular fields. Use the value of one if not applicable.

INTEGER <func_2_size> The length of the character string containing the PCL function defining the second component of the field data. Only applicable for non-tabular vector fields. Use the value of one if not applicable.

PCL and CustomizationData Fields

656

INTEGER <func_3_size> The length of the character string containing the PCL function defining the third component of the field data. Only applicable for non-tabular vector fields. Use the value of one if not applicable.

CHARACTER STRING

<func_1> The character string containing the PCL function representing the first component of the field data. Only applicable for non-tabular fields. Use a blank string if not applicable.

CHARACTER STRING

<func_2> The character string containing the PCL function representing the second component of the field data. Only applicable for non-tabular vector fields. Use a blank string if not applicable.

CHARACTER STRING

<func_3> The character string containing the PCL function representing the third component of the field data. Only applicable for non-tabular vector fields. Use a blank string if not applicable.

LOGICAL <lin_def> A flag specifying whether a data field with parametric independent variables is linear across the target geometry (TRUE) or not (FALSE).

INTEGER <num_var_1 The number of stored values for independent variable # 1. Only applicable for tabular fields. Use the value one if not applicable.

INTEGER <num_var_2> The number of stored values for independent variable # 2. Only applicable for tabular fields and <num_vars> > 1. Use the value one if not applicable.

INTEGER <num_var_3> The number of stored values for independent variable # 3. Only applicable for tabular fields and <num_vars> > 2. Use the value one if not applicable.

REAL ARRAY <var_1_values> A <num_var_1> array containing all the data points for the first variable. Only applicable for tabular fields. Use a single zero if not applicable.

REAL ARRAY <var_2_values> A <num_var_2> array containing all the data points for the second variable. Only applicable for tabular fields and <num_vars> > 1. Use a single zero if not applicable.

REAL ARRAY <var_3_values> A <num_var_3> array containing all the data points for the first variable. Only applicable for tabular fields and <num_vars> > 2. Use a single zero if not applicable.

657Chapter 8: Accessing the Patran DatabaseData Fields

Notes:

The C name differs. It is DbFCreateField.

int DbFCreateField ( field_id, field_name, field_var, field_dim, geom_type, geom_id, extrap_opt, data_type, coord_id, field_type, num_vars, var_type_1, var_type_2, var_type_3, func_1_size, func_2_size, func_3_size, func_1, func_2, func_3, lin_def, num_var_1, num_var_2, num_var_3, var_1_values, var_2_values, var_3_values, field_values )int *field_idchar *field_nameint field_varint field_dimint geom_typeint geom_idint extrap_opt;int data_typeint coord_idint field_typeint num_varsint var_type_1int var_type_2int var_type_3int func_1_sizeint func_2_sizeint func_3_sizechar *func_1char *func_2char *func_3int lin_defint num_var_1int num_var_2int num_var_3float var_1_values[ ]float var_2_values[ ]float var_3_values[ ]float field_values[ ]

REAL ARRAY <field_values> This array contains the field values for all data points. It is only applicable for tabular fields. Use a single zero if not applicable. For real-valued fields its length is <num_var_1>x<num_var_2>x<num_var_3>. For complex-valued fields, its length is twice that,with all of the first complex component terms preceding all second component terms. That is, all reals precede all imaginaries and all magnitudes precede all phases.

Output:

INTEGER field_id The internal ID assigned to the data field by Patran.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationData Fields

658

db_create_field_dfem ( <field_id>, <field_name>, <field_var>, <field_dim>, <entity_type>, <num_points>, <methods>, <entity_ids>, <face_ids>, <edge_ids>, <node_positions>, <ref_nodes>, <field_values> )

Input:

INTEGER <field_id> The unique internal ID to assign to this newly created data field. Use zero to allow the database to assign the next ID.

STRING <field_name> The name of the field to be created. Maximum length of this name is 31 characters.

INTEGER <field_var> Type of variance. Always zero ( spatially varying ) since entity fields are restricted to spatial variance.

INTEGER <field_dim> The dimensionality of data stored in this field. Zero for scalar values, one for vectors and two for tensors.

INTEGER <entity_type> The type of entity that these field values are associated with. 123 if the field values are associated with nodes and 124 if the field values are associated with elements.

INTEGER <num_points> The number of data points to be stored.

INTEGER ARRAY

<methods> A <num_points> vector of IDs specifying whether a vector is defined directly or by a reference node ID. Applies only to vectors. Use 1’s for vectors specified directly in the <field_values> array. Use 2’s for vectors specified by a reference node ID in the <ref_nodes> array.

INTEGER ARRAY

<entity_ids> A <num_points> vector of entity IDs specifying the nodes or elements to which the field values belong.

INTEGER ARRAY

<face_ids> A <num_points> vector of face IDs specifying the faces to which the field values belong. A vector of <num_points> zeroes if not applicable. See Patran’s Element Library (p. 402) in the Reference Manual - Part III for more on face IDs. If <node_positions> are to be specified, and the field is to be evaluated at element nodes, use zero for all <face_ids>. If <node_positions> are to be specified, and the field is to be evaluated at 3D element face nodes, use the appropriate face id. Use zeros for <face_ids> of 1D and 2D elements.

INTEGER ARRAY

659Chapter 8: Accessing the Patran DatabaseData Fields

Notes:

The C name differs. It is DbFCreateFieldDFem.

int DbFCreateFieldDFem ( field_id, field_name, field_var, field_dim, entity_type,num_points, methods, entity_ids, face_ids, edge_ids,node_positions, ref_nodes, field_values )int *field_idchar *field_nameint field_varint field_dimint entity_typeint num_pointsint*methodsint *entity_idsint *face_idsint *edge_idsint *node_positionsint*ref_nodesfloat *field_values

<edge_ids> A <num_points> vector of edge IDs specifying the edges to which the field values belong. A vector of <num_points> zeroes if not applicable. See Patran’s Element Library (p. 402) in the Reference Manual - Part III for more on edge IDs. <edge_ids> should not be specified for 3D elements.

INTEGER ARRAY

<node_positions> A <num_points> vector of node positions specifying the node positions on the element to which the field values belong. These are not the edge or face node positions. They are the node positions of the full element topology. See Patran’s Element Library (p. 402) in the Reference Manual - Part III for more about node positioning.

INTEGER ARRAY

<ref_nodes> A <num_points> vector of reference node IDs specifying FEM model nodes to be used to determine a vector. The vector will be computed to the node from a position on the element. See the <methods> input for more information. <ref_nodes> can only be used with element field data.

REAL ARRAY <field_values> A <num_points>x<n> array ( where n is 1 for scalar fields, 3 for vector fields and 6 for tensor fields ) containing the field values to be stored.

Output:

INTEGER <field_id> The internal ID assigned to this newly created data field.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationData Fields

660

db_create_field_dfem_v2 ( <field_id>, <field_name>, <field_var>, <field_dim>, <entity_type>, <num_points>, <methods>, <entity_ids>, <face_ids>, <edge_ids>, <node_positions>, <ref_nodes>, <dyn_var_id>, <extrap_opt>, <num_steps>, <steps>, <field_values> )

Input:

INTEGER <field_id> The unique internal ID to assign to this newly created data field. Use zero to allow the database to assign the next ID.

STRING <field_name> The name of the field to be created. Maximum length of this name is 31 characters.

INTEGER <field_var> Type of variance. Zero indicates spatial variance. 2 indicates a frequency or time variance.

INTEGER <field_dim> The dimensionality of data stored in this field. Zero for scalar values, one for vectors and two for tensors.

INTEGER <entity_type> The type of entity that these field values are associated with. 123 if the field values are associated with nodes and 124 if the field values are associated with elements.

INTEGER <num_points> The number of data points to be stored.

INTEGER ARRAY

<methods> A <num_points> vector of IDs specifying whether a vector is defined directly or by a reference node ID. Applies only to vectors. Use 1’s for vectors specified directly in the <field_values> array. Use 2’s for vectors specified by a reference node ID in the <ref_nodes> array.

INTEGER ARRAY

<entity_ids> A <num_points> vector of entity IDs specifying the nodes or elements to which the field values belong.

INTEGER ARRAY

<face_ids> A <num_points> vector of face IDs specifying the faces to which the field values belong. A vector of <num_points> zeroes if not applicable. See Patran’s Element Library (p. 402) in the Reference Manual - Part III for more on face IDs. If <node_positions> are to be specified, and the field is to be evaluated at element nodes, use zero for all <face_ids>. If <node_positions> are to be specified, and the field is to be evaluated at 3D element face nodes, use the appropriate face id. Use zeros for <face_ids> of 1D and 2D elements.

INTEGER ARRAY

661Chapter 8: Accessing the Patran DatabaseData Fields

Notes:

<edge_ids> A <num_points> vector of edge IDs specifying the edges to which the field values belong. A vector of <num_points> zeroes if not applicable. See Patran’s Element Library (p. 402) in the Reference Manual - Part III for more on edge IDs. <edge_ids> should not be specified for 3D elements.

INTEGER ARRAY

<node_positions> A <num_points> vector of node positions specifying the node positions on the element to which the field values belong. These are not the edge or face node positions. They are the node positions of the full element topology. See Patran’s Element Library (p. 402) in the Reference Manual - Part III for more about node positioning.

INTEGER ARRAY

<ref_nodes> A <num_points> vector of reference node IDs specifying FEM model nodes to be used to determine a vector. The vector will be computed to the node from a position on the element. See the <methods> input for more information. <ref_nodes> can only be used with element field data.

INTEGER <dyn_var_id> The dynamic variable ID. 0 indicates non-dynamic. 13 indicates time. 14 indicates frequency.

INTEGER <extrap_opt> The type of data extrapolation method used when the time or frequency to be evaluated is outside the range defined in the <steps> array (applicable only for dynamic):1 = use closest time/frequency value2 = use linear extrapolation3 = use zero for all points out of the time/frequency range.

INTEGER <num_steps> The number of dynamic steps. Use 1 for non-dynamic.

REAL ARRAY <steps> A <num_steps> containing the dynamic step values to be stored. Use 0 for non-dynamic.

REAL ARRAY <field_values> A <num_points*num_steps>x<n> array ( where n is 1 for scalar fields, 3 for vector fields and 6 for tensor fields ) containing the field values to be stored. If <num_steps> is greater than 1, supply <num_steps> sets of values grouped by entity.

Output:

INTEGER <field_id> The internal ID assigned to this newly created data field.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationData Fields

662

The C name differs. It is DbFCreateFieldDFemV2.

int DbFCreateFieldDFemV2 ( field_id, field_name, field_var, field_dim, entity_type,num_points, methods, entity_ids, face_ids, edge_ids,node_positions, ref_nodes, dyn_var_id, extrap_opt,num_steps, steps, field_values )int *field_idchar *field_nameint field_varint field_dimint entity_typeint num_pointsint*methodsint *entity_idsint *face_idsint *edge_idsint *node_positionsint*ref_nodesintdyn_var_idintextrap_optintnum_stepsfloat*stepsfloat *field_values

663Chapter 8: Accessing the Patran DatabaseData Fields

db_create_field_lbc ( <field_id>, <field_name>, <field_var>, <field_dim>, <entity_type>, <num_points>, <entity_ids>, <face_ids>, <edge_ids>, <node_positions>, <field_values> )

Input:

INTEGER <field_id> The unique internal ID to assign to this newly created data field. Use zero to allow the database to assign the next ID.

STRING <field_name> The name of the field to be created. Maximum length of this name is 31 characters.

INTEGER <field_var> Type of variance. Always zero ( spatially varying ) since entity fields are restricted to spatial variance.

INTEGER <field_dim> The dimensionality of data stored in this field. Zero for scalar values, one for vectors and two for tensors.

INTEGER <entity_type> The type of entity that these field values are associated with. 123 if the field values are associated with nodes and 124 if the field values are associated with elements.

INTEGER <num_points> The number of data points to be stored.

INTEGER ARRAY

<entity_ids> A <num_points> vector of entity IDs specifying the nodes or elements to which the field values belong.

INTEGER ARRAY

<face_ids> A <num_points> vector of face IDs specifying the faces to which the field values belong. A vector of <num_points> zeroes if not applicable. See Patran’s Element Library (p. 402) in the Reference Manual - Part III for more on face IDs. If <node_positions> are to be specified, and the field is to be evaluated at element nodes, use zero for all <face_ids>. If <node_positions> are to be specified, and the field is to be evaluated at 3D element face nodes, use the appropriate face id. Use zeros for <face_ids> of 1D and 2D elements.

INTEGER ARRAY

<edge_ids> A <num_points> vector of edge IDs specifying the edges to which the field values belong. A vector of <num_points> zeroes if not applicable. See Patran’s Element Library (p. 402) in the Reference Manual - Part III for more on edge IDs. <edge_ids> should not be specified for 3D elements.

INTEGER ARRAY

PCL and CustomizationData Fields

664

Notes:

The C name differs. It is DbFCreateFieldLbc.

int DbFCreateFieldLbc ( field_id, field_name, field_var, field_dim, entity_type, num_points, entity_ids, face_ids, edge_ids, node_positions, field_values )int *field_idchar *field_nameint field_varint field_dimint entity_typeint num_pointsint *entity_idsint *face_idsint *edge_idsint *node_positionsfloat *field_values

<node_positions> A <num_points> vector of node positions specifying the node positions on the element to which the field values belong. These are not the edge or face node positions. They are the node positions of the full element topology. See Patran’s Element Library (p. 402) in the Reference Manual - Part III for more about node positioning.

REAL ARRAY <field_values> A <num_points>x<n> array ( where n is 1 for scalar fields, 3 for vector fields and 6 for tensor fields ) containing the field values to be stored.

Output:

INTEGER <field_id> The internal ID assigned to this newly created data field.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

665Chapter 8: Accessing the Patran DatabaseData Fields

db_modify_field_dfem ( <field_id>, <field_name>, <field_var>, <field_dim>, <entity_type>, <num_points>, <methods>, <entity_ids>, <face_ids>, <edge_ids>, <node_positions>, <ref_nodes>, <field_values> )

Input:

INTEGER <field_id> The unique internal ID of the field to be modified.

STRING <field_name> The modified name of the field. Maximum length of this name is 31 characters.

INTEGER <field_var> Type of variance. Always zero ( spatially varying ) since entity fields are restricted to spatial variance.

INTEGER <field_dim> The dimensionality of data stored in this field. Zero for scalar values, one for vectors and two for tensors.

INTEGER <entity_type> The type of entity that these field values are associated with. 123 if the field values are associated with nodes and 124 if the field values are associated with elements.

INTEGER <num_points> The number of data points to be stored.

INTEGER ARRAY

<methods> A <num_points> vector of IDs specifying whether a vector is defined directly or by a reference node ID. Applies only to vectors. Use 1’s for vectors specified directly in the <field_values> array. Use 2’s for vectors specified by a reference node ID in the <ref_nodes> array.

INTEGER ARRAY

<entity_ids> A <num_points> vector of entity IDs specifying the nodes or elements to which the field values belong.

INTEGER ARRAY

<face_ids> A <num_points> vector of face IDs specifying the faces to which the field values belong. A vector of <num_points> zeroes if not applicable. See Patran’s Element Library (p. 402) in the Reference Manual - Part III for more on face IDs. If <node_positions> are to be specified, and the field is to be evaluated at element nodes, use zero for all <face_ids>. If <node_positions> are to be specified, and the field is to be evaluated at 3D element face nodes, use the appropriate face id. Use zeros for <face_ids> of 1D and 2D elements.

INTEGER ARRAY

PCL and CustomizationData Fields

666

Notes:

The C name differs. It is DbModifyFieldDFem.

int DbModifyFieldDFem ( field_id, field_name, field_var, field_dim, entity_type,num_points, methods, entity_ids, face_ids, edge_ids,node_positions, ref_nodes, field_values )int field_idchar *field_nameint field_varint field_dimint entity_typeint num_pointsint*methodsint *entity_idsint *face_idsint *edge_idsint *node_positionsint*ref_nodesfloat *field_values

<edge_ids> A <num_points> vector of edge IDs specifying the edges to which the field values belong. A vector of <num_points> zeroes if not applicable. See Patran’s Element Library (p. 402) in the Reference Manual - Part III for more on edge IDs. <edge_ids> should not be specified for 3D elements.

INTEGER ARRAY

<node_positions> A <num_points> vector of node positions specifying the node positions on the element to which the field values belong. These are not the edge or face node positions. They are the node positions of the full element topology. See Patran’s Element Library (p. 402) in the Reference Manual - Part III for more about node positioning.

INTEGER ARRAY

<ref_nodes> A <num_points> vector of reference node IDs specifying FEM model nodes to be used to determine a vector. The vector will be computed to the node from a position on the element. See the <methods> input for more information. <ref_nodes> can only be used with element field data.

REAL ARRAY <field_values> A <num_points>x<n> array ( where n is 1 for scalar fields, 3 for vector fields and 6 for tensor fields ) containing the field values to be stored.

Output:

INTEGER <field_id> The internal ID assigned to this newly created data field.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

667Chapter 8: Accessing the Patran DatabaseData Fields

db_modify_field_dfem_v2 ( <field_id>, <field_name>, <field_var>, <field_dim>, <entity_type>, <num_points>, <methods>, <entity_ids>, <face_ids>, <edge_ids>, <node_positions>, <ref_nodes>, <dyn_var_id>, <extrap_opt>, <num_steps>, <steps>, <field_values> )

Input:

INTEGER <field_id> The unique internal ID of the field to be modified.

STRING <field_name> The modified name of the field. Maximum length of this name is 31 characters.

INTEGER <field_var> Type of variance. Zero indicates spatial variance. 2 indicates a frequency or time variance.

INTEGER <field_dim> The dimensionality of data stored in this field. Zero for scalar values, one for vectors and two for tensors.

INTEGER <entity_type> The type of entity that these field values are associated with. 123 if the field values are associated with nodes and 124 if the field values are associated with elements.

INTEGER <num_points> The number of data points to be stored.

INTEGER ARRAY

<methods> A <num_points> vector of IDs specifying whether a vector is defined directly or by a reference node ID. Applies only to vectors. Use 1’s for vectors specified directly in the <field_values> array. Use 2’s for vectors specified by a reference node ID in the <ref_nodes> array.

INTEGER ARRAY

<entity_ids> A <num_points> vector of entity IDs specifying the nodes or elements to which the field values belong.

INTEGER ARRAY

<face_ids> A <num_points> vector of face IDs specifying the faces to which the field values belong. A vector of <num_points> zeroes if not applicable. See Patran’s Element Library (p. 402) in the Reference Manual - Part III for more on face IDs. If <node_positions> are to be specified, and the field is to be evaluated at element nodes, use zero for all <face_ids>. If <node_positions> are to be specified, and the field is to be evaluated at 3D element face nodes, use the appropriate face id. Use zeros for <face_ids> of 1D and 2D elements.

INTEGER ARRAY

PCL and CustomizationData Fields

668

Notes:

<edge_ids> A <num_points> vector of edge IDs specifying the edges to which the field values belong. A vector of <num_points> zeroes if not applicable. See Patran’s Element Library (p. 402) in the Reference Manual - Part III for more on edge IDs. <edge_ids> should not be specified for 3D elements.

INTEGER ARRAY

<node_positions> A <num_points> vector of node positions specifying the node positions on the element to which the field values belong. These are not the edge or face node positions. They are the node positions of the full element topology. See Patran’s Element Library (p. 402) in the Reference Manual - Part III for more about node positioning.

INTEGER ARRAY

<ref_nodes> A <num_points> vector of reference node IDs specifying FEM model nodes to be used to determine a vector. The vector will be computed to the node from a position on the element. See the <methods> input for more information. <ref_nodes> can only be used with element field data.

INTEGER <dyn_var_id> The dynamic variable ID. 0 indicates non-dynamic. 13 indicates time. 14 indicates frequency.

INTEGER <extrap_opt> The type of data extrapolation method used when the time or frequency to be evaluated is outside the range defined in the <steps> array (applicable only for dynamic):1 = use closest time/frequency value2 = use linear extrapolation3 = use zero for all points out of the time/frequency range.

INTEGER <num_steps> The number of dynamic steps. Use 1 for non-dynamic.

REAL ARRAY <steps> A <num_steps> containing the dynamic step values to be stored. Use 0 for non-dynamic.

REAL ARRAY <field_values> A <num_points*num_steps>x<n> array ( where n is 1 for scalar fields, 3 for vector fields and 6 for tensor fields ) containing the field values to be stored. If <num_steps> is greater than 1, supply <num_steps> sets of values grouped by entity.

Output:

INTEGER <field_id> The internal ID assigned to this newly created data field.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

669Chapter 8: Accessing the Patran DatabaseData Fields

The C name differs. It is DbModifyFieldDFemV2.

int DbModifyFieldDFemV2 ( field_id, field_name, field_var, field_dim, entity_type,num_points, methods, entity_ids, face_ids, edge_ids,node_positions, ref_nodes, dyn_var_id, extrap_opt,num_steps, steps, field_values )int field_idchar *field_nameint field_varint field_dimint entity_typeint num_pointsint*methodsint *entity_idsint *face_idsint *edge_idsint *node_positionsint*ref_nodesintdyn_var_idintextrap_optintnum_stepsfloat*stepsfloat *field_values

PCL and CustomizationData Fields

670

db_modify_field_lbc ( <field_id>, <field_name>, <field_var>, <field_dim>, <entity_type>, <num_points>, <entity_ids>, <face_ids>, <edge_ids>, <node_positions>, <field_values> )

Input:

INTEGER <field_id> The unique internal ID of the field to be modified.

STRING <field_name> The modified name of the field. Maximum length of this name is 31 characters.

INTEGER <field_var> Type of variance. Always zero ( spatially varying ) since entity fields are restricted to spatial variance.

INTEGER <field_dim> The dimensionality of data stored in this field. Zero for scalar values, one for vectors and two for tensors.

INTEGER <entity_type> The type of entity that these field values are associated with. 123 if the field values are associated with nodes and 124 if the field values are associated with elements.

INTEGER <num_points> The number of data points to be stored.

INTEGER ARRAY

<entity_ids> A <num_points> vector of entity IDs specifying the nodes or elements to which the field values belong.

INTEGER ARRAY

<face_ids> A <num_points> vector of face IDs specifying the faces to which the field values belong. A vector of <num_points> zeroes if not applicable. See Patran’s Element Library (p. 402) in the Reference Manual - Part III for more on face IDs. If <node_positions> are to be specified, and the field is to be evaluated at element nodes, use zero for all <face_ids>. If <node_positions> are to be specified, and the field is to be evaluated at 3D element face nodes, use the appropriate face id. Use zeros for <face_ids> of 1D and 2D elements.

INTEGER ARRAY

<edge_ids> A <num_points> vector of edge IDs specifying the edges to which the field values belong. A vector of <num_points> zeroes if not applicable. See Patran’s Element Library (p. 402) in the Reference Manual - Part III for more on edge IDs. <edge_ids> should not be specified for 3D elements.

INTEGER ARRAY

671Chapter 8: Accessing the Patran DatabaseData Fields

Notes:

The C name differs. It is DbModifyFieldLbc.

int DbModifyFieldLbc ( field_id, field_name, field_var, field_dim, entity_type,num_points, entity_ids, face_ids, edge_ids,node_positions, field_values )int field_idchar *field_nameint field_varint field_dimint entity_typeint num_pointsint *entity_idsint *face_idsint *edge_idsint *node_positionsfloat *field_values

<node_positions> A <num_points> vector of node positions specifying the node positions on the element to which the field values belong. These are not the edge or face node positions. They are the node positions of the full element topology. See Patran’s Element Library (p. 402) in the Reference Manual - Part III for more about node positioning.

REAL ARRAY <field_values> A <num_points>x<n> array ( where n is 1 for scalar fields, 3 for vector fields and 6 for tensor fields ) containing the field values to be stored.

Output:

INTEGER <field_id> The internal ID assigned to this newly created data field.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

db_modify_field_name ( old_name, new_name )

Description:

This function renames a field.

Input:

STRING[32] old_name Field name to be modified.

STRING[32] new_name New field name.

Output:

INTEGER <Return Value> 0=success, otherwise failure.

PCL and CustomizationMaterial Properties

672

Material PropertiesMaterial data is stored as a collection of generic material words associated with a material record. This construct is very similar to the manner in which element property data is stored and retrieved. Thus, material data can be extracted from the Patran database in a general manner independent of material construction. Regardless as to whether the material was created through the material selector, or through one of the composite options or through the more general data input material forms the resulting material properties are extracted from the database in the same manner.

Exportation of Material DataThe function “db_get_material” is used to determine the type of material.

673Chapter 8: Accessing the Patran DatabaseMaterial Properties

.

Notes:

The C name differs. It is DbFGetMaterial.

int DbFGetMaterial ( material_id, material_name, category_id, linearity_code, directionality_code, mat_description, material_type, data_exists ) int material_idchar *material_nameint *category_idint *linearity_codeint *directionality_code

db_get_material ( <material_id>, <material_name>, <category_id>, <linearity_code>, <directionality_code>, <mat_description>, <material_type>, <data_exists> )

Input:

INTEGER <material_id> The internal ID of the material record of interest.

Output:

CHARACTER STRING

<material_name> The external name used to reference this material record.

INTEGER <category_id> The ID of the material category of this material record. See db_create_matl_category, 517.

INTEGER <linearity_code> A code specifying the linearity of this material. See db_create_matl_lin, 472.

INTEGER <directionality_code>

A code specifying the directionality of this material. See db_create_matl_dir, 473.

CHARACTER STRING

<mat_description> A character string describing this material record.

INTEGER <material_type> A code specifying the type of material:0 = homogeneous material1 = standard laminate lay-up2 = rule of mixtures material3 = Halpin-Tsai material4 = short fiber composite101 = externally defined material

INTEGER <data_exists> A flag specifying whether any material property words are associated with this material record (1) or not (0). If no words are associated with this record, then this is probably an externally defined material.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationMaterial Properties

674

char *mat_descriptionint *material_typeint *data_exists

The next two functions are used to determine the constitutive models associated with the material record.

Notes:

The C name differs. It is DbGetMatlConstModelDefnCount.

int DbGetMatlConstModelDefnCount ( material_id, num_models ) int material_id int *num_models

Notes:

The C name differs. It is DbGetMatlConstModelDefn.

int DbGetMatlConstModelDefn ( material_id, model_ids ) int material_id int model_ids[ ]

Now that it is determined which constitutive models apply to this material record, use “db_get_active_flag” to determine whether each constitutive model is active or not and which material

db_get_matl_const_model_count ( <material_id>, <num_models> )

Input:

INTEGER <material_id> The internal ID of the material record.

Output:

INTEGER <num_models> The number of constitutive models associated with this material record.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

db_get_matl_const_model

( <material_id>, <model_ids> )

Input:

INTEGER <material_id> The internal ID of the material record.

Output:

INTEGER <model_ids> The <num_models> IDs of all the constitutive models associated with this material record.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

675Chapter 8: Accessing the Patran DatabaseMaterial Properties

options were chosen in each material option category. If a constitutive model is not active, the material data associated with that constitutive model should not be translated.

Notes:

The C name is DbGetActiveFlag.

int DbGetActiveFlag ( material_id, model_id, option_ids, active_flag ) int material_id int model_id int option_ids[ ] int *active_flag

After examining the active material constitutive models and the material options chosen for each of these models, the material words assigned to the record can be retrieved. First determine the number of words associated with the record. This can be done with the following function.

db_get_active_flag ( <material_id>, <modelled>, <option_ids>, <active_flag> )

Input:

INTEGER <material_id> The internal ID of the material record.

INTEGER <model_id> The ID of the material constitutive model of interest.

Output:

INTEGER ARRAY

<option_ids> A five element array containing the actual material options chosen in each material option category. This array is zero filled and in the order the data was originally input. For example, if the data input consisted of two material option categories (yield function and hardening rule), one possible array would be [11, 15, 0, 0, 0].

INTEGER <active_flag> A user specified flag determining whether the material constitutive model specified by <model_id> is active for the material record specified by <material_id> (<active_flag> = 1) or not (<active_flag> = 0). Again, data associated with an inactive constitutive model should not be translated.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationMaterial Properties

676

Notes:

The C name differs. It is DbGetMaterialPropValueCount.

int DbGetMaterialPropValueCount ( material_id, num_words ) int material_id int *num_words

The function “db_get_matl_prop_value” is used to retrieve the actual material property word values.

db_get_matl_prop_value_count ( <material_id>, <num_words> )

Input:

INTEGER <material_id> The internal ID of the material record.

Output:

INTEGER <num_words> The number of material property words associated with this material record. If zero, this material record is probably externally defined.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

677Chapter 8: Accessing the Patran DatabaseMaterial Properties

Notes:

The number of offsets that must be allocated for the output values field_ids and word_values can be obtained with a call to db_get_matl_prop_value_count, 676.

The C name differs. It is DbGetMaterialPropValue.

int DbGetMaterialPropValue ( material_id, word_ids, field_ids, word_values ) int material_id int word_ids[ ] int field_ids[ ] float word_values[ ]

For more on the evaluation and exportation of data fields, refer to Data Fields, 643.

db_get_matl_prop_value ( material_id, word_ids, field_ids, word_values )

Input:

INTEGER material_id The internal ID of the material record.

Output:

INTEGER word_ids(5) This value returns the material options chosen in each material option category. This value is filled in the order in which the data was originally input. For example, if the data input consisted of two material option categories, such as yield function and hardening rule, one possible set of values would be [11, 15, 0, 0, 0].

INTEGER field_ids( ) This value returns the IDs of the data field references for all the material words. If this value is non-zero for a given material word, then the material word references a data field. The value of the word can be obtained by data field evaluation or exportation and the value contained in the output value, word_values, should be ignored. If field_ids is zero for a given material word, the word is constant (has no data field reference) and its value is in the output value, word_values.

REAL word_values( ) This value returns the value of material property words that have no data field references.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationMaterial Properties

678

Remarks:

The input value mat_prop_id can have the following values:

db_get_matl_prop_value2 (mat_id, mat_prop_id, eval_at_temperature, eval_at_strain, eval_at_strain_rate, eval_at_time, eval_at_frequency, mat_prop_found, mat_prop_val)

Description:

This function evaluates the material property value for the given material id.

Input:

INTEGER mat_id This value specifies the material id.

INTEGER mat_prop_id This value specifies the material property word id. See the remarks below for a list of values that can be used with this argument.

REAL eval_at_temperature This value specifies the temperature value used for field evaluation.

REAL eval_at_strain This value specifies the strain (OR: total strain, plastic strain, stress) value used for field evaluation.

REAL eval_at_strain_rate This value specifies the strain rate value used for field evaluation.

REAL eval_at_time This value specifies the time value used for field evaluation.

REAL eval_at_frequency This value specifies the frequency value used for field evaluation.

Output:

INTEGER mat_prop_found This value returns TRUE or 1 if the material property was found for the specified material id. FALSE or 0 is returned if the material property is not found.

REAL mat_prop_val This value returns the material property word value. Dependent fields are evaluated if necessary.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate an error.

Error Conditions:

-1 This is an internal error status condition. There is no corresponding status message in the message database.

679Chapter 8: Accessing the Patran DatabaseMaterial Properties

:

Value Description Value Description

1 Reference Temperature 144 Coefficient D

2 Elastic Modulus 145 Coefficient E

3 Elastic Modulus 22 146 Coefficient F

4 Elastic Modulus 33 147 Coefficient G

5 Poisson Ratio 148 Interaction Term 23

6 Poisson Ratio 23 149 Interaction Term 31

7 Poisson Ratio 31 150 Not used

8 Shear Modulus . .

9 Shear Modulus 23 . .

10 Shear Modulus 31 . .

11 Not used 502 Not used

12 Not used 503 Stress/Strain Curve

13 Poisson Ratio 13 504 Not used

14 Bulk Modulus . .

15 Lame Constant . .

16 Density . .

17 Conductivity 1000 Not used

18 Conductivity 12 1001 Mass Propornl Damping

19 Conductivity 13 1002 Stiffness Propornl Damping

20 Conductivity 22 1003 Fraction Critical Damping

21 Conductivity 23 1004 Not used

22 Conductivity 33 . .

23 Specific Heat . .

24 Thermal Expansion Coeff . .

25 Thermal Expansion Coeff 22 1010 Not used

26 Thermal Expansion Coeff 33 1011 2nd. Yield Stress

27 Thermal Expansion Coeff 12 1012 Plastic Strain

28 Thermal Expansion Coeff 23 1013 Rate Dependent Param D

29 Thermal Expansion Coeff 31 1014 Rate Dependent Param p

30 Structural Damping Coeff 1016 Dilation Angle

31 Emissivity 1017 Ratio of Flow Stresses

32 Not used 1018 Absolute Plastic Strain

PCL and CustomizationMaterial Properties

680

. . 1019 Exponent

. . 1020 Yield Offset

. . 1021 Not used

36 Not used 1022 Not used

37 Composite Options Flag 1023 Material Cohesion

38 Positive Definite Flag 1024 Eccentricity Parameter

39 Total Laminate Thickness 1025 Yield Surface Transition

40 Number of Plies 1026 Surface Radius Parameter

41 Laminate Offset 1027 Hydrostatic Yield Stress

42 Moisture Expansion Coeff 11 1028 Volumetric Plastic Strain

43 Moisture Expansion Coeff 22 1029 Not used

44 Moisture Expansion Coeff 33 . .

45 Moisture Expansion Coeff 12 . .

46 Moisture Expansion Coeff 23 . .

47 Moisture Expansion Coeff 31 1100 Not used

48 Force Resultant (N1) per Temp 1101 Real Part of g1

49 Force Resultant (N2) per Temp 1102 Imaginary Part of g1

50 Force Resultant (N12) per Temp 1103 Value of a

51 Moment Resultant (M1) per Temp 1104 Real Part of k1

52 Moment Resultant (M2) per Temp 1105 Imaginary Part of k1

53 Moment Resultant (M12) per Temp 1106 Value of b

54 Stiffness 11 1107 Not used

55 Stiffness 12 . .

56 Stiffness 13 . .

57 Stiffness 22 . .

58 Stiffness 23 1200 Not used

59 Stiffness 33 1201 Value of A

60 Stiffness 44 1202 Value of B

61 Stiffness 45 1203 Value of n

62 Stiffness 46 1204 Value of m

63 Stiffness 55 1205 Value of delta_H

64 Stiffness 56 1206 Value of R

65 Stiffness 66 1207 Not used

66 Stiffness 14 . .

681Chapter 8: Accessing the Patran DatabaseMaterial Properties

67 Stiffness 15 . .

. Stiffness 16 .

68 Not used 1300 Not used

69 Stiffness 24 1301 Coefficient C10

70 Stiffness 25 1302 Coefficient C20

71 Stiffness 26 1303 Coefficient C30

72 Stiffness 34 1304 Coefficient C40

73 Stiffness 35 1305 Coefficient C50

74 Stiffness 36 1306 Coefficient C60

75 Stiffness 11 1307 Not used

76 Stiffness 12 1308 Not used

77 Stiffness 13 1309 Not used

78 Stiffness 22 1310 Not used

79 Stiffness 23 1311 Coefficient C01

80 Stiffness 33 1312 Coefficient C02

81 Membrane Stiffness 11 1313 Coefficient C03

82 Membrane Stiffness 12 1314 Coefficient C04

83 Membrane Stiffness 13 1315 Coefficient C05

84 Membrane Stiffness 22 1316 Coefficient C06

85 Membrane Stiffness 23 1317 Not used

86 Membrane Stiffness 33 1318 Not used

87 Bending Stiffness 11 1319 Not used

88 Bending Stiffness 12 1320 Not used

89 Bending Stiffness 13 1321 Coefficient C11

90 Bending Stiffness 22 1322 Coefficient C21

91 Bending Stiffness 23 1323 Coefficient C12

92 Bending Stiffness 33 1324 Coefficient C31

93 Coupling Stiffness 11 1325 Coefficient C22

94 Coupling Stiffness 12 1326 Coefficient C13

95 Coupling Stiffness 13 1327 Coefficient C41

96 Coupling Stiffness 22 1328 Coefficient C32

97 Coupling Stiffness 23 1329 Coefficient C23

98 Coupling Stiffness 33 1330 Coefficient C14

99 Tension Stress Limit 1331 Coefficient C51

PCL and CustomizationMaterial Properties

682

100 Compression Stress Limit 1332 Coefficient C42

101 Shear Stress Limit 1333 Coefficient C33

102 Tension Stress Limit 22 1334 Coefficient C24

103 Compression Stress Limit 22 1335 Coefficient C15

104 Shear Stress Limit 23 1336 Not used

105 Tension Stress Limit 33 . .

106 Compression Stress Limit 33 . .

107 Shear Stress Limit 31 . .

108 Tension Strain Limit 1400 Not used

109 Compression Strain Limit 1401 Coefficient MU1

110 Shear Strain Limit 1402 Coefficient MU2

111 Tension Strain Limit 22 1403 Coefficient MU3

112 Compression Strain Limit 22 1404 Coefficient MU4

113 Shear Strain Limit 23 1405 Coefficient MU5

114 Tension Strain Limit 33 1406 Coefficient MU6

115 Compression Strain Limit 33 1407 Not used

116 Shear Strain Limit 31 1408 Not used

117 Ht Ratio 1409 Not used

118 Not used 1410 Not used

119 Not used 1411 Coefficient ALPHA_1

120 Hardening Slope 1412 Coefficient ALPHA_2

121 Yield Point 1413 Coefficient ALPHA_3

122 Equivalent Yield Stress (J1=0) 1414 Coefficient ALPHA_4

123 Alpha 1415 Coefficient ALPHA_5

124 Beta 1416 Coefficient ALPHA_6

125 Stress 11 Yield Ratio 1417 Not used

126 Stress 22 Yield Ratio 1418 Not used

127 Stress 33 Yield Ratio 1419 Not used

128 Stress 12 Yield Ratio 1420 Not used

129 Stress 23 Yield Ratio 1421 Coefficient D1

130 Stress 31 Yield Ratio 1422 Coefficient D2

131 Internal Friction Angle 1423 Coefficient D3

132 Bonding Shear Stress Limit 1424 Coefficient D4

133 Interaction Term 1425 +Coefficient D5

683Chapter 8: Accessing the Patran DatabaseMaterial Properties

Example:

INTEGER status, mat_id, mat_prop_id, mat_prop_foundREAL eval_at_temperature, eval_at_strain, eval_at_strain_rate, @ eval_at_time, eval_at_frequency, mat_prop_val

mat_id = 1mat_prop_id = 2 /* Elastic Modulus */eval_at_temperature = 0.0eval_at_strain = 0.0eval_at_strain_rate = 0.0eval_at_time = 0.0eval_at_frequency = 0.0status = db_get_matl_prop_value2(mat_id, mat_prop_id, @ eval_at_temperature, eval_at_strain, @ eval_at_strain_rate, eval_at_time, eval_at_frequency, @ mat_prop_found, mat_prop_val)IF (0 < status) THEN msg_to_form(status, 4, 0, 0, 0.0, ““)ELSE IF (0 > status) THEN /* Error information already displayed */ ELSE write_line(“mat_prop_found =”, mat_prop_found) write_line(“mat_prop_val =”, mat_prop_val) END IFEND IF

Importation of Material DataTo import material data into a database create a material record, associate material words to that material record and then define the active and inactive constitutive models and which material options are valid for each. To create a material record the function described below is used.

134 Failure Index 1426 Coefficient D6

135 Creep Reference Temperature 1427 Not used

136 Creep Threshold Factor . .

137 Temperature Dependence Exponent . .

138 Primary Creep Stiffness . .

139 Primary Creep Damping 2001 Not used

140 Secondary Creep Damping 2002 SigmaYY/Strain Curve

141 Coefficient A 2003 SigmaZZ/Strain Curve

142 Coefficient B 2004 SigmaXY/Strain Curve

143 Coefficient C 2005 SigmaYZ/Strain Curve

2006 SigmaZX/Strain Curve

PCL and CustomizationMaterial Properties

684

.

Notes:

The C name differs. It is DbFCreateMaterial.

int DbFCreateMaterial ( material_name, mat_description, category_id, linearity_code, directionality_code, material_type, material_id)char *material_namechar *mat_descriptionint category_idint linearity_codeint directionality_codeint material_typeint *material_id

The function “db_create_matl_prop_value” will associate material words with the newly created material record.

db_create_material ( <material_name>, <mat_description>, <category_id>, <linearity_code>, <directionality_code>, <material_type>, <material_id> )

Input:

CHARACTER STRING

<material_name> The external name of the material record.

CHARACTER STRING

<mat_description> A character string describing the material record.

INTEGER <category_id> The ID of the material category of this record. See db_create_matl_category, 517.

INTEGER <linearity_code> A code representing the linearity of this material. See db_create_matl_lin, 472.

INTEGER <directionality_code>

A code representing the directionality of this material. See db_create_matl_dir, 473.

INTEGER <material_type> A code specifying the type of material:0 = homogeneous material1 = standard laminate lay-up2 = rule of mixtures material3 = Halpin-Tsai material4 = short fiber composite101 = externally defined material

Output:

INTEGER <material_id> The internal ID assigned to this new material record by Patran.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

685Chapter 8: Accessing the Patran DatabaseMaterial Properties

Notes:

The C name differs. It is DbFCreateMaterialPropValue.

int DbCreateMaterialPropValue ( material_id, word_ids, field_ids, word_values, num_words ) int material_id int word_ids[ ] int field_ids[ ] float word_values[ ] int num_words

Lastly, specify which constitutive models are related to this material and which material options are appropriate for each constitutive model.

To create the constitutive models, the following function is used.

db_create_matl_prop_value ( <material_id>, <word_ids>, <field_ids>, <word_values>, <num_words> )

Input:

INTEGER <material_id> The internal ID of the material record to which the material words are to be associated.

INTEGER ARRAY

<word_ids> The <num_words> IDs of all the material words to be associated with this record.

INTEGER ARRAY

<field_ids>

REAL ARRAY <word_values> The <num_words> constant values for all the material words. If the word references a data field, this value in <word_values> is not applicable. Zero should be used in this case.

INTEGER <num_words> The number of words to be associated with this material record.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationMaterial Properties

686

Notes:

The C name differs. It is DbMatlConstModelDefn.

int DbCreateMatlConstModelDefn ( material_id, model_ids, num_models ) int material_id int model_ids[ ] int num_models

db_create_matl_const_model ( <material_id>, <model_ids>, <num_models>)

Input:

INTEGER <material_id> The internal ID of the material record.

INTEGER ARRAY

<model_ids> An array of the IDs of all the material constitutive models to be assigned to this material. See Material Models, 520 for more about material model IDs.

INTEGER <num_models> The number of constitutive model IDs.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

687Chapter 8: Accessing the Patran DatabaseMaterial Properties

Notes:

The C name differs. It is DbCreateConstitutiveModelsSpecified.

int DbCreateConstitutiveModelsSpecified ( material_id, model_id, option_ids, active_flag ) int material_id int model_id int option_ids[ ] int active_flag

Exportation of Composite Material Creation DataNot only can the basic material data be accessed, but the input data used to create a composite material can be retrieved. This provides two ways to translate composite materials: translate the resulting material data just as is done with any other material record or translate the composite creation data. One example of this exists in the Patran - MSC Nastran forward translator. If referenced by a standard plate element, the composite material will be translated as a standard MSC Nastran material such as a MAT2. But, if the composite material is referenced by a composite plate element, the composite creation data will be used to create a MSC Nastran PCOMP record and most of the basic material properties will be ignored.

In order to extract the creation data for a standard laminate material, the function db_get_comp_lam_ids_by_id is used.

db_cr_const_models_specified ( <material_id>, <model_id>, <option_ids>, <active_flag> )

Input:

INTEGER <material_id> The internal ID of the material record.

INTEGER <model_id> The ID of the material constitutive model of interest. SeeMaterial Models, 520 for more about material model IDs.

INTEGER ARRAY

<option_ids> A five element array containing the up-to-five material options chosen for this constitutive model. This array is zero filled and in the order the data would be presented. For example, a possible array for a constitutive model with two material option categories (yield function and hardening rule) would be [11, 15, 0, 0, 0]. See Material Models (p. 520) for more about material option IDs.

INTEGER <active_flag> A flag specifying whether this constitutive model is active for this material (1) or not (0).

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationMaterial Properties

688

db_get_comp_lam_ids_by_id (material_id, num_plies, material_name, output_count, ply_ids, thicknesses, orientations, symmetry, offset_value, offset_flag)

Input:

INTEGER material_id The internal ID of the material record.

INTEGER num_plies The number of plies in this laminate material. This value is stored as a basic material property word (with an ID of 40) which can be retrieved from the function db_get_matl_prop_value ( ). The number of plies for the laminate material is the nearest whole integer to the real value of the basic material property word with an id of 40.

Output:

STRING material_name The external name used to reference this material record.

INTEGER output_count The number of plies associated to this material record.

INTEGER ply_ids (num_plies) This value returns the IDs of the material records making up the plies of the laminate.

REAL thicknesses (num_plies)

This value returns the ply thickness values for the laminate material.

REAL orientations (num_plies)

This value returns the orientation angles in degrees measured from the element’s principal material orientation for the laminate material.

INTEGER symmetry This value returns the describing characteristics about the lay-up:1 = no order in stack2 = symmetric stack3 = stack symmetric about midply4 = anti-symmetric stack5 = stack anti-symmetric about midplyThe total stack will always be stored. The decision to write out the entire stack or only the input portion of the stack depends on the functionality of the analysis code.

REAL offset_value This value returns the laminate offset. This is the distance from the reference plane of the element to the bottom of the stack. If the value is negative, one half of the total thickness of the stack lies at the middle of the element.

689Chapter 8: Accessing the Patran DatabaseMaterial Properties

Notes:

The C name is DbGetCompLamIdsById.

int DbGetCompLamIdsById ( material_id, num_plies, material_name, output_count, ply_ids, thicknesses, orientations, symmetry, offset_value, offset_flag ) int material_id int num_plies char material_name[ ] int *output_count int ply_ids[ ] float thicknesses[ ] float orientations[ ] int *symmetry float *offset_value int *offset_flag

Importation of Composite Material Creation Data

In general, when importing a composite material into a Patran database, a new material record is created, assigning generic material properties to the material record, specifying the constitutive models of the record, and assigning the composite creation data to the new material record. If the generic material properties of the material record are not important, skip the second step mentioned above, but Patran will not create generic material properties for a material just given the composite creation data. It is up to the user to calculate and store these values, if they are needed. Similarly, if only the generic properties of the material are of interest and not in the composite creation data, skip the fourth step mentioned above. The functions needed for the first three steps are described in Exportation of Material Data, 672. The functions needed to accomplish the fourth step, assigning composite creation data to a material record are described below.

The function used to store the creation data for a standard laminate composite is “db_set_comp_lam_by_id”. Note that regardless of the nature of the stack (no order, symmetric, anti-symmetric), the entire lay up must be specified in the database.

LOGICAL offset_flag This value specifies when set to FALSE or 0 that the laminate offset value was entered manually. This value will be set to TRUE or 1 when the laminate offset value was calculated by Patran.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationMaterial Properties

690

db_set_comp_lam_by_id ( <material_id>, <num_plies>, <ply_ids>, <thicknesses>, <orientations>, <symmetry>, <offset_value>, <offset_flag> )

Input:

INTEGER <material_id> The internal ID of the material to which composite data is to be added.

INTEGER <num_plies> The total number of plies in the stack. This value should also be stored as generic property word 40. See db_get_comp_lam_ids_by_id, 688 and db_create_matl_prop_value, 685 for further understanding.

INTEGER ARRAY

<ply_ids> A vector of <num_plies> material IDs specifying the material make-up of each ply.

REAL ARRAY <thicknesses> The <num_plies> ply thickness values for the laminate material.

REAL ARRAY <orientations> The <num_plies> orientation angles (in degrees measured from the element’s principle material orientation) for the laminate material.

INTEGER <symmetry> A flag describing characteristics about the lay-up:1 = no order in stack2 = symmetric stack3 = stack symmetric about midply4 = anti-symmetric stack5 = stack anti-symmetric about midplyThe total stack must be stored in the database even if the symmetry flag is greater than one.

REAL <offset_value> The real value of the laminate offset. This is the distance from the reference plane of the element to the bottom of the stack. The default value is negative one half the total thickness of the stack which is to say the middle of the stack lies at the reference plane of the element. A valid value should always be input here even if it is the default value.

LOGICAL <offset_flag> A flag specifying whether the laminate offset value is the default (<offset_flag> = TRUE) which is to say the middle of the stack coincides with the reference plane of the element or a non-default value of the laminate offset is being used (<offset_flag> = FALSE).

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

691Chapter 8: Accessing the Patran DatabaseMaterial Properties

Notes:

The C prototype for this function is:

int DbSetCompLamById ( int mat_id, int num_plies, int * ply_ids, float * thicknesses, float * orientations, int symmetry, double offset_value, int offset_def );

db_modify_material_name ( old_name, new_name )

Description:

This function renames a material.

Input:

STRING[32] old_name Material name to be modified.

STRING[32] new_name New material name.

Output:

INTEGER <Return Value> 0=success, otherwise failure.

PCL and CustomizationLoad Cases

692

Load CasesThe analysis application may allow the user to select the load cases of interest from an Analysis form, employ only the current load case, or use all load cases in the database. If the user is allowed to select the load cases of interest, the names of the selected load cases can be passed to the end application as an argument, through a temporary text file of by storing the load case names as job parameters.

Exportation of Load Case DefinitionsIn order to get the name of the currently active load case, use the following function..

Notes:

The C name differs. It is DbFGetActiveLoadCase.

int DbFGetActiveLoadCase ( load_case_name ) char *load_case_name

In order to get the names of all the load cases stored in the database, use the following “get all - get next” set of functions. First call the “get all” function and then call the “get next” function until it returns to non-zero status, meaning that no more load cases exist. The non-zero status call does not return a valid load case. In other words, if a non-zero status is returned on the fifth “get next” call, then four load cases existed in the database.

Notes:

The C name differs. It is DbFGetAllLoadCaseNames.

db_get_active_load_case ( <load_case_name> )

Output:

CHARACTER STRING

<load_case_name> The name of the currently active load case.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

db_get_all_load_case_names ( )

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

693Chapter 8: Accessing the Patran DatabaseLoad Cases

Notes:

The C name differs. It is DbFGetNextLoadCaseName.

int DbFGetNextLoadCaseName ( load_case_name )char*load_case_name

Notes:

The C name differs. It is DbFCountLBCByLoadCase.

int DbFCountLBCByLoadCase ( load_case_name, num_loads ) char *load_case_name int *num_loads

To get the IDs for all the loads associated with a load case and other load case information, the following function is used.

db_get_next_load_case_name ( <load_case_name> )

Output:

STRING <load_case_name> The name of a load case stored in the database. The maximum length of a load case name is 80 characters.

INTEGER <Return Value> If zero, the function is returning a valid load case name. If non-zero, there are no more load case names to return. This function should be called until a non_zero status is returned.

db_count_lbc_by_load_case ( <load_case_name>, <num_loads> )

Input:

CHARACTER STRING

<load_case_name> The name of the load case of interest.

Output:

INTEGER <num_loads> The number of loads associated with this load case.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationLoad Cases

694

db_get_load_case ( <load_case_name>, <load_case_id>, <load_case_type>, <load_case_description>, <num_loads>, <load_ids>, <dynamic_case_name>, <evaluation_point>, <load_priorities> )

Input:

CHARACTER STRING

<load_case_name> The name of the load case of interest.

Output:

INTEGER <load_case_id> The internal ID of the specified load case.

INTEGER <load_case_type> A flag specifying the type of load case:

1 = static load case

2 = time dependent load case

3 = frequency dependent load case

CHARACTER STRING

<load_case_description> A character string containing a description of the specified load case.

INTEGER <num_loads> The number of loads associated with this load case.

INTEGER ARRAY

<load_ids> The <num_loads> IDS of all the loads associated with this load case.

CHARACTER STRING

<dynamic_case_name> The name o fthe dynamic load case from which this static load case was derived. A blank string if not applicable.

REAL <evaluation_point> The time or frequency value at which the dynamic load case was evaluated in order to create this static load case. Zero if not applicable.

695Chapter 8: Accessing the Patran DatabaseLoad Cases

Notes:

The C name differs. It is DbFGetLoadCase.

int DbFGetLoadCase ( load_case_name, load_case_id, load_case_type, load_case_description, num_loads, load_ids, dynamic_case_name, evaluation_point, load_priorities ) char *load_case_name int *load_case_id int *load_case_type char *load_case_description int *num_loads int load_ids[ ] char *dynamic_case_name float *evaluation_point intload_priorities[]

INTEGER ARRAY

<load_priorities> <num_loads> flags associated with all the loads in this load case specifying the priority of the load over other loads:

0 = no priority. The corresponding load will be overwritten by any load with priority whenever there is a conflict (multiple loads on the same node, for example). If all loads have “no priority” then the values from all the loads are simply combined.

1 = highest priority. This load will overwrite all other loads whenever a conflict occurs. Only one load should have priority 1 in a given load case.

2 = second highest priority. When a conflict occurs, this load will overwrite all other loads except for the load with priority 1. Only one load should have priority 2 in a given load case..

etc.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

INTEGER <load_case_type> A flag specifying the type of load case:

1 = static load case

2 = time dependent load case

3 = frequency dependent load case

PCL and CustomizationLoad Cases

696

db_get_load_case2 ( <load_case_name>, <load_case_id>, <load_case_scale_factor>, <load_case_type>, <load_case_description>, <num_loads>, <load_ids>, <load_scale_factors>, <load_priorities>, <dynamic_case_name>, <evaluation_point> )

Input:

CHARACTER STRING

<load_case_name> The name of the load case of interest.

Output:

INTEGER <load_case_id> The internal ID of the specified load case.

REAL <load_case_scale_factor>

The factor by which all loads in this load case will be scaled.

INTEGER <load_case_type> A flag specifying the type of load case:

1 = static load case

2 = time dependent load case

3 = frequency dependent load case

CHARACTER STRING

<load_case_description>

A character string containing a description of the specified load case.

INTEGER <num_loads> The number of loads associated with this load case.

INTEGER ARRAY

<load_ids> The <num_loads> IDS of all the loads associated with this load case.

REAL ARRAY

<load_scale_factors> An array of <num_loads> scale factors corresponding to the <load_ids> by which each load is to be scaled.

697Chapter 8: Accessing the Patran DatabaseLoad Cases

Importation of Load Case Definitions

The function “db_create_load_case” should be used to add load case definitions to a Patran database.

INTEGER ARRAY

<load_priorities> <num_loads> flags associated with all the loads in this load case specifying the priority of the load over other loads:

0 = no priority. The corresponding load will be overwritten by any load with priority whenever there is a conflict (multiple loads on the same node, for example). If all loads have “no priority” then the values from all the loads are simply combined.

1 = highest priority. This load will overwrite all other loads whenever a conflict occurs. Only one load should have priority 1 in a given load case.

2 = second highest priority. When a conflict occurs, this load will overwrite all other loads except for the load with priority 1. Only one load should have priority 2 in a given load case.etc.

CHARACTER STRING

<dynamic_case_name>

The name o fthe dynamic load case from which this static load case was derived. A blank string if not applicable.

REAL <evaluation_point> The time or frequency value at which the dynamic load case was evaluated in order to create this static load case. Zero if not applicable.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationLoad Cases

698

db_create_load_case ( <load_case_name>, <load_case_type>, <load_case_description>, <num_loads>, <load_ids>, <dynamic_case_name>, <evaluation_point>, <load_priorities>, <load_case_id> )

Input:

CHARACTER STRING

<load_case_name> The external name of this load case.

INTEGER <load_case_type> A flag specifying the type of load case:1 = static load case2 = time dependent load case3 = frequency dependent load case

CHARACTER STRING

<load_case_description>

A character string containing a description of this load case.

INTEGER <num_loads> The number of loads associated with this load case.

INTEGER ARRAY

<load_ids> The <num_loads> IDs of all the loads associated with this load case.

CHARACTER STRING

<dynamic_case_name>

The name of the dynamic load case from which this static load case was derived. A blank string if not applicable.

REAL <evaluation_point> The time or frequency value at which the dynamic load case was evaluated in order to create this static load case. Zero if not applicable.

INTEGER ARRAY

699Chapter 8: Accessing the Patran DatabaseLoad Cases

Notes:

The C prototype for this function is:

int DbFCreateLoadCase ( char * load_case_name, int load_case_type, char * load_case_description, int number_loads, int * load_ids, char * dynamic_case_name, double evaluation_point, int * load_priorities, int * load_case_id );

<load_priorities> <num_loads> flags associated with all the loads in this load case specifying the priority of the load over other loads:

0 = no priority. The corresponding load will be overwritten by any load with priority whenever there is a conflict (multiple loads on the same node, for example). If all loads have “no priority” then the values from all the loads are simply combined.

1 = highest priority. This load will overwrite all other loads whenever a conflict occurs. Only one load should have priority 1 in a given load case.

2 = second highest priority. When a conflict occurs, this load will overwrite all other loads except for the load with priority 1. Only one load should have priority 2 in a given load case.

3 = third highest priority, etc.

Output:

INTEGER <load_case_id> The internal ID assigned to this load case by Patran.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationLoads

700

Loads

Evaluation of Loads on Finite Element EntitiesBefore exporting load and boundary condition information, Patran should be instructed to re-evaluate all loads. Loads should always be evaluated from within Patran (i.e., from PCL) because loads applied to native Unigraphics geometry cannot be accurately evaluated from external programs. The loads should be re-evaluated for every analysis in case mesh or load definitions changed since the last load evaluation. The function to evaluate all loads within a database is described below..

Notes:

Since this function should only be called from within Patran, it is only PCL callable.

Exportation of Load DataNow that the load cases to translate have been determined and have retrieved all the internal IDs of the loads associated with these load cases, export the load data itself. First, determine the type of load. The <load_type> argument coming from “db_get_lbc” or “db_get_lbc_new” should be sufficient for determining the type of load and how the load should be translated, but if more details about the load type definition is desired, can call “db_get_lbc_type_defn_by_id” or “db_get_lbc_defn”. These functions are described below.

“db_get_lbc” has been superseded by “db_get_lbc_new”. “db_get_lbc_new” must be used if any of its additional arguments are required to define your LBC.

loadsbcs_eval_all ( )

Output:

INTEGER <Return Value> If zero, the function is returning a valid load case name. If non-zero, there are no more load case names to return. This function should be called until a non_zero status is returned.

701Chapter 8: Accessing the Patran DatabaseLoads

.

Notes:

The C name differs. It is DbFGetLbc.

int DbFGetLbc ( load_id, load_name, load_type, application_type, elem_dimension, coord_id,

dynamic_flag )int load_idchar *load_nameint *load_typeint *application_typeint *elem_dimensionint *coord_id

db_get_lbc ( <load_id>, <load_name>, <load_type>, <application_type>, <elem_dimension>, <coord_id>, <dynamic_flag> )

Input:

INTEGER <load_id> The internal ID of the load of interest.

Output:

CHARACTER STRING

<load_name> The external name used to reference this load.

INTEGER <load_type> The internal ID of this load type. See db_create_lbc_type_defn, 543 for the meaning of this ID.

INTEGER <application_type> A code specifying what type of entities this load is applied to and how the load is applied:

1 = load applied to nodes

2 = load applied to elements and constant over the element.

3 = load applied to elements and varying over the element.

INTEGER <elem_dimension> The dimensionality of the loaded elements:

1 = line element2 = surface elements3 = solid elements

INTEGER <coord_id> The ID of the coordinate frame along which the loads are acting. Zero means acting in the global system or not appropriate for this load.

INTEGER <dynamic_flag> A flag specifying whether this load is constant with respect to time or frequency (0) or varies with respect to time or frequency (1).

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationLoads

702

int *dynamic_flag

Remarks:

Memory is allocated for the output variable within this function. If memory was allocated prior to the call, it is released prior to re-allocation. Therefore, if this function is used within a loop, there is no need to release the memory of the output variable.

Example:

INTEGER status, lbc_type_count, lbc_count, lbc_id(VIRTUAL), i_lbcSTRING lbc_type_name[31](10)

lbc_type_count = 1lbc_type_name(1) = “Temperature”status = db_get_lbc_id_for_type(lbc_type_count, lbc_type_name, @ lbc_count, lbc_id)IF (0 < status) THEN msg_to_form(status, 4, 0, 0, 0.0, ““)ELSE IF (0 > status) THEN /* Error information already displayed */ ELSE write_line(“lbc_count =”, lbc_count) FOR (i_lbc = 1 TO lbc_count) write_line(“lbc_id(“, i_lbc, ”) =”, lbc_id(i_lbc)) END FOR END IFEND IF

db_get_lbc_id_for_type (lbc_type_count, lbc_type_name, lbc_count, lbc_id)

Description:

This function finds the Load/BC ids for the given Load/BC type names.

Input:

INTEGER lbc_type_count This value specifies the number of Load/BC types.

STRING lbc_type_name[]() This array specifies the Load/BC type names. Example : [“Displacement”, ”Pressure”, “Convection”, “Distributed Load”, “Temperature”].

Output:

INTEGER lbc_count This value returns the number of Load/BC.

INTEGER lbc_id() This array returns the Load/BC ids.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate an error.

Error Conditions:

-1 This is an internal error status condition. There is no corresponding status message in the message database.

703Chapter 8: Accessing the Patran DatabaseLoads

db_get_lbc_var_value (lbc_name, lbc_var_name, lbc_var_component, eval_at_time, eval_at_frequency, which_ar, fem_count, fem_type, fem_id, fem_face_or_edge_id, fem_node_pos, fem_val)

Description:

This function evaluates the finite element entity Load/BC variable values for the given Load/BC name and Load/BC variable name.

Input:

STRING lbc_name[] This value specifies the Load/BC name.

STRING lbc_var_name[] This value specifies the Load/BC variable name. Example : [”Bot Surf Pressure”, “Translations <T1 T2 T3>”, “Temperature”].

INTEGER lbc_var_component This value specifies the component of the data to extract (values can range from 1 to 3) this value is ignored in the case the data is scalar.

REAL eval_at_time This value specifies the time value used for field evaluation.

REAL eval_at_frequency This value specifies the frequency value used for field evaluation.

STRING which_ar[] This value specifies the string containing digits matching the desired potential application regions ids. Ex: If you want to recover possible content of 2 first application region: “12”. To recover content of 1st application region only: “1”. One can speficy more ids than actually exist: “12345”.

Output:

INTEGER fem_count This value returns the number of finite element entities.

INTEGER fem_type(

VIRTUAL)

This array returns the finite element entity types :

123 (DbTblNode) : for a node.

124 (DbTblElem) : for a element.

153 (DbTblElemFace) : for a element face (values can range from 1 to 6).

154 (DbTblElemEdge) : for a element edge (values can range from 1 to 12).

INTEGER fem_id(VIRTUAL) This array returns the node or element id.

INTEGER fem_face_or_edge_id( VIRTUAL)

This array returns the element face or edge id.

PCL and CustomizationLoads

704

Remarks:

Memory is allocated for the output variables within this function. If memory was allocated prior to the call, it is released prior to re-allocation. Therefore, if this function is used within a loop, there is no need to release the memory of the output variable.

Example:

INTEGER status, lbc_var_component, fem_count, fem_type(VIRTUAL), @ fem_id(VIRTUAL), fem_face_or_edge_id(VIRTUAL), @ fem_node_pos(VIRTUAL, i_femSTRING lbc_name[31], lbc_var_name[31], which_ar[5]REAL eval_at_time, eval_at_frequency, fem_val(VIRTUAL)

lbc_name = “my_temperature_lbc”lbc_var_name = “Temperature”lbc_var_component = 0 /* scalar data */eval_at_time = 0.0eval_at_frequency = 0.0which_ar = “12”status = db_get_lbc_var_value(lbc_name, lbc_var_name, @ lbc_var_component, eval_at_time, eval_at_frequency, @ which_ar, fem_count, fem_type, fem_id, @ fem_face_or_edge_id, fem_node_pos, fem_val)IF (0 < status) THEN msg_to_form(status, 4, 0, 0, 0.0, ““)ELSE IF (0 > status) THEN /* Error information already displayed */ ELSE write_line(“fem_count =”, fem_count) FOR (i_fem = 1 TO fem_count) write_line(“fem_type(“, i_fem, ”) =”, fem_type(i_fem)) write_line(“fem_id(“, i_fem, ”) =”, fem_id(i_fem)) write_line(“fem_face_or_edge_id(“, i_fem, ”) =”, @ fem_face_or_edge_id(i_fem)) write_line(“fem_node_pos(“, i_fem, ”) =”, @ fem_node_pos(i_fem)) write_line(“fem_val(“, i_fem, ”) =”, fem_val(i_fem)) END FOR END IFEND IF

INTEGER fem_node_pos(

VIRTUAL)

This array returns the element node position. Will vary between 0 (not applicable) up to the maximum quantity of nodes for this element type. When greater than 0, we have a element variable Load/BC.

REAL fem_val(VIRTUAL) This array returns the finite element entity value. Evaluated for spatial dependant field, time dependant field, frequency dependant field if necessary.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate an error.

Error Conditions:

-1 This is an internal error status condition. There is no corresponding status message in the message database.

705Chapter 8: Accessing the Patran DatabaseLoads

db_get_lbc_new (<load_id>, <load_name>, <application_type>, <load_type>, <target_elem_dim>, <dyn_flag>, <cid_flag>, <scale_factor>, <geo_fem>, <app_reg_couple>, <app_reg_order>, <equiv_flag>, <acid_mod>)

Input:

INTEGER <load_id> The internal ID of the load of interest.

Output:

CHAR <load_name>[31] The external name used to reference this load.

INTEGER <application_type> A code specifying what type of entities this load is applied to and how the load is applied.1 = load applied to nodes2 = load applied to elements and constant over the element3 = load applied to elements and varying over the element

INTEGER <load_type> The internal ID of this load type. See db_create_lbc_type_defn, 543 for the meaning of this ID.

INTEGER <target_elem_dim>[3]

The dimensionality of the loaded elements for application regions 1 and 2:1 = line element2 = surface elements3 = solid elements

target_elem_dim[3] is currently unused, but must be allocated.

INTEGER <dyn_flag> A flag specifying whether this load is constant with respect to time or frequency (0) or varies with respect to time or frequency (1).

INTEGER <cid_flag> Used to indicate whether an alternate coordinate system is allowed; 0=global, >0 alt coord, -1=use implied local coord.

REAL <scale_factor> Load/BC set scale factor.

INTEGER <geo_fem>[3] Specifies whether this lbc was originally applied to geometry or fem for each application region. For release 1.4, entity types in multiple application regions are restricted to all geometry or all fem in both regions. 0=geometry, 1=fem.

geo_fem[3] is currently unused, but must be allocated.

INTEGER <app_reg_couple> Multiple application region coupling action.

INTEGER <app_reg_order> Multiple application region order option.

PCL and CustomizationLoads

706

Notes:

The C name differs. It is DbGetLbc_New.

int DbGetLbc_New (load_id, load_name, application_type, load_type, target_elem_dim, dyn_flag, cid_flag, scale_factor, geo_fem, app_reg_couple, app_reg_order, equiv_flag, acid_mod)int load_idchar *load_nameint*application_typeint *load_typeint *target_elem_dimint *dyn_flagint *cid_flagfloat*scale_factorint*geo_femint*app_region_coupleint*app_region_order,int*equiv_flagint*acid_mod

An example of a PCL function which evaluates all loads before spawning an external forward translator is given below.

INTEGER statusstatus = loadsbcs_eval_all()status = db_commit_raw()status = utl_process_spawn ( “my_forward_translator argument_1 argument_2”, TRUE )IF ( utl_process_error ( status ) ) THENutl_display_process_error( status, 3 )END IFstatus = db_start_transaction_raw()END FUNCTION

INTEGER <equiv_flag> Flag used to prevent equivalencing between nodes in multiple application regions. Not yet implemented at release 1.4.0 = equivalencing allowed1 = equivalencing not allowed

INTEGER <acid_mod> Flag used to indicate that this lbc requires the analysis coordinate frame for nodes in its application region to be modified. Not yet implemented at release 1.4.0 = analysis coordinate frame modification required1 = analysis coordinate frame modification not required

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

my_spawn ( )

707Chapter 8: Accessing the Patran DatabaseLoads

db_get_lbc_type_defn_by_id ( <load_type_id>, <load_type_name>, <analy_type_id>, <applic_type>, <glob_flag>, <coord_flag>, <graph_sym>, <scal_vect>, <null_vect>, <num_analy_codes>, <analy_code_ids>, <def_color>, <color_box>, <anchor> )

Input:

INTEGER <load_type_id> The ID of the load type of interest.

Output:

CHARACTER STRING

<load_type_name> The name of this load type.

INTEGER <analy_type_id> Flag specifying the analysis type.

INTEGER <applic_type> Flag specifying the effect of this load type:0 = Body Load1 = Boundary Load

INTEGER <glob_flag Flag specifying whether the load has global application or not:0 = Only application region affected1 = Global load: affects everything

INTEGER <coord_flag> Flag specifying whether the load can be oriented in a given local frame or not:0 = No local frame orientation allowed1 = Local frame orientation accepted

INTEGER <graph_sym> Flag specifying what graphic symbol should be used for this load type. Refer to Table 7-1 for definition of the graphics symbols.

INTEGER <scal_vect> Flag specifying the data form of the load:0 = scalar1 = vector

INTEGER <null_vect> Flag specifying whether blank components of a vector load are to be interpreted as zeroes (as with forces) or nulls (as with displacements):0 = interpret blank components as zeroes1 = interpret blank components as nulls

INTEGER <num_analy_codes> The number of analysis codes in which this load type is applicable

INTEGER ARRAY

<analy_code_ids The <num_analy_codes> IDs of all the analysis codes for which this load type is valid. The value of <num_analy_codes> (and, the size of this array) cannot be derived. An array size of 1000 should be sufficient.

PCL and CustomizationLoads

708

Notes:

The C name differs. It is DbFGetLbcTypeDefnById.

int DbFGetLbcTypeDefnById ( load_type_id, load_type_name, analy_type_id, applic_type,glob_flag, coord_flag, graph_sym, scal_vect, null_vect, num_analy_codes, analy_code_ids, def_color, color_box, anchor )int load_type_idchar *load_type_nameint *analy_type_idint *applic_typeint *glob_flagint *coord_flagint *graph_symint *scal_vectint *null_vectint *num_analy_codesint analy_code_ids[ ]int *def_colorint *color_boxint *anchor

INTEGER <def_color> Flag specifying the default color to be used for this load type. Refer to Table 7-2 for color definitions.

INTEGER <color_box> The number of the color box to be used to modify the load type color. Must range from 601 to 640 and be unique for a given analysis code. Refer to Table 7-3 for IDs used by Patran.

INTEGER <anchor> Flag which specifies the anchor style for vector load types:1 = anchor at base2 = anchor at tip3 = anchor at middle

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

db_get_lbc_defn (<lbc_type_id>, <lbc_type_name>, <lbc_option_name>, <lbc_class>, <lbc_form>, <global_bc_flag>, <cid_flag>, <scalar_vector>, <null_vector_flag>, <default_color>, <colorbox_id>, <num_app_regions>, <no_data_flag>, <input_data_pcl>, <app_region_pcl>, <target_elem_display>, <dyn_data_form>, <acid_mod>, <equiv_flag>)

Note: db_get_lbc_defn will replace db_get_lbc_type_defn. This routine will be used to retrieve data for (1) form display, (2) Load/BC set data manipulation, and (3) Load/BC graphical display.

709Chapter 8: Accessing the Patran DatabaseLoads

Input:

INTEGER <lbc_type_id> Lbc type id, e.g. Displacement id = 6

Output:

CHAR <lbc_type_name>[31} Lbc type name, e.g. "Displacement". See Table 7-4 for the load ID’s currently being used by Patran.

INTEGER <lbc_class> Flag specifying the analysis type.0 = Structural1 = Thermal2 = Fluid Dynamics

INTEGER <lbc_form> Flag specifying the effect of this load type:0 = Body Load1 = Boundary Load

INTEGER <global_bc_flag> Flag specifying whether the load has global application or not:0 = Only application region affected1 = Global load: affects everything

INTEGER <cid_flag> Flag specifying whether an alternate coordinate system is allowed:0 = No local frame orientation allowed1 = Local frame orientation accepted-1 = Local coord frame implied

INTEGER <scalar_vector> Flag specifying the data form of the load:0 = scalar1 = vector

INTEGER <null_vector_flag> Flag specifying whether blank components of a vector load are to be interpreted as zeroes (as with forces) or nulls (as with displacements):0 = interpret blank components as zeroes1 = interpret blank components as nulls

INTEGER <default_color> Flag specifying the default color to be used for this load type. Refer to Table 7-2 for color definitions.

INTEGER <colorbox_id> The number of the color box to be used to modify the load type color. Must range from 601 to 640 and be unique for a given analysis code. Refer to Table 7-3 for IDs used by Patran.

INTEGER <num_app_regions> Flag specifying the number of application regions; 0 thru 2.

INTEGER <no_data_flag> Flag specifying whether any input data is required:0 = input data required1 = no input data required

PCL and CustomizationLoads

710

Notes:

The C name differs. It is DbGetLbcDefn.

int DbGetLbcDefn( load_type_id, load_type_name, load_option_name, class, form,glob_flag, coord_flag, scal_vect, null_vect, def_color, color_box,num_app_regions, no_data_flag, input_data_pcl, app_region_pcl,target_element_display, dyn_data_form, acid_mod, equiv_flag )int load_type_idchar *load_type_nameint *load_option_nameint *classint *formint *glob_flagint *coord_flagint *scal_vectint *null_vectint *def_colorint *color_boxint*num_app_regionsint*no_data_flagchar*input_data_pcl

CHAR <input_data_pcl>[31] PCL classname for customized input data form. If blank, standard form is used.

CHAR <app_region_pcl>[31] PCL classname for customized select application region form. If blank, standard form is used.

INTEGER <target_elem_display> Flag which disables display of Target Element Menu. Note: This can only be used if customized PCL is specified.

0 = do not disable1 = disable

INTEGER <dyn_data_form> Flag specifying whether to use double input data form width for dynamic lbcs:

0 = do not use double width form1 = use double width form

INTEGER <acid_mod> Flag specifying whether this lbc requires the analysis coordinate frame for nodes in its application region to be modified. (Not yet implemented.)

0 = analysis coordinate frame modification required1 = analysis coordinate frame modification not required

INTEGER <equiv_flag> Flag used to prevent equivalencing between nodes in multiple application regions. (Not yet implemented.)

0 = equivalencing allowed1 = equivalencing not allowed

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

711Chapter 8: Accessing the Patran DatabaseLoads

char*app_region_pclint*target_element_displayint*dyn_data_formint*acid_modint*equiv_flag

A “get all”/”get next” methodology is used to extract the actual load values. First, call a “get all” function which merely prepares for extraction of the data. Then, make a “get next” call, getting one data value per call, until a non-zero return status is received from the “get next” function (which means that all data values have been extracted). Upon the last call, no valid data will be returned: all data was extracted in the previous calls.

To determine the number of data values associated with a load (possibly for memory allocation purposes), use the following function.

Notes:

The C name differs. It is DbFGetLbcFemCount.

int DbFGetLbcFemCount ( load_id, num_values ) int load_id int *num_values

The load data extraction calls are split into categories according to data type (scalar or vector) and load type (static or dynamic). The functions for static scalar loads are described below. First, make a call to the “get all” function.

Each load has one or more variables associated with it. For example, a force typically has two variables associated with it: a translational vector (F1, F2, F3) and a rotational vector (M1, M2, M3). To distinguish between the different load variables, a load variable id is used. The first variable assigned to a load type will be assigned the load variable id of one, the next, two, and so on. Typically, the translational vector would be assigned to the “Force” load type prior to the rotational vector and thus in our example (F1, F2, F3) would be assigned load variable id 1 and (M1, M2, M3), load variable id 2. But, this is merely a function of the order in which the load variables were defined via the db_create_elem_lbc_var_defn and db_create_nodal_lbc_var_defn functions described in Modifying the Database Using PCL (Ch. 7).

db_get_lbc_fem_count ( <load_id>, <num_values> )

Input:

INTEGER <load_id> The internal ID of the load of interest.

Output:

INTEGER <num_values> The number of data values associated with the specified load.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationLoads

712

Remarks:

Memory is allocated for the output variable within this function. If memory was allocated prior to the call, it is released prior to re-allocation. Therefore, if this function is used within a loop, there is no need to release the memory of the output variable.

Example:

INTEGER status, lbc_id, add_ass_femSTRING which_ar[10], app_reg_content[VIRTUAL]

lbc_id = 1which_ar = “12”add_ass_fem = 1 /* TRUE */status = lbc_get_one_app_reg_str(lbc_id, which_ar, add_ass_fem, @ app_reg_content)IF (0 < status) THEN msg_to_form(status, 4, 0, 0, 0.0, ““)ELSE

lbc_get_one_app_reg_str (lbc_id, which_ar, add_ass_fem, app_reg_content)

Description:

This function gets the application region for the given Load/BC id.

Input:

INTEGER lbc_id This value specifies the Load/BC id.

STRING which_ar[] This value specifies the string holding digits matching the desired potential application regions ids. Ex: If you want to recover possible content of 2 first application region: “12”. To recover content of 1st application region only: “1”. One can speficy more ids than actually exist: “12345”.

INTEGER add_ass_fem This value specifies 1 (TRUE) if we wish to recover associated FEM entities which may not be specified in the application region. This can be usefull to get the FEM entities associated to the geometric entities specified in the application regions. 0 (FALSE) otherwise.

Output:

STRING app_reg_content[

VIRTUAL]

This value returns a list processor string of entities in the selected application region ids and associated FEM entities (if desired).

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate an error.

Error Conditions:

-1 This is an internal error status condition. There is no corresponding status message in the message database.

713Chapter 8: Accessing the Patran DatabaseLoads

IF (0 > status) THEN /* Error information already displayed */ ELSE write_line(“app_reg_content =”, app_reg_content) END IFEND IF

The following are tables which will relate the meaning of load variable ids for the load types defined internally by MSC.

PCL and CustomizationLoads

714

Nodal Load Types

Elemental Load Types

ID Load Type

<load_variable_id>

1 2

6 Displacement translation vector <T1 T2 T3> rotation vector <R1 R2 R3>

7 Forces force vector <F1 F2 F3> moment vector <M1 M2 M3>

9 Temperature temperature

11 Initial displacement translation vector <T1 T2 T3> rotation vector <R1 R2 R3>

12 Initial velocity translation velocity <v1 v2 v3> rotational velocity <w1 w2 w3>

13 Velocity translational velocity <v1 v2 v3> rotational velocity <w1 w2 w3>

14 Acceleration translational acceleration <A1 A2 A3> rotation acceleration <a1 a2 a3>

15 Thermal temperature

temperature

18 Heat source heat source

19 Initial temperature temperature

ID Load Type Variability Element

Dimensionality

<load_variable_id>

1 2 3 4

1 Incompressible inflow

constant load (<variability>=2)

2d elements (<elem_dir>=2)

velocity<u v w>

pressure

1 Incompressible inflow

constant load (<variability>=2)

3d elements (<elem_dir>=3)

velocity<u v w>

pressure

2 Incompressible outflow

constant load (<variability>2)

2d elements (<elem_dir>=2)

pressure

2 Incompressible outflow

constant load (<variability>2)

3d elements (<elem_dir>=3)

pressure

3 Incompressible open flow

constant load (<variability>2)

2d elements (<elem_dir>=2)

value

715Chapter 8: Accessing the Patran DatabaseLoads

3 Incompressible open flow

constant load (<variability>2)

3d elements (<elem_dir>=3)

value

4 Incompressible solid wall

constant load (<variability>2)

2d elements (<elem_dir>=2)

value

4 Incompressible solid wall

constant load (<variability>2)

3d elements (<elem_dir>=3)

value

5 Symmetry constant load (<variability>2)

3d elements (<elem_dir>=3)

value

8 Pressure constant load (<variability>2)

2d elements (2) top surface pressure

bottom surface pressure

edge pressure

8 Pressure constant load (<variability>2)

3d elements (<elem_dir>=3)

face pressure

8 Pressure variable load (<variability>3)

2d elements (<elem_dir>=2)

top surface pressure

bottom surface pressure

edge pressure

8 Pressure variable load (<variability>3)

3d elements (<elem_dir>=3)

face pressure

9 Temperature constant load (<variability>2)

1d elements (<elem_dir>=1)

temperature

9 Temperature constant load (<variability>2)

2d elements (<elem_dir>=2)

temperature

ID Load Type Variability Element

Dimensionality

<load_variable_id>

1 2 3 4

PCL and CustomizationLoads

716

9 Temperature constant load (<variability>2)

3d elements (<elem_dir>=3)

temperature

9 Temperature variable load (<variability>3)

1d elements (<elem_dir>=1)

centroid temperature

cross section axis 1 gradient

cross section axis 2 gradient

9 Temperature variable load (<variability>3)

2d elements (<elem_dir>=2)

top surface temperature

bottom surface temperature

9 Temperature variable load (<variability>3)

3d elements (<elem_dir>=3)

temperature

10 Inertial load constant load (<variability>2)

1d elements (<elem_dir>=1)

translational acceleration <A1 A2 A3>

rotational velocity <w1 w2 w3>

rotational acceleration <a1 a2 a3>

10 Inertial load constant load (<variability>2)

2d elements (<elem_dir>=2)

translational acceleration <a1 a2 a3>

rotational velocity <w1 w2 w3>

rotational acceleration <a1 a2 a3>

10 Inertial load constant load (<variability>2)

3d elements (<elem_dir>=3)

translational acceleration <A1 A2 A3>

rotational velocity <w1 w2 w3>

rotational acceleration <a1 a2 a3>

16 Convection constant load (<variability>2)

2d elements (<elem_dir>=2)

top surface convection

bottom surface convection

edge convection

ambient temperature

ID Load Type Variability Element

Dimensionality

<load_variable_id>

1 2 3 4

717Chapter 8: Accessing the Patran DatabaseLoads

16 Convection constant load (<variability>2)

3d elements (<elem_dir>=3)

convection

ambient temperature

16 Convection variable load (<variability>3)

2d elements (<elem_dir>=2)

top surface convection

bottom surface convection

edge convection

ambient temperature

16 Convection variable load (<variability>3)

3d elements (<elem_dir>=3)

convection

ambient temperature

17 Heat flux constant load (<variability>2)

2d elements (<elem_dir>=2)

top surface heat flux

bottom surface heat flux

edge heat flux

17 Heat flux constant load (<variability>2)

3d elements (<elem_dir>=3)

heat flux

17 Heat flux variable load (<variability>2)

2d elements (<elem_dir>=3)

top surface heat flux

bottom surface heat flux

edge heat flux

17 Heat flux variable load (<variability>2)

3d elements (<elem_dir>=3)

heat flux

18 Heat source constant load (<variability>2)

2d elements (<elem_dir>=2)

heat source

18 Heat source constant load (<variability>2)

3d elements (<elem_dir>=3)

heat source

ID Load Type Variability Element

Dimensionality

<load_variable_id>

1 2 3 4

PCL and CustomizationLoads

718

21 Compressible inflow

constant load (<variability>2)

2d elements (<elem_dir>=2)

velocity<u v w>

pressure absolute temperature

21 Compressible inflow

constant load (<variability>2)

3d elements (<elem_dir>=3)

velocity<u v w>

pressure absolute temperature

22 Compressible outflow

constant load (<variability>2)

2d elements (<elem_dir>=2)

velocity<u v w>

pressure absolute temperature

22 Compressible outflow

constant load (<variability>2)

3d elements (<elem_dir>=3)

velocity<u v w>

pressure absolute temperature

23 Ccompressible open flow

constant load (<variability>2)

2d elements (<elem_dir>=2)

velocity<u v w>

pressure absolute temperature

23 Compressible open flow

constant load (<variability>2)

3d elements (<elem_dir>=3)

velocity<u v w>

pressure absolute temperature

24 Compressible solid wall

constant load (<variability>2)

2d elements (<elem_dir>=2)

temperature

heat flux

24 Compressible solid wall

constant load (<variability>2)

3d elements (<elem_dir>=3)

temperature

heat flux

ID Load Type Variability Element

Dimensionality

<load_variable_id>

1 2 3 4

719Chapter 8: Accessing the Patran DatabaseLoads

Notes:

The C name differs. It is DbFGetAllFemSSbyId.

int DbFGetAllFemSSbyId ( load_id )int load_id

Then, call the “get next” function until a non-zero return status is received.

db_get_all_fem_ss_by_id ( <load_id> )

Input:

INTEGER <load_id> The internal ID of the load of interest.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationLoads

720

Notes:

The C name differs. It is DbFGetNextFemSSbyId.

int DbFGetNextFemSSbyId ( load_var_id, entity_type, entity_id, sub_entity_id, load_value, scale_factor, node_position, region_type )int *load_var_idint *entity_typeint *entity_idint *sub_entity_idfloat *load_valuefloat *scale_factorint *node_positionint *region_type

The “get all”/”get next” functions used for static vector loads are as follows. First, make a call to the “get all” function.

db_get_next_fem_ss_by_id ( <load_var_id>, <entity_type>, <entity_id>, <sub_entity_id>,<load_value>, <scale_factor>, <node_position>, <region_type> )

Output:

INTEGER <load_var_id> The ID of the load variable as described above.

INTEGER <entity_type> A flag specifying the entity type to which this load is applied:123 = node124 = element153 = element face154 = element edge

INTEGER <entity_id> The ID of the element or node.

INTEGER <sub_entity_id> The ID of the element face or edge. Zero if inappropriate.

REAL <load_value> The value of the load at this point in space.

REAL <scale_factor> The value of the scale factor applied to this load.

INTEGER <node_position> The number of the node at which this load value applies. Appropriate for variable loads only. If there is only one value for an element, <node_position> will be zero.

INTEGER <region_type> The number of the region type. Will be one for all loads which only have one application region like forces and

pressures. Will be one or more for multi-application region loads such as sliding friction.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in

status or an error.

721Chapter 8: Accessing the Patran DatabaseLoads

Notes:

The C name differs. It is DbFGetAllFemSVbyId.

int DbFGetAllFemSVbyId ( load_id )int load_id

Then, call the “get next” function until a non-zero return status is received.

db_get_all_fem_sv_by_id ( <load_id> )

Input:

INTEGER <load_id> The internal ID of the load of interest.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationLoads

722

Notes:

The C name differs. It is DbFGetNextFemSVbyId.

int DbFGetNextFemSVbyId ( load_var_id, entity_type, entity_id, sub_entity_id, load_value , null_vector, scale_factor, node_position, region_type )int *load_var_idint *entity_typeint *entity_idint *sub_entity_idfloat load_value [3]int null_vector [3]float *scale_factorint *node_positionint *region_type

db_get_next_fem_sv_by_id ( <load_var_id>, <entity_type>, <entity_id>, <sub_entity_id>, <load_value>, <null_vector>, <scale_factor>, <node_position>, <region_type> )

Output:

INTEGER <load_var_id> The ID of the load variable as described above.

INTEGER <entity_type> A flag specifying the entity type to which this load is applied:123 = node124 = element153 = element face154 = element edge

INTEGER <entity_id> The ID of the element or node.

INTEGER <sub_entity_id>

The ID of the element face or edge. Zero if inappropriate.

REAL ARRAY

<load_value> The values of the three components of the vector load at this point in space.

INTEGER ARRAY

<null_vector> An array of null flags for the three components of the vector. -1 means the component field was left blank; 0 means that data was entered into the component field.

REAL <scale_factor> The value of the scale factor applied to this load.

INTEGER <node_position>

The number of the node at which this load value applies. Appropriate for variable loads only. If there is only one value for an element, <node_position> will be zero.

INTEGER <region_type> The number of the region type. Will be one for all loads which only have one application region like forces and pressures. Will be one or more for multi-application region loads such as sliding friction.

INTEGER <Return Value>

This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

723Chapter 8: Accessing the Patran DatabaseLoads

The “get all”/”get next” functions used for dynamic scalar loads are as follows. First, make a call to the “get all” function.

Notes:

The C name differs. It is DbFGetAllFemDSbyId.

int DbFGetAllFemDSbyId ( load_id )intload_id

Then, call the “get next” function until a non-zero return status is received.

db_get_all_fem_ds_by_id ( <load_id> )

Input:

INTEGER <load_id> The internal ID of the load of interest.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationLoads

724

.

Notes:

The C name differs. It is DbFGetNextFemDSbyId.

int DbFGetNextFemDSbyId ( load_var_id, entity_type, entity_id, sub_entity_id, load_value, dynamic_field, scale_factor, node_position, region_type )int *load_var_idint *entity_typeint *entity_idint *sub_entity_idfloat *load_valueint *dynamic_fieldfloat *scale_factorint *node_positionint *region_type

The “get all”/”get next” functions used for dynamic vector loads are as follows. First, make a call to the “get all” function.

db_get_next_fem_ds_by_id ( <load_var_id>, <entity_type>, <entity_id>, <sub_entity_id>, <load_value>, <dynamic_field>, <scale_factor>, <node_position>, <region_type> )

Output:

INTEGER <load_var_id> The ID of the load variable as described above.

INTEGER <entity_type> A flag specifying the entity type to which this load is applied:123 = node124 = element153 = element face154 = element edge

INTEGER <entity_id> The ID of the element or node.

INTEGER <sub_entity_id> The ID of the element face or edge. Zero if inappropriate.

REAL <load_value> The value of the load at this point in space.

INTEGER <dynamic_field> The ID of the field expressing the time of frequency dependence of the load. Zero implies that the load is constant over time or frequency.

REAL <scale_factor> The value of the scale factor applied to this load.

INTEGER <node_position> The number of the node at which this load value applies. Appropriate for variable loads only. If there is only one value for an element, <node_position> will be zero.

INTEGER <region_type> The number of the region type. Will be one for all loads which only have one application region like forces and pressures. Will be one or more for multi-application region loads such as sliding friction.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

725Chapter 8: Accessing the Patran DatabaseLoads

Notes:

The C name differs. It is DbFGetAllFemDVbyId.

int DbFGetAllFemDVbyId ( load_id )int load_id

Then, call the “get next” function until a non-zero return status is received

db_get_all_fem_dv_by_id ( <load_id> )

Input:

INTEGER <load_id> The internal ID of the load of interest.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationLoads

726

.

Notes:

The C name differs. It is DbFGetNextFemDVbyId.

int DbFGetNextFemDVbyId ( load_var_id, entity_type, entity_id, sub_entity_id,

db_get_next_fem_dv_by_id ( <load_var_id>, <entity_type>, <entity_id>, <sub_entity_id>, <load_value>, <dynamic_field>, <null_vector>, <scale_factor>, <node_position>, <region_type> )

Output:

INTEGER <load_var_id> The ID of the load variable as described above.

INTEGER <entity_type> A flag specifying the entity type to which this load is applied:123 = node124 = element153 = element face154 = element edge

INTEGER <entity_id> The ID of the element or node.

INTEGER <sub_entity_id> The ID of the element face or edge. Zero if inappropriate.

REAL ARRAY <load_value> The values of the three components of the vector load at this point in space.

INTEGER ARRAY

<dynamic_field> The three IDs of the fields referenced to express the time or frequency dependence of each of the vector components. Zero implies that the value for that component is constant over time or frequency.

INTEGER ARRAY

<null_vector> An array of null flags for the three components of the vector. -1 means the component field was left blank; 0 means that data was entered into the component field.

REAL <scale_factor> The value of the scale factor applied to this load.

INTEGER <node_position> The number of the node at which this load value applies. Appropriate for variable loads only. If there is only one value for an element, <node_position> will be zero.

INTEGER <region_type> The number of the region type. Will be one for all loads which only have one application region like forces and pressures. Will be one or more for multi-application region loads such as sliding friction.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

727Chapter 8: Accessing the Patran DatabaseLoads

load_value , dynamic_field, null_vector, scale_factor, node_position, region_type )int *load_var_idint *entity_typeint *entity_idint *sub_entity_idfloat load_value [3]int dynamic_field [3]int null_vector [3]float *scale_factorint *node_positionint *region_type

PCL and CustomizationLoads

728

db_get_lbc_fem_data ( <lbc_id>, <num_entities>, <entity_type>, <entity_id>, <entity_subid>, <node_position>, <app_region_id>, <nvar>, <variable_ids>, <data_type>, <scalar_vector>, <dynamic_flag>, <integer_value>, <real_value>, <field_id>, <node_ids>, <dyn_field_ids> )

Output:

INTEGER <lbc_id> The internal ID of the load of interest.

INTEGER <num_entities> Number of entities times the number of node positions.

INTEGER <entity_type>[] Entity types:

123 = node124 = element153 = element face154 = element edge

INTEGER <entity_id>[] The ID of the element or node.

INTEGER <entity_subid>[] The ID of the element face or edge. Zero if inappropriate.

INTEGER <node_position> Entity node positions. The number of the node at which this load value applies. Appropriate for variable loads only. If there is only one value for an element, the node position will be zero.

INTEGER <app_region_id>[] Input data variable ids for each variable.

INTEGER <nvar>[] The number of input variables for each entity.

INTEGER <variable_ids>[][nvar]

Input data variable ids for each variable.

INTEGER <data_type>[][nvar]

Data types for each variable. Valid types are:

0 = real/field1 = integer3 = real value7 = field id5 = node id

INTEGER <scalar_vector>[][nvar]

Scalar or vector flag for each variable:0 = scalar1 = vector

INTEGER <dynamic_flag>[][nvar]

Indicates if there are dynamic fields for each variable:0 = no dynamic fields1 = dynamic fields

729Chapter 8: Accessing the Patran DatabaseLoads

Notes:

See Patran Element Library (Ch. 15) in the Reference Manual - Part III for the definitions of the face and edge IDs. Most analysis codes specify face or edge loads with analysis code specific edge or face IDs, with node numbering or node IDs. The description of the face and edge IDs in the Element Library will allow the development of a mapping between Patran’s edge and face IDs and the analysis code’s method for specifying these types of loads. The Patran convention is that edge and face loads are always positive inward. For more on the exportation or evaluation of data fields, review Data Fields, 643.

Importation of Load DataThere are four steps to adding a load or boundary condition to a Patran database.

1. Define the load.

2. Assign a global attributes to the load.

3. Assign effected entities to the load.

4. Create a finite element/node table which contains the value applied to each and every effected finite element/node.

INTEGER <integer_value>[][nvar]

Integer values for each variable.

REAL <real_value>[][invar][3]

Real values for each variable.

INTEGER <field_id>[][nvar][3]

Fields ids for each variable.

INTEGER <node_ids>[][nvar]

Node ids for each variable.

INTEGER <dyn_field_ids>[][nvar][3]

Dynamic field ids for each variable.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationLoads

730

db_create_lbc_new (<lbc_name>, <lbc_category>, <lbc_type_id>, <target_elem_dim>, <dyn_flag>, <cid_flag>, <scale_factor>, <geo_fem>, <app_region_couple>, <app_region_order>, <equiv_flag>, <acid_mod>, <lbc_id>)

Input:

CHAR <lbc_name>[31]

The external name used to reference this load.

INTEGER <lbc_category> A code specifying what type of entities this load is applied to and how the load is applied.1 = load applied to nodes2 = load applied to elements and constant over the element3 = load applied to elements and varying over the element

INTEGER <lbc_type_id> The ID of the load type of this load. See Table 7-4 for the load ID’s currently being used by Patran.

INTEGER <target_elem_dim>[3]

The dimensionality of the loaded elements for each application region. Set target_elem_dim[2] to zero if only one application region. Set target_elem_dim[3] to zero (not currently being used).1 = line element2 = surface element3 = solid element

INTEGER <dyn_flag> A flag specifying whether this load is constant with respect to time or frequency (0) or varies with respect to time or frequency (1).

INTEGER <cid_flag> Used to indicate whether an alternate coordinate system is allowed; 0=global, >0 alt coord, -1=use implied local coord

REAL <scale_factor> Load set scale factor

INTEGER <geo_fem>[3] A flag specifying whether this lbc was originally applied to geometry or fem for each application region. Set geo_fem[2] to zero if only one application region. Set geo_fem[3] to zero (not currently being used).0 = geometry1 = fem

INTEGER app_region_couple

Multiple application region coupling action. Used for multiple application region LBCs only. Meaning of value is determined by application. Set to zero if only one application region.

INTEGER app_region_order

Multiple application region order option. Used for multiple application region LBCs only. Meaning of value is determined by application. Set to zero if only one application region.

731Chapter 8: Accessing the Patran DatabaseLoads

Notes:

The C prototype for this function is:

int DbCreateLbc_New ( char * lbc_name, int lbc_category, int lbc_type_id, int * target_elem_dim, int dyn_flag, int cid_flag, double scale_factor, int * geo_fem, int app_region_couple, int app_region_order, int equiv_flag, int acid_mod, int * lbc_id );

The function used to define the global properties for a static vector load is as follows:

INTEGER <equiv_flag> Used to prevent equivalencing between nodes in multiple application regions:0 = don’t prevent1 = prevent

INTEGER <acid_mod> Flag which says that this lbc requires the analysis coordinate frame for nodes to be modified:0 = don’t modify1 = modify

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

db_create_lbc_sv ( <load_id>, <num_variables>, <variable_ids>, <real_values>, <spatial_fields>, <null_flags>, <scale_factors> )

Note: This function is still usable, but obsolete. Use db_create_lbc_input_data, 733 instead.

PCL and CustomizationLoads

732

Notes:

The C name differs. It is DbFCreateLbcSV.

int DbFCreateLbcSV ( load_id, num_variables, variable_ids, real_values, spatial_fields, null_flags, scale_factors )int load_idint num_variablesint variable_ids [ ]float real_values [ ][3]int spatial_fields [ ][3]int null_flags [ ][3]float scale_factors [ ]

Input:

INTEGER <load_id> The internal ID of the load of interest.

INTEGER <num_variables> The number of load variables defined for this load.

INTEGER ARRAY

<variable_ids> The IDs of the <num_variables> load variables defined for this load. See db_create_nodal_lbc_var_defn, 547 and db_create_elem_lbc_var_defn, 546 for details about the load variable IDs.

REAL ARRAY <real_values> The values for the 3 components for each of the <num_variables> load variables. If a corresponding spatial field reference exists, this load value is meaningless.

INTEGER ARRAY

<spatial_fields> The spatially varying field references for the 3 components for each of the <num_variables> load variables. Zero signifies that there is no spatial variance in the load and the corresponding <real_values> value should be used. If there is a spatial field reference, the corresponding <real_values> value should be ignored.

INTEGER ARRAY

<null_flags> The null component flags for the 3 components for each of the <num_variables> load variables. -1 means that no data was filled in for that vector component, whereas 0 means that data was input for the corresponding vector component.

REAL ARRAY <scale_factors> The <num_variables> scale factors to be applied to each of the load variables.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

733Chapter 8: Accessing the Patran DatabaseLoads

db_create_lbc_input_data ( <lbc_id>, <variable_id>, <data_type>, <scalar_or_vector>, <dynamic_flag>, <eval_flag>, <integer_value>,<char_value>, <real_value>, <field_id>, <dyn_field_id>, app_region_ids>, <node_id> )

Input:

INTEGER <lbc_id> The internal ID of the load.

INTEGER variable_id Input data variable id assigned when db is stuffed for this lbc_type_id. See lbc_defn_create.lbc_var_defn, 553.

INTEGER data_type Specifies datatype for this databox:0 = real/field1 = integer3 = real value7 = field id5 = node id

INTEGER scalar_vector If this is a real number/field then this flag indicates whether it is scalar or vector:0 = scalar1 = vector

INTEGER dynamic_flag Specifies static or dynamic load:0 = static1 = dynamic

INTEGER eval_flag Used to determine if the data requires evaluation (the data type is a field). If the data for this variable is constant then no evaluation is needed.0 = evaluation not required1 = evaluation required

INTEGER integer_value The value of the integer variable if data_type is integer.

CHAR char_value[31] The character string if data_type is character.

REAL real_value[3] The real values (1 if scalar, 3 if vector) if data_type is real/field. If scalar, set real[2] and [3] to zero.

INTEGER field_id[3] The field ids (1 if scalar, 3 if vector) if data_type is real/field. If scalar, set field_id[2] and [3] to zero.

INTEGER dyn_field_id[3] The dynamic field ids (1 if scalar, 3 if vector) if data_type is real/field. If scalar, set dyn_field_id[2] and [3] to zero.

PCL and CustomizationLoads

734

Notes:

The C name differs. It is DbCreateLbcInputData.

int DbCreateLbcInputData( lbc_id, variable_id, data_type, scalar_or_vector, dynamic_flag, eval_flag, integer_value, char_value, real_value, field_id, dyn_field_id, app_region_ids, node_id )intlbc_idintvariable_idintdata_typeintscalar_or_vectorintdynamic_flaginteval_flagintinteger_valuechar*char_valuefloat*real_valueint*field_idint*dyn_field_idint*app_region_idsintnode_id

In order to define all the members of the application region upon which the load is acting, the following function must be used.

INTEGER app_region_ids[3] The application region ids to which the load is to be applied. Set app_region_ids[3] to zero (not currently being used). The load need not be applied to both application regions. Always set app_region_ids[1] to the first loaded application region. Always set app_region_ids[2] to the second loaded application region, or zero if only one application region is loaded.

INTEGER node_id The node id if data_type is node.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

735Chapter 8: Accessing the Patran DatabaseLoads

.

Notes:

The C name differs. It is DbFCreateLbcAppRegion.

int DbFCreateLbcAppRegion ( load_id, region_type, entity_type, entity_id, sub_entity_id )int load_idint region_typeint entity_typeint entity_idint sub_entity_id

db_create_lbc_app_region ( <load_id>, <region_type>, <entity_type>, <entity_id>, <sub_entity_id> )

Input:

INTEGER <load_id> The internal ID of the load.

INTEGER <region_type> A code specifying the region type:1 = the standard application region

INTEGER <entity_type> A code specifying the type of entity the load was originally applied to:1 = point2 = curve3 = surface4 = solid123 = node124 = element153 = face of element154 = edge of element

INTEGER <entity_id> The ID of the main entity, i.e., a point, curve, surface, solid, node or element ID.

INTEGER <sub_entity_id> The ID of the sub entity ID, i.e., a element face or element edge ID.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationLoads

736

Notes:

The C name differs. It is DbCreateBulkLbcAppRegion_New.

int DbCreateBulkLbcAppRegion_New( lbc_id, app_region_id, count, entity_type, entity_id, entity_subid, app_region_set )intlbc_idintapp_region_idintcountint*entity_type

db_create_bulk_lbc_app_region_n ( <lbc_id>, <app_region_id>, <count>, <entity_type>, <entity_id>, <entity_subid>, <app_region_set> )

Input:

INTEGER <lbc_id>

INTEGER <app_region_id>

INTEGER <count>

INTEGER <entity_type>[count]

A code specifying the type of entity the load was originally applied to:1 = point2 = curve3 = surface4 = solid123 = node124 = element153 = face of element154 = edge of element

INTEGER <entity_id>[count} The ID of the main entity, i.e., a point, curve, surface, solid, node or element ID.

INTEGER <entity_subid>[count]

The ID of the sub entity ID, i.e., a element face or element edge ID.

INTEGER <app_region_set>[count]

Used for two application regions only. If there is more than one set of entities in the application region then this denotes which set they belong to. Input 0 if only one application region

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

737Chapter 8: Accessing the Patran DatabaseLoads

int*entity_idint*entity_subidint*app_region_set

The fourth step in creating loads in the database is to create the finite element/node table which will contain the values of the load for each loaded finite element or node. The functions which create the finite element/node tables are grouped according to data type and variability of the load just like the functions which define the global properties of a load. The function which builds the finite element/node table for static scalar loads is described below

PCL and CustomizationLoads

738

.

Notes:

The C name differs. It is DbFCreateFemSS.

db_create_fem_ss ( <load_id>, <num_points>, <variable_ids>, <entity_types>, <entity_ids>, <sub_entity_ids>, <real_values>, <scale_factors>, <nodal_positions>, <region_types> )

Input:

INTEGER <load_id> The internal ID of this load.

INTEGER <num_points> The number of data points defined for this load.

INTEGER ARRAY

<variable_ids> The <num_points> load variable IDs for all the data points.

INTEGER ARRAY

<entity_types> The entity type codes for each of the data points:123 = node124 = element153 = element face154 = element edge

INTEGER ARRAY

<entity_ids> The IDs of the main loaded entity (node or element ID) for all the data points.

INTEGER ARRAY

<sub_entity_ids> The IDs of the loaded sub entities (element edge or face numbers) for all the data points. Zero if not applicable.

REAL ARRAY <real_values> The real values of the load for all the data points. The scale factors should incorporated into this value.

REAL ARRAY <scale_factors> The original scale factors applied to all the data points. These factors should already be incorporated into the <real_values> array, so these values are somewhat redundant.

INTEGER ARRAY

<nodal_positions> The type of region being loaded. Always 1, for now.

INTEGER ARRAY

<region_types> The type of region being loaded. Always 1, for now.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

739Chapter 8: Accessing the Patran DatabaseLoads

int DbFCreateFemSS ( load_id, num_points, variable_ids, entity_types, entity_ids, sub_entity_ids, real_values, scale_factors, nodal_positions, region_types )int load_idint num_pointsint variable_ids [ ]int entity_types [ ]int entity_ids [ ]int sub_entity_ids [ ]float real_values [ ]float scale_factors [ ]int nodal_positions [ ]int region_types [ ]

The function which builds the finite element/node table for static vector loads is described below.

PCL and CustomizationLoads

740

db_create_fem_sv ( <load_id>, <num_points>, <variable_ids>, <entity_types>, <entity_ids>, <sub_entity_ids>, <real_values>, <null_flags>, <scale_factors>, <nodal_positions>, <region_types> )

Input:

INTEGER <load_id> The internal ID of this load.

INTEGER <num_points> The number of data points defined for this load.

INTEGER ARRAY

<variable_ids> The <num_points> load variable IDs for all the data points.

INTEGER ARRAY

<entity_types> The entity type codes for each of the data points:123 = node124 = element153 = element face154 = element edge

INTEGER ARRAY

<entity_ids> The IDs of the main loaded entity (node or element ID) for all the data points.

INTEGER ARRAY

<sub_entity_ids> The IDs of the loaded sub entities (element edge or face numbers) for all the data points. Zero if not applicable.

REAL ARRAY <real_values> The real values of the 3 components of the load for all the data points. The scale factors should incorporated into this value.

INTEGER ARRAY

<null_flags> A flag for each of the 3 components of load for all the data points specifying whether data was input for that component (0) or the component was left blank (-1).

REAL ARRAY <scale_factors> The original scale factors applied to all the data points. These factors should already be incorporated into the <real_values> array, so these values are somewhat redundant.

INTEGER ARRAY

<nodal_positions> The node numbering expressing where the particular values are being applied. Zero if the load is constant over the element or the load is being applied directly to nodes.

INTEGER ARRAY

<region_types> The type of region being loaded. Always 1, for now.

741Chapter 8: Accessing the Patran DatabaseLoads

Notes:

The C name differs. It is DbFCreateFemSV.

int DbFCreateFemSV ( load_id, num_points, variable_ids, entity_types, entity_ids, sub_entity_ids, real_values, null_flags, scale_factors, nodal_positions, region_types )int load_idint num_pointsint variable_ids [ ]int entity_types [ ]int entity_ids [ ]int sub_entity_ids [ ]float real_values [ ][3]int null_flags [ ][3]float scale_factors [ ]int nodal_positions [ ]int region_types [ ]

The function which builds the finite element/node table for dynamic scalar loads is described below.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationLoads

742

db_create_fem_ds ( <load_id>, <num_points>, <variable_ids>, <entity_types>, <entity_ids>, <sub_entity_ids>, <real_values>, <dynamic_fields>, <scale_factors>, <nodal_positions>, <region_types> )

Input:

INTEGER <load_id> The internal ID of the load.

INTEGER <num_points> The number of data points defined for this load.

INTEGER ARRAY

<variable_ids> The <num_points> load variable IDs for all the data points.

INTEGER ARRAY

<entity_types> The entity type codes for each of the data points:123 = node124 = element153 = element face154 = element edge

INTEGER ARRAY

<entity_ids> The IDs of the main loaded entity (node or element ID) for all the data points.

INTEGER ARRAY

<sub_entity_ids> The IDs of the loaded sub entities (element edge or face numbers) for all the data points. Zero if not applicable.

REAL ARRAY <real_values> The real values of the load for all the data points. The scale factors should incorporated into this value.

INTEGER ARRAY

<dynamic_fields> The dynamic field references for all the data points. Zero implies that the load is constant over time or frequency.

REAL ARRAY <scale_factors> The original scale factors applied to all the data points. These factors should already be incorporated into the <real_values> array, so these values are somewhat redundant.

INTEGER ARRAY

<nodal_positions> The node numbering expressing where the particular values are being applied. Zero if the load is constant over the element or the load is being applied directly to nodes.

INTEGER ARRAY

<region_types> The type of region being loaded. Always 1, for now.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

743Chapter 8: Accessing the Patran DatabaseLoads

Notes:

The C name differs. It is DbFCreateFemDS.

int DbFCreateFemDS ( load_id, num_points, variable_ids, entity_types, entity_ids, sub_entity_ids, real_values, dynamic_fields, scale_factors, nodal_positions, region_types )int load_idint num_pointsint variable_ids [ ]int entity_types [ ]int entity_ids [ ]int sub_entity_ids [ ]float real_values [ ]int dynamic_fields [ ]float scale_factors [ ]int nodal_positions [ ]int region_types [ ]

The function which builds the finite element/node table for dynamic vector loads is described below.

PCL and CustomizationLoads

744

db_create_fem_dv ( <load_id>, <num_points>, <variable_ids>, <entity_types>, <entity_ids>, <sub_entity_ids>, <real_values>, <dynamic_fields>, <null_flags>, <scale_factors>, <nodal_positions>, <region_types> )

Input:

INTEGER <load_id> The internal ID of the load.

INTEGER <num_points> The number of data points defined for this load.

INTEGER ARRAY

<variable_ids> The <num_points> load variable IDs for all the data points.

INTEGER ARRAY

<entity_types> The entity type codes for each of the data points:123 = node124 = element153 = element face154 = element edge

INTEGER ARRAY

<entity_ids> The IDs of the main loaded entity (node or element ID) for all the data points.

INTEGER ARRAY

<sub_entity_ids> The IDs of the loaded sub entities (element edge or face numbers) for all the data points. Zero if not applicable.

REAL ARRAY <real_values> The real values of the 3 components of the load for all the data points. The scale factors should incorporated into this value.

INTEGER ARRAY

<dynamic_fields> The dynamic field references for the 3 components of the load for all the data points. Zero implies that the component of the data point load is constant with respect to time or frequency.

INTEGER ARRAY

<null_flags> A flag for each of the 3 components of load for all the data points specifying whether data was input for that component (0) or the component was left blank (-1).

INTEGER ARRAY

<region_types> The type of region being loaded. Always 1, for now.

745Chapter 8: Accessing the Patran DatabaseLoads

Notes:

The C name differs. It is DbFCreateFemDV.

int DbFCreateFemDV ( load_id, num_points, variable_ids, entity_types, entity_ids, sub_entity_ids, real_values, dynamic_fields, null_flags, scale_factors, nodal_positions, region_types )int load_idint num_pointsint variable_ids [ ]int entity_types [ ]int entity_ids [ ]int sub_entity_ids [ ]float real_values [ ][3]int dynamic_fields [ ][3]int null_flags [ ][3]float scale_factors [ ]int nnodal_positions [ ]int region_types [ ]

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationLoads

746

db_create_lbc_fem_data ( <lbc_id>, <num_ent>, <entity_type>, <entity_id>, <entity_subid>, <node_position>, <app_region_id>, <nvar>, <variable_id>, <data_type>, <scalar_vector>, <dynamic_flag>, <integer_value>, <real_value>, <dyn_field_id> )

Input:

INTEGER <lbc_id> The internal ID of this load.

INTEGER <num_ent> Number of entities times the number of node positions in each app region.

INTEGER <entity_type>[ The entity type codes for each of the data points:123 = node124 = element153 = element face154 = element edge

INTEGER <entity_id>[ ] The IDs of the main loaded entity (node or element ID) for all the data points.

INTEGER <entity_subid>[ ] The IDs of the loaded sub entities (element edge or face numbers) for all the data points. Zero if not applicable.

INTEGER <node_position>[ ] The node numbering expressing where the particular values are being applied. Zero if the load is constant over the element or the load is being applied directly to nodes.

INTEGER <app_region_id> The application Region id for each entity.

INTEGER <nvar> The number of input variables for each application region entity.

INTEGER <variable_id>[][nvar]

Input data variable IDs.

INTEGER <data_type>[ ][nvar]

Data type for each variable. Valid types are:0 = real/field1 = integer3 = real value7 = field id5 = node id

INTEGER <scalar_vector>[ ][nvar]

Scalar or vector flag.0 = scalar1 = vector

INTEGER <dynamic_flag>[ ][nvar]

747Chapter 8: Accessing the Patran DatabaseLoads

Notes:

The C name differs. It is DbCreateLbcFemData.

int DbCreateLbcFemData( lbc_id, num_ent, entity_type, entity_id, entity_subid, node_position, app_region_id, nvar, variable_id, data_type, scalar_vector, dynamic_flag, integer_value, real_value, dyn_field_id )intlbc_idintnum_entint*entity_typeint*entity_idint*entity_subidint*node_positionint*app_region_idint*nvarint*variable_idint*data_typeint*scalar_vectorint*dynamic_flagint*integer_valuefloat*real_valueint*dyn_field_id

Indicates if there are dynamic fields.0 = no dynamic fields1 = dynamic fields

INTEGER <integer_value>[ ][nvar]

Integer values.

REAL <real_value>[ ][nvar][3]

Real values. 3 values are required. For scalar, put scalar in 1st position and zeros in 2 and 3.

INTEGER <dyn_field_id>[ ][nvar][3]

Dynamic field ids. 3 values are required. For scalar, put scalar in 1st position and zeros in 2 and 3.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationLoads

748

db_create_lbc_fem_data_2reg ( <lbc_id>, <num_ent>, <entity_type>, <entity_id>, <entity_subid>, <node_position>, <app_region_id>, <app_reg_set_order>, <app_region_set>, <fem_set_id>, <nvar>, <variable_id>, <data_type>, <scalar_vector>, <dynamic_flag>, <integer_value>, <real_value>, <dyn_field_id> )

Input:

INTEGER <lbc_id> The internal ID of this load.

INTEGER <num_ent> Number of entities times the number of node positions in each app region.

INTEGER <entity_type> The entity type codes for each of the data points:123 = node124 = element153 = element face154 = element edge

INTEGER <entity_id>[] The IDs of the main loaded entity (node or element ID) for all the data points.

INTEGER <entity_subid>[] The IDs of the loaded sub entities (element edge or face numbers) for all the data points. Zero if not applicable.

INTEGER <node_position>[] The node numbering expressing where the particular values are being applied. Zero if the load is constant over the element or the load is being applied directly to nodes.

INTEGER <app_region_id>[] The application Region id for each entity.

INTEGER <app_reg_set_order>[]

The application Region set order for each entity.

INTEGER <app_region_set>[] The application Region set number for each entity.

INTEGER <fem_set_id>[] The fem set id for each entity.

INTEGER <nvar> The number of input variables for each application region entity.

INTEGER <variable_id>[ ][nvar]

Input data variable IDs.

INTEGER <data_type>[ ][nvar] Data type for each variable. Valid types are:0 = real/field1 = integer3 = real value7 = field id5 = node id

INTEGER <scalar_vector>[ ][nvar]

749Chapter 8: Accessing the Patran DatabaseLoads

Notes:

The C name differs. It is DbCreateLbcFemData2Reg.

int DbCreateLbcFemData2Reg( lbc_id, num_ent, entity_type, entity_id, entity_subid, node_position, app_region_id, app_reg_set_order, app_region_set, fem_set_id, nvar, variable_id, data_type, scalar_vector, dynamic_flag, integer_value, real_value, dyn_field_id )intlbc_idunsigned intnum_entint*entity_typeint*entity_idint*entity_subidint*node_positionint*app_region_idint*app_reg_set_orderint*app_region_setint*fem_set_idunsigned int*nvarint*variable_idint*data_typeint*scalar_vectorint*dynamic_flagint*integer_valuefloat*real_valueint*dyn_field_id

Lastly, the user must assign the newly created load to the appropriate load case. The function listed below will perform this operation

Scalar or vector flag.0 = scalar1 = vector

INTEGER <dynamic_flag>[ ][nvar]

Indicates if there are dynamic fields.0 = no dynamic fields1 = dynamic fields

INTEGER <integer_value>[ ][nvar]

Integer values.

REAL <real_value>[ ][nvar][3]

Real values. 3 values are required. For scalar, put scalar in 1st position and zeros in 2 and 3.

INTEGER <dyn_field_id>[ ][nvar][3]

Dynamic field ids. 3 values are required. For scalar, put scalar in 1st position and zeros in 2 and 3.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationLoads

750

.

Notes:

The C name differs. It is DbFAddLbcToLoadCase.

int DbFAddLbcToLoadCase ( load_case_id, load_id, priority_code ) int load_case_id int load_id int priority_code

For more on the importation of spatial or dynamic data field, refer to the Data Fields, 643. Remember that all face or edge loads are inward positive unless the load type can be oriented along a user specified coordinate frame, in which case the load would be oriented in global or along the specified coordinate frame.

db_add_lbc_to_load_case ( <load_case_id>, <load_id>, <priority_code>)

Input:

INTEGER <load_case_id> The internal ID of the load case to which the specified load is to be added. See Load Cases, 692 for more about the load case ID.

INTEGER <load_id> The internal ID of the load of interest.

INTEGER <priority_code> A flag specifying the priority of this load within this load case. Zero specifies that all loads are additive. Otherwise, when more than one load of a given type is applied to a given entity, (e.g., node or element), the load with the highest <priority_code> value overwrites all other same-type loads for that entity.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

db_modify_lbc_name ( old_name, new_name )

Description:

This function renames an LBC.

Input:

STRING[32] old_name LBC name to be modified.

STRING[32] new_name New LBC name.

Output:

INTEGER <Return Value> 0=success, otherwise failure.

751Chapter 8: Accessing the Patran DatabaseMulti-point Constraints

Multi-point ConstraintsThe MPC entity in a database is really a collection of multi-point constraint relations called “sub MPCs.” There will probably be a one to one relationship between a Patran sub MPC and the target analysis code’s MPC equation but a one to many relationship between a Patran MPC entity and the target analysis code’s MPC equation.

Exportation of Multi-point Constraint DataMulti-point constraints are members of groups just as nodes and elements are. Therefore, MPCs of a specified group (e.g., the current group) or all the MPCs in the database can be translated to determine the count of MPCs in a group or all the MPCs in the database use one of the following two functions. This count can be used for allocation of storage memory.

To get the count of all the MPCs in the database, use the function below.

Notes:

The C name is DbCountMpcs.

int DbCountMpcs ( num_mpcs ) int *num_mpcs

Or, the following function can be used to determine the number of MPCs in a specified group.

db_count_mpcs ( <num_mpcs> )

Output:

INTEGER <num_mpcs> The number of MPCs defined in the database.

LOGICAL <Return Value>

This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationMulti-point Constraints

752

Notes:

The C name is DbCountMpcsInGroup.

int DbCountMpcsInGroup ( group_id, num_mpcs ) int group_id int *num_mpcs

Notes:

The C name is DbGetMpcIds.

int DbGetMpcIds ( num_mpcs, mpc_ids ) int num_mpcs int mpc_ids [ ]

Use the function “db_get_mpcs_in_group” to extract all the IDs for the MPCs belonging to a particular group.

db_count_mpcs_in_group ( <group_id>, <num_mpcs> )

Input:

INTEGER <group_id> The internal ID of the group of interest. This ID can be determined by either “db_get_group_id” or “db_get_current_group_id” as described in Groups, 600.

Output:

INTEGER <num_mpcs> The number of MPCs belonging to the group specified by <group_id>.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

db_get_mpc_ids ( <num_mpcs>, <mpc_ids> )

Input:

INTEGER <num_mpcs> The number of MPCs defined in the database.

Output:

INTEGER ARRAY

<mpc_ids> The <num_mpcs> IDs of all the MPCs defined in the database.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

753Chapter 8: Accessing the Patran DatabaseMulti-point Constraints

Notes:

The C name is DbGetMpcsInGroup.

int DbGetMpcsInGroup ( num_mpcs, group_id, mpc_ids ) int num_mpcs int group_id int mpc_ids [ ]

The function “db_get_mpc” is used to get data about an MPC entity including the type of the MPC and the number of relations (sub MPCs) belonging to the MPC.

db_get_mpcs_in_group ( <num_mpcs>, <group_id>, <mpc_ids> )

Input:

INTEGER <num_mpcs> The number of MPCs defined in the database.

INTEGER <group_id> The internal ID of the group of interest. This ID can be determined by either “db_get_group_id” or “db_get_current_group_id” as described in Groups, 600.

Output:

INTEGER ARRAY

<mpc_ids> The <num_mpcs> IDs of all the MPCs belonging to the group specified by <group_id>.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationMulti-point Constraints

754

Notes:

The C name is DbGetMpc.

int DbGetMpc ( mpc_id, mpc_type_id, geom_flag, coord_id, constant, sequen_flag,num_sub_mpcs, num_terms, max_num_nodes, max_num_dofs ) int mpc_id int *mpc_type_id int *geom_flag int *coord_id float *constant int *sequen_flag int *num_sub_mpcs int *num_terms int *max_num_nodes int *max_num_dofs

db_get_mpc ( <mpc_id>, <mpc_type_id>, <geom_flag>, <coord_id>, <constant>, <sequen_flag>,<num_sub_mpcs>,<num_terms>,<max_num_nodes>, <max_num_dofs> )

Input:

INTEGER <mpc_id> The ID of the MPC entity of interest.

Output:

INTEGER <mpc_type_id> The ID of the MPC type. See db_create_mpc_type_def, 577 for details about the meaning of this ID.

LOGICAL <geom_flag> A flag specifying whether this MPC references geometry (TRUE) or finite element nodes (FALSE).

INTEGER <coord_id> The coordinate frame in which the multi-point constraint relations are expressed. Zero if in the relation is expressed in the global system or a frame reference is not appropriate.

REAL <constant> The equation constant of the MPC, if applicable.

LOGICAL <sequen_flag> A flag specifying whether the sequence of data input is of importance (TRUE) or not (FALSE). If sequence is important, the order in which the data is received from the database functions will be the order in which the data was input to Patran.

INTEGER <num_sub_mpcs> The number of sub MPCs (multi-point constraint relations) which belong to this MPC entity.

INTEGER <num_terms> The number of terms which each of the sub MPCs will have.

INTEGER <max_num_nodes> The maximum number of nodes associated with any given MPC term in this MPC entity.

INTEGER <max_num_dofs> The maximum number of degrees-of-freedom associated with any given MPC term in this MPC entity.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

755Chapter 8: Accessing the Patran DatabaseMulti-point Constraints

The <mpc_type_id> argument in the above function (“db_get_mpc”) should be sufficient to determine the type of MPC and how this MPC should be translated. But, if more information is desired about the definition of this MPC type, use the following function.

PCL and CustomizationMulti-point Constraints

756

db_get_mpc_type_def ( <type_id>, <type_name>, <geom_flag>, <coord_flag>, <const_flag>, <const_label>, <sequen_flag>, <depend_coeff_flag>, <depend_dof_flag>, <max_depend_terms>, <min_depend_terms>, <dofs_per_depend>, <nodes_per_depend>, <indep_coeff_flag>, <indep_dof_flag>, <max_indep_terms>, <min_indep_terms>, <dofs_per_indep>, <nodes_per_indep> )

Input:

INTEGER <type_id> The ID of the MPC type of interest.

Output:

CHARACTER STRING

<type_name> The name of this MPC type.

LOGICAL <geom_flag> A flag specifying whether this MPC type references geometry or nodes:TRUE = references geometryFALSE = references nodes

LOGICAL <coord_flag> A flag specifying whether this MPC type references a coordinate frame or not:TRUE = references coordinate frameFALSE = does not reference frame

LOGICAL A flag specifying whether this MPC type has a constant term or not:TRUE = has constant termFALSE = does not have constant term

CHARACTER STRING

<const_label> The label to be used for the constant term

LOGICAL <sequen_flag> A flag specifying whether the order of term definition should be maintained or not:TRUE = maintain orderFALSE = ignore order

LOGICAL <depend_coeff_flag>

A flag specifying whether the dependent terms have multiplicative constants assigned to them or not:TRUE = have multiplicative constantsFALSE = do not have constants

LOGICAL <depend_dof_flag>

757Chapter 8: Accessing the Patran DatabaseMulti-point Constraints

A flag specifying whether the dependent terms have explicitly or implicitly specified degrees-of-freedom:TRUE = degrees-of-freedom explicitly definedFALSE = implicit degrees-of-freedom

INTEGER <max_depend_terms>

The maximum number of dependent terms allowed. Zero if there is no limit.

INTEGER <min_depend_terms>

The minimum number of dependent terms allowed.

INTEGER <dofs_per_depend>

The maximum number of degrees-of-freedom that can be associated with a dependent term.

INTEGER <nodes_per_depend>

The number of nodes to be associated with each dependent term. Zero if there is no definite number.

LOGICAL <indep_coeff_flag>

A flag specifying whether the independent terms have multiplicative constants assigned to them or not:TRUE = have multiplicative constantsFALSE = do not have constants

LOGICAL <indep_dof_flag>

A flag specifying whether the independent terms have explicitly or implicitly specified degrees-of-freedom:TRUE = degrees-of-freedom explicitly definedFALSE = implicit degrees-of-freedom

INTEGER <max_indep_terms>

The maximum number of independent terms allowed. Zero if there is no limit.

INTEGER <min_indep_terms>

The minimum number of independent terms allowed.

INTEGER <dofs_per_indep>

The maximum number of degrees-of-freedom that can be associated with an independent term.

INTEGER <nodes_per_indep>

PCL and CustomizationMulti-point Constraints

758

Notes:

The C name is DbGetMpcTypeDef.

int DbGetMpcTypeDef (type_id, type_name, geom_flag, coord_flag, const_flag, const_label,sequen_flag, depend_coeff_flag, depend_dof_flag, max_depend_terms, min_depend_terms, dofs_per_depend, nodes_per_depend, indep_coeff_flag, indep_dof_flag, max_indep_terms, min_indep_terms, dofs_per_indep, nodes_per_indep )int type_idchar type_name [ ]int *geom_flagint *coord_flagint *const_flagchar const_label [ ]int *sequen_flagint *depend_coeff_flagint *depend_dof_flagint *max_depend_termsint *min_depend_termsint *dofs_per_dependint *nodes_per_dependint *indep_coeff_flagint *indep_dof_flagint *max_indep_termsint *min_indep_termsint *dofs_per_indepint *nodes_per_indep

The IDs of all the sub MPCs belonging to the MPC entity is extracted by “get all”/”get next” functions. First, the “get all” function is called to prepare for the extraction of the sub MPC IDs. Then, the “get next” function is called until a non-zero status is returned signifying that all the sub MPC IDs have been received. The “get all” function is described below.

Notes:

The C name is DbGetAllSubMpc.

int DbGetAllSubMpc ( mpc_id )

The number of nodes to be associated with each independent term. Zero if there is no definite number.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

db_get_all_sub_mpc ( <mpc_id> )

Input:

INTEGER <mpc_id> The ID of the MPC entity of interest.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

759Chapter 8: Accessing the Patran DatabaseMulti-point Constraints

int mpc_id

The “get next” function for extracting sub MPC IDs is described below. This function should be called until a non-zero status is returned. The data received from the call that returned the non-zero status is meaningless (i.e., all data was extracted in the previous calls).

Notes:

The C name is DbGetNextSubMpc.

int DbGetNextSubMpc ( mpc_id, sub_mpc_id ) int mpc_id int *sub_mpc_id

The terms belonging to a sub MPC are extracted from the database using a “get all”/”get next” set of functions also. As mentioned above, first call the “get all” function to prepare for the exportation of the MPC term data. Then, call the “get next” function until a non-zero return status from the function is received (signifying that all the MPC term data has already been extracted). The “get all” function is described below:.

Notes:

The C name is DbGetAllMpcTerm.

int DbGetAllMpcTerm ( mpc_id, sub_mpc_id ) int mpc_id

db_get_next_sub_mpc ( <mpc_id>, <sub_mpc_id> )

Input:

INTEGER <mpc_id> The ID of the MPC entity of interest.

Output:

INTEGER <sub_mpc_id> The ID of one of the sub MPCs (multi-point constraint relations) belonging to the MPC entity specified by <mpc_id>.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

db_get_all_mpc_term ( <mpc_id>, <sub_mpc_id> )

Input:

INTEGER <mpc_id> The ID of the MPC entity of interest.

INTEGER <sub_mpc_id> The ID of the sub MPC (or multi-point constraint relation) of interest.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationMulti-point Constraints

760

int sub_mpc_id

The “get next” function for extracting MPC term data is described below. This function should be called until a non-zero status is returned. The data received from the call that returned the non-zero status is meaningless (i.e., all data was extracted in the previous calls).

761Chapter 8: Accessing the Patran DatabaseMulti-point Constraints

Notes:

The C name is DbGetNextMpcTerm.

int DbGetNextMpcTerm ( mpc_id, sub_mpc_id, max_num_nodes, max_num_dofs, mpc_term_id, depend_flag, term_coeff, node_ids, dof, num_nodes,

db_get_next_mpc_term ( <mpc_id>, <sub_mpc_id>, <max_num_nodes>, <max_num_dofs>, <mpc_term_id>, <depend_flag>, <term_coeff>, <node_ids>, <dofs>, <num_nodes>, <num_dofs> )

Input:

INTEGER <mpc_id> The ID of the MPC entity of interest.

INTEGER <sub_mpc_id> The ID of the sub MPC (or multi-point constraint relation) of interest.

INTEGER <max_num_nodes>

The maximum number of nodes that can be associated with this term. This value is obtained from “db_get_mpc”.

INTEGER <max_num_dofs>

The maximum number of degrees-of-freedom that can be associated with this term. This value is gotten from “db_get_mpc”.

Output:

INTEGER <mpc_term_id> The ID of this MPC term.

LOGICAL <depend_flag> A flag specifying whether the term is a dependent term of the MPC equation (TRUE) or an independent term (FALSE).

REAL <term_coeff> The coefficient specified for this MPC term.

INTEGER ARRAY

<node_ids> The IDs of all the nodes associated with this MPC term.

INTEGER ARRAY

<dofs> The IDs of all the degrees-of-freedom associated with this MPC term. For details about the meanings of these IDs, see db_create_degree_of_freedom. These degrees-of-freedom are applied to each of the nodes specified in <node_ids>. For example, three node IDs in <node_ids> and three degrees-of-freedom in <dofs> would result in nine equation terms.

INTEGER <num_nodes> The actual number of nodes associated with this MPC term.

INTEGER <num_dofs> The actual number of degrees-of-freedom associated with this MPC term.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationMulti-point Constraints

762

num_dofs ) int mpc_id int sub_mpc_id int max_num_nodes int max_num_dofs int *mpc_term_id int *depend_flag float *term_coeff int node_ids [ ] int dof [ ] int *num_nodes int *num_dofs

Importation of Multi-Point Constraint Data

There are three different techniques which to employee in assigning IDs to MPC entities. Assume that there will be no MPC ID conflict and simply add the MPC entities with the IDs they currently possess. Fetch the largest MPC ID which exists in the database and assign MPC IDs greater than this value. Lastly, query for MPC ID conflicts using the original ID if there is no conflict or using an ID greater than the largest existing MPC ID if there is a conflict. The function for querying for a MPC ID conflict is “db_mpc_exist.”

Notes:

The C name differs. It is DbFMpcExist.

int DbFMpcExist ( num_mpcs, mpc_id, exist ) int num_mpcs int *mpc_id int *exist

The function “db_get_max_mpc” is used to fetch the maximum MPC ID existent in the database.

db_mpc_exist ( <num_mpcs>, <mpc_ids>, <exist> )

Input:

INTEGER <num_mpcs> The number of MPC IDs to be checked.

INTEGER ARRAY

<mpc_ids> The <num_mpcs> MPC IDs to check.

Output:

INTEGER ARRAY

<exist> The <num_mpcs> flags specifying whether each MPC ID is already in use (1) or not (0).

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

763Chapter 8: Accessing the Patran DatabaseMulti-point Constraints

Notes:

The C name is DbGetMaxMpc.

int DbGetMaxMpc ( max_mpc_id )int *max_mpc_id

First define the MPC entity. This is accomplished with the following function.

Notes:

The C prototype for this function is:

int DbCreateMpcNodal ( int mpc_id, intmpc_type_id, int coord_id,

db_get_max_mpc ( <max_mpc_id> )

Output:

INTEGER <max_mpc_id> The maximum MPC ID currently existing in the database.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

db_create_mpc_nodal ( <mpc_id>, <mpc_type_id>, <coord_id>, <constant> )

Input:

INTEGER <mpc_id> The ID of the MPC entity as determined by one of the methods described above. This ID must be unique with respect to all other MPC entity IDs and must be greater than zero.

INTEGER <mpc_type_id> The ID of the MPC type. See db_create_mpc_type_def, 577 for details about this ID.

INTEGER <coord_id> The ID of the coordinate frame in which all the multi-point constraint relations of this MPC entity are expressed. Zero if the relations are in the global system or if the equations are interpreted in the nodal system of each node.

REAL <constant> The constant term for all the constraint relations of this MPC entity.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationMulti-point Constraints

764

doubleconstant, );

To assign sub MPCs (multi-point constraint relations) to the MPC entity created above, the following function is used.

Notes:

The C name is DbCreateSubMpc.

int DbCreateSubMpc ( mpc_id, sub_mpc_id ) int mpc_id int *sub_mpc_id

To assign the necessary MPC term data to the sub MPCs, use the function listed below.

db_create_sub_mpc ( <mpc_id>, <sub_mpc_id> )

Input:

INTEGER <mpc_id> The ID of the MPC entity to which a sub MPC is to be added.

Output:

INTEGER <sub_mpc_id> The ID assigned to the new sub MPC by Patran.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

765Chapter 8: Accessing the Patran DatabaseMulti-point Constraints

Notes:

The C prototype for this function is:

int DbCreateMpcTerm ( intmpc_id, intsub_mpc_id, intdepend_flag, intnum_nodes, intnum_dofs, doublecoefficient, int* node_ids, int* dof_ids, int* mpc_term_id );

db_create_mpc_term ( <mpc_id>, <sub_mpc_id>, <depend_flag>, <num_nodes>, <num_dofs>, <term_coeff>, <node_ids>,<dofs>,<mpc_term_id> )

Input:

INTEGER <mpc_id> The ID of the MPC entity as determined by one of the methods described above. This ID must be unique with respect to all other MPC entity IDs and must be greater than zero.

INTEGER <sub_mpc_id> The ID of the sub MPC to which the MPC term is to be added.

LOGICAL <depend_flag> A flag specifying whether this MPC term is a dependent term (TRUE) or an independent term (FALSE).

INTEGER <num_nodes> The number of nodes belonging to this MPC term.

INTEGER <num_dofs> The number of degrees-of-freedom belonging to this MPC term.

REAL <term_coeff> The coefficient assigned to this MPC term.

INTEGER ARRAY

<node_ids> The <num_nodes> IDs of all the nodes belonging to this MPC term.

INTEGER ARRAY

<dofs> The <num_dofs> IDs of all the degrees-of-freedom belonging to this MPC term. See db_create_degree_of_freedom, 469 for details about these IDs. These degrees-of-freedom affected each of the nodes listed in <node_ids>. For example, three nodes in <node_ids> and three degrees-of-freedom in <dofs> will result in nine equation terms.

Output:

INTEGER <mpc_term_id> The ID assigned to this MPC term by Patran.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationMulti-point Constraints

766

Lastly, add the newly created MPC to a group. The function “db_add_mpc_to_group” will accomplish this task.

Notes:

The C name is DbAddMpcToGroup.

int DbAddMpcToGroup ( mpc_id, group_id, visible ) int mpc_id int group_id int visible

db_add_mpc_to_group ( <mpc_id>, <group_id>, <visible> )

Input:

INTEGER <mpc_id> The ID of the MPC to be added to the specified group.

INTEGER <group_id> The internal ID of the group of interest. This ID can be determined by either “db_get_group_id” or “db_get_current_group_id” as described in Groups.

LOGICAL <visible> A flag specifying whether the MPC entity is visible (TRUE) or not (FALSE).

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

767Chapter 8: Accessing the Patran DatabaseImporting Results

Importing ResultsResults may be imported and stored in the Patran database for post- processing. The steps necessary to add results to the database are:

• Drop indexing on results data stored in the database to more efficiently add new results data.

• Find existing loadcase(s) or create a new one(s).

• Create subcase(s) for the loadcase(s) to which the results will be associated

• Create global variables (if needed) for result subcases.

• Associate related global variables.

• Create result types for each type of result (displacement, von Mises stress, strain tensor, etc.).

• Associate related result types.

• Create element position descriptions for each element location for results.

• Create section position descriptions for each result section position.

• Create layer position descriptions for each layer within each section position.

• Add results to the database as nodal or element based scalar, vector or tensor data.

• Associate global variables to subcases (e.g., Time, Load Increment).

• Re-create indexing on results data stored in the database and create results summary table.

Drop Results IndexingFor efficiency reasons, the indexing on results data should be dropped prior to adding new results to the database. The following function will drop results indices from the current database.

Notes:

The C name differs. It is DbFDropResIndex.

int DbFDropResIndex ()

If the indexing on results data is dropped prior to adding results data, these indices must be re-created after all new results data has been added. See the Re-create Results Indexing, 788.

db_drop_res_index ()

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationImporting Results

768

Create/Find LoadcasesThe first step in importing results is determining which load case to associate the results. If the user knows the name of the load case, he can determine whether it exists or not and, if it exists, its internal ID by using the db_get_load_case function described in Load Cases, 692. If the load case does not exist or, if for some other reason the user wants to create a new load to associate the results to, he can use the db_create_load_case function described in Load Cases (p. 692).

Create Result Subcases

To create a subcase for a set of results the following routine is used.

Notes:

The C name differs. It is DbFCreateSubCase.

int DbFCreateSubCase ( lcid,sctitle, scid, rcid )int lcidchar *sctitleint *scidint *rcid

Create Global Variables

Global variables are associated with result cases (db_create_subcase) to hold global data pertaining to all results stored within a result case. The most common global variables are time for transient analyses, frequency for modal analyses or load increment for non-linear static analyses. These are examples of common usages of global variables. Any real, complex or imaginary scalar, vector or tensor value may be stored as a global variable. The routine to create a global variable is as follows:

db_create_sub_case ( loadcase_id, sub_case_title, sub_case_id, result_case_id)

Description:

This function creates a sub and result case associated to a load case.

Input:

INTEGER load_case_id This value specifies the load case id value.

INTEGER sub_case_title[31] This value specifies the sub case title.

Output:

INTEGER sub_case_id This value returns the sub case id value.

INTEGER result_case_id This value returns the results case id value.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

769Chapter 8: Accessing the Patran DatabaseImporting Results

Notes:

The C name differs. It is DbFCreateGlobalVariables.

int DbFCreateGlobalVariables ( num, rcid, label, numform, csys_type, cid, code, gvid, values )int numint rcidchar *labelint *numformint *csys_type [num]int *cid [num]char *codeint *gvidfloat values [ ][6]

Note: For the current release, there is no means of determining the global variable type. Therefore, all global variables are assumed to be scalar values

dbt_create_global_variables ( num, rcid, label, numform, csys_type, cid, code, gvid, values )

Input:

INTEGER num ALWAYS assign num=1.

INTEGER rcid Existing result case ID.

STRING label[] Label for the global variable. This is used to match with other global variables assigned to other result cases.

INTEGER numform Integer code for the numeric form of the data where 1-Real, 2=Imaginary, 3-Complex Magnitude, 4=Complex Phase, 6=Complex Real, 7=Complex Angle.

INTEGER csys_type(num) An array of coordinate system types where: -1=Unknown, 0=Global, 1=Nodal, 2=Element, 3=User, 4=Material, 5=Ply, 6=On Edge, 7=On Curve, 8=Data Dependent.

INTEGER cid(num) Existing coordinate frame ID (csys_type=3).

STRING code[] A label descriptor for the analysis code name.

REAL values(6) An array of real values (only the first used at this time).

Output:

INTEGER gvid Database ID pointer to the global variable entity.

INTEGER Return Value This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationImporting Results

770

Associate Global VariablesIf global variables contain complex or imaginary values, a pair of global variable entities must be created for each value (real/imaginary or magnitude/phase). Once the pair of variables is created they must be associated using the following routine.

Notes:

The C name differs. It is DbFAssocGlobalVariables.

int DbFAssocGlobalVariables ( num, rcid, list1, list2 )int numint rcidint *list1int *list2

Create Result TypesResult types are created for each type of result to be imported. Result types are not unique to each result case. The same result type ID may be used in many result cases. If results have both contain components with differing numerical forms (real, imaginary...) then multiple result types using the same labels must be created. The following routine is used to create result types.

dbt_assoc_global_variables ( <num>, <rcid>, <label>, <numform>, <csys_type>, <cid>, <code>, <gvid>, <values> )

Input:

INTEGER <num> Number of global variable pairs to associate.

INTEGER <rcid> Result case to which these variables belong.

INTEGER ARRAY

<list1> (num) global variable IDs to be associated with list2.

INTEGER ARRAY

<list2> (num) global variable IDs to be associated with list1.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

771Chapter 8: Accessing the Patran DatabaseImporting Results

Notes:

The C name differs. It is DbFCreateResTypes.

int DbFCreateResTypes ( num, pri_label, sec_label, datatype, numform, from_code, units, rtid )int numchar *pri_label char *sec_labelint *datatypeint *numformchar from_code [ ]int *unitsint *rtid

Associate Result Types

If result types contain complex or imaginary values, a pair of result type entities must be created for each value (real/imaginary or magnitude/phase). Once the pair of result types is created they must be associated using the following routine.

dbt_create_res_types ( <num>, <pri_label>, <sec_label>, <datatype>, <numform>, <from_code>, <units>, <rtid> )

Input:

INTEGER <num> Number of global variable pairs to associate.

CHARACTER STRING

<pri_label> Primary label result descriptor.

CHARACTER STRING

<sec_label> Secondary label result descriptor.

INTEGER <datatype> Integer code for the result datatype where 0=Unknown, 1=Scalar, 2=Vector, 3=Tensor

INTEGER <numform> Integer code for the numeric form of the data where 1-Real, 2=Imaginary, 3-Complex Magnitude, 4=Complex Phase, 6=Complex Real, 7=Complex Angle.

CHARACTER STRING

<from_code> Analysis code from which results were derived.

INTEGER <units> Assign units=0. NOT USED.

Output:

INTEGER <rtid> Database ID pointer for the result type created.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationImporting Results

772

Notes:

The C name differs. It is DbFAssocResTypes.

int DbFAssocResTypes ( num, list1, list2 )int numint *list1int *list2

Create Element Positions

Element position descriptions are required for element based results. A unique element position entity must be created for each position within an each element type where results are defined. The coordinates entered are used to locate the results at nodes, centroids or Gauss points in a generic way. The following routine is used to create element position entities.

dbt_assoc_res_types ( <num>, <pri_label>, <sec_label>, <datatype>, <numform>, <from_code>, <units>, <rtid> )

Input:

INTEGER <num> Number of result type pairs to associate.

INTEGER ARRAY

<list1> (num) result type IDs to be associated with list2.

INTEGER ARRAY

<list2> (num) result type IDs to be associated with list1.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

773Chapter 8: Accessing the Patran DatabaseImporting Results

Notes:

None.

Some of the element position definitions used in the Patran MSC Nastran interface are given below as an illustration. Alternatively, the user can define all his element positions using the parametric coordinate system for all element types. For more details about element coordinate systems, refer to the Patran element library.

dbt_create_elem_positions ( <num>, <ctype>, <coords>, <epid> )

Input:

INTEGER <num> Number of result type pairs to associate.

INTEGER <ctype> Flay specifying which coordinate system is used to express the postion within the element. 0 = unknown cordinate system. [0, 0, 0, 0].1 = parametic coordinate system standardly used for line elemnts, quadrilateral surface elements and hexahedral solid elements. [c1, 0, 0, 0], [c1, c2, 0, 0], or [c1, c2, c3, 0].2 = area coordinate system standardly used for triangular surface elements. [c1, c2, c3, 0].3 = volume coordinate system standardly used for tetrahedral and pentahedral solid elements. The difinition of this sytem differs depending upon the element type being referenced. For tetrahedral solid elements, the standard volume coordinate system is used. For pentahedral solid elements a hybrid between the area coordinate system and the parametric system is used. The first three values are area coordinates of the postion within the local XY plane of the element. The fourth value is the parametric value of Z. [c1, c2, c3, c4].

REAL ARRAY

<coords>(4) The coordinates of the position within the element in the coordinate system specified by <ctype>. Always an array of four values. Use zeroes for any array positions which have no meaning.

Output:

INTEGER <epid> The internal ID assigned to the newly created element position.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationImporting Results

774

position coord. type c1 c2 c3 c4

Line element

center 1 0.5 0.0 0.0 0.0

node 1 1 0.0 0.0 0.0 0.0

node 2 1 1.0 0.0 0.0 0.0

Triangular Surface element

center 2 0.333 0.333 0.333 0.0

node 1 2 1.0 0.0 0.0 0.0

node 2 2 0.0 1.0 0.0 0.0

node 3 2 0.0 0.0 1.0 0.0

Quadrilateral Surface element

center 1 0.5 0.5 0.0 0.0

node 1 1 0.0 0.0 0.0 0.0

node 2 1 1.0 0.0 0.0 0.0

node 3 1 1.0 1.0 0.0 0.0

node 4 1 0.0 1.0 0.0 0.0

Tetrahedral Solid element

center 3 0.25 0.25 0.25 0.25

node 1 3 1.0 0.0 0.0 0.0

node 2 3 0.0 1.0 0.0 0.0

node 3 3 0.0 0.0 1.0 0.0

node 4 3 0.0 0.0 0.0 1.0

Pentahedral Solid element

center 3 0.333 0.333 0.333 0.5

node 1 3 1.0 0.0 0.0 0.0

node 2 3 0.0 1.0 0.0 0.0

node 3 3 0.0 0.0 1.0 0.0

node 4 3 1.0 0.0 0.0 1.0

node 5 3 0.0 1.0 0.0 1.0

node 6 3 0.0 0.0 1.0 1.0

Hexahedral Solid element

center 1 0.5 0.5 0.5 0.0

node 1 1 0.0 0.0 0.0 0.0

node 2 1 1.0 0.0 0.0 0.0

775Chapter 8: Accessing the Patran DatabaseImporting Results

int DbFCreateElemPositions ( num, ctype, coords, epid )int numint ctypefloat coords [ ][4]int *epid

Create Section Positions

At least one section position entity is needed for loading results. Multiple section positions may be created with unique labels to segregate multiple results of the same type defined at a give node or element position. If the results are not defined at multiple section positions, a section position with a blank label should be defined. The routine to create section positions is defined as follows:

Notes:

node 3 1 1.0 1.0 0.0 0.0

node 4 1 0.0 1.0 0.0 0.0

node 5 1 0.0 0.0 1.0 0.0

node 6 1 1.0 0.0 1.0 0.0

node 7 1 1.0 1.0 1.0 0.0

node 8 1 0.0 1.0 1.0 0.0

Note: The C name differs. It is DbFCreateElemPositions.

dbt_create_sect_pos ( <num>, <label>, <ctype>, <coords>, <secid> )

Input:

INTEGER <num> ALWAYS assign num=1.

CHARACTER STRING

<label> Label for the section position which may be blank if the results are not section based.

INTEGER <ctype> NOT USED, assign ctype=0.

REAL ARRAY

<coords> NOT USED.

Output:

INTEGER <secid> Integer Database ID pointer to the section position entity created.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationImporting Results

776

The C name differs. It is DbFCreateSectPos.

int DbFCreateSectPos ( num, label, ctype, coords, secid )int numchar *labelint *ctypefloat coords [ ][2]int *secid

Create Layers

At least one layer entity is needed for each section position. Multiple layers with unique composite layer IDs may be created for each section position.The routine to create layers is defined as follows:

Notes:

The C name differs. It is DbFCreateLayers .

int DbFCreateLayers ( num, comp_id, secid, layerid )int numint *comp_idint *secidint *layerid

Add Nodal Results

Nodal results are added using any of six routines. These routines will add scalar, vector or tensor results either by constant result type or by constant layer. These routines require an existing result case (db_create_subcase), an existing or set of existing result types (dbt_create_res_types), and an existing or set of existing layers (dbt_create_layers). The following routine is used to add a nodal scalar result for a set of nodes using a constant result type ID.

dbt_create_layers ( <num>, <comp_id>, <secid>, <layerid> )

Input:

INTEGER <num> ALWAYS assign num=1.

INTEGER <comp_id> Composite layer ID. May be 0 if there is no layered data.

INTEGER <secid> Database ID of an existing section position entity to which this layer is assigned.

Output:

INTEGER <layerid> Integer Database ID pointer to the layer entity created.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

777Chapter 8: Accessing the Patran DatabaseImporting Results

Notes:

The C name differs. It is DbFAddSNodResByType.

int DbFAddSNodResByType ( num, rtid, rcid, layerids, nids, results )int numint rtidint rcidint *layeridsint *nidsfloat *results

The following routine is used to add a nodal scalar result for a set of nodes using a constant layer ID.

db_add_s_nod_res_by_type ( <num>, <rtid>, <rcid>, <layerids>, <nids>, <results> )

Input:

INTEGER <num> Number of nodes/results input.

INTEGER <rtid> Existing result type ID.

INTEGER <rcid> Existing result case ID.

INTEGER ARRAY

<layerids> (num) sized array of layer ID for the result at each node.

INTEGER ARRAY

<nids> (num) sized array of node IDs.

REAL ARRAY

<results> (num) sized array of scalar results at each node/layer.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationImporting Results

778

Notes:

Not Callable from C.

The following routine is used to add a nodal vector result for a set of nodes using a constant result type ID.

db_add_s_nod_res_by_pos ( <num>, <rtids>, <rcid>, <layerid>, <nids>, <results> )

Input:

INTEGER <num> Number of nodes/results input.

INTEGER ARRAY

<rtids> (num) sized array of existing result type IDs.

INTEGER <rcid> Existing result case ID.

INTEGER <layerids> Existing layer ID.

INTEGER ARRAY

<nids> (num) sized array of node IDs.

REAL ARRAY

<results> (num) sized array of scalar results at each node/result type.

Output:

INTEGER <Return Value>

This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

779Chapter 8: Accessing the Patran DatabaseImporting Results

Notes:

The C name differs. It is DbFAddVNodResByType.

int DbFAddVNodResByType ( num, rtid, rcid, layerids, nids, csys_type, cid, results )int numint rtidint rcidint *layeridsint *nidsint *csys_typeint *cidfloat results [ ][3]

The following routine is used to add a nodal vector result for a set of nodes using a constant layer ID.

db_add_v_nod_res_by_type ( <num>, <rtid>, <rcid>, <layerids>, <nids>, <csys_type>, <cid>, <results> )

Input:

INTEGER <num> Number of nodes/results input.

INTEGER <rtid> Existing result type ID.

INTEGER <rcid> Existing result case ID.

INTEGER ARRAY

<layerids> (num) sized array of layer ID for the result at each node.

INTEGER ARRAY

<nids> (num) sized array of node IDs.

INTEGER ARRAY

<csys_type> (num) sized array of coordinate system types where: -1=Unknown, 0=Global, 1=Nodal, 2=Element, 3=User, 4=Material, 5=Ply, 6=On Edge, 7=On Curve, 8=Data Dependent.

INTEGER ARRAY

<cid> (num) sized array of CIDs (csys_type=3).

REAL ARRAY

<results> (num,3) sized array of vector results at each node/layer.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationImporting Results

780

Notes:

Not Callable from C.

The following routine is used to add a nodal tensor result for a set of nodes using a constant result type ID.

db_add_v_nod_res_by_pos ( <num>, <rtids>, <rcid>, <layerid>, <nids>, <csys_type>, <cid>, <results> )

Input:

INTEGER <num> Number of nodes/results input.

INTEGER ARRAY

<rtids> (num) sized array of existing result type IDs.

INTEGER <rcid> Existing result case ID.

INTEGER <layerid> Existing layer ID.

INTEGER ARRAY

<nids> (num) sized array of node IDs.

INTEGER ARRAY

<csys_type> (num) sized array of coordinate system types where -1=Unknown, 0=Global, 1=Nodal, 2=Element, 3=User, 4=Material, 5=Ply, 6=On Edge, 7=On Curve, 8=Data Dependent.

INTEGER ARRAY

<cid> (num) sized array of CIDs (csys_type=3).

REAL ARRAY

<results> (num,3) sized array of vector results at each node/result type.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

db_add_t_nod_res_by_type ( <num>, <rtid>, <rcid>, <layerids>, <nids>, <csys_type>, <cid>, <results> )

781Chapter 8: Accessing the Patran DatabaseImporting Results

Notes:

The C name differs. It is DbFAddTNodResByType.

int DbFAddTNodResByType ( num, rtid, rcid, layerids, nids, csys_type, cid, results )int numint rtidint rcidint *layeridsint *nidsint *csys_typeint *cidfloat results [ ][6]

The following routine is used to add a nodal tensor result for a set of nodes using a constant layer ID.

Input:

INTEGER <num> Number of nodes/results input.

INTEGER <rtid> Existing result type ID.

INTEGER <rcid> Existing result case ID.

INTEGER ARRAY

<layerids> (num) sized array of layer ID for the result at each node.

INTEGER ARRAY

<nids> (num) sized array of node IDs.

INTEGER ARRAY

<csys_type> (num) sized array of coordinate system types where: -1=Unknown, 0=Global, 1=Nodal, 2=Element, 3=User, 4=Material, 5=Ply, 6=On Edge, 7=On Curve, 8=Data Dependent.

INTEGER ARRAY

<cid> (num) sized array of CIDs (csys_type=3).

REAL ARRAY

<results> (num,6) sized array of tensor results at each node/layer.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationImporting Results

782

Notes:

Not Callable from C.

Add Element Results

Element based results are added using any of six routines. These routines will add scalar, vector or tensor results either by constant result type or by constant layer. These routines require an existing result case (db_create_subcase), an existing or set of existing result types (dbt_create_res_types), an existing or set of existing element position entities for each result location within each element type (dbt_create_elem_positions), and an existing or set of existing layers (dbt_create_layers). The following routine is used to add an element scalar result for a set of elements using a constant result type ID.

db_add_t_nod_res_by_pos ( <num>, <rtids>, <rcid>, <layerid>, <nids>, <csys_type>, <cid>, <results> )

Input:

INTEGER <num> Number of nodes/results input.

INTEGER ARRAY

<rtids> (num) sized array of existing result type IDs.

INTEGER <rcid> Existing result case ID.

INTEGER <layerid> Existing layer ID.

INTEGER ARRAY

<nids> (num) sized array of node IDs.

INTEGER ARRAY

<csys_type> (num) sized array of coordinate system types where -1=Unknown, 0=Global, 1=Nodal, 2=Element, 3=User, 4=Material, 5=Ply, 6=On Edge, 7=On Curve, 8=Data Dependent.

INTEGER ARRAY

<cid> (num) sized array of CIDs (csys_type=3).

REAL ARRAY

<results> (num,6) sized array of tensor results at each node/result type.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

783Chapter 8: Accessing the Patran DatabaseImporting Results

Notes:

The C name differs. It is DbFAddSElemResByType.

int DbFAddSElemResByType ( num, rtid, rcid, epids, layerids, elids, results )int numint rtidint rcidint *epidsint *layeridsint *elidsfloat *results

The following routine is used to add an element scalar result for a set of elements using a constant layer ID/element position ID.

db_add_s_elem_res_by_type (<num>, <rtid>, <rcid>, <epids>, <layerids>, <elids>, <results> )

Input:

INTEGER <num> Number of elements/results input.

INTEGER <rtid> Existing result type ID.

INTEGER <rcid> Existing result case ID.

INTEGER ARRAY

<epids> (num) array of element position IDs for each element.

INTEGER ARRAY

<layerids> (num) sized array of layer ID for the result at each element position.

INTEGER ARRAY

<elids> (num) sized array of element IDs.

REAL ARRAY

<results> (num) sized array of scalar results at each element/layer position.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationImporting Results

784

Notes:

Not Callable from C.

The following routine is used to add an element vector result for a set of elements using a constant result type ID.

db_add_s_elem_res_by_pos ( <num>, <rtids>, <rcid>, <epid>, <layerid>, <elid>, <results> )

Input:

INTEGER <num> Number of results for a given element input.

INTEGER ARRAY

<rtids>(num) Sized array of existing result type IDs.

INTEGER <rcid> The result case id to be associated with each of the values.

INTEGER <epid> Existing element position ID.

INTEGER <layerid> Existing layer ID.

INTEGER <elid> Existing element ID.

REAL ARRAY

<results>(num) Sized array of scalar results at each element per result type.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

785Chapter 8: Accessing the Patran DatabaseImporting Results

Notes:

The C name differs. It is DbFAddVElemResByType.

int DbFAddVElemResByType ( num, rtid, rcid, epids, layerids, elids, csys_type, cid, results )int numint rtidint rcidint *epidsint *layeridsint *elidsint *csys_typeint *cidfloat results [ ][3]

db_add_v_elem_res_by_type ( <num>, <rtid>, <rcid>, <epids>, <layerids>, <elids>, <csys_type>, <cid>, <results> )

Input:

INTEGER <num> Number of elements/results input.

INTEGER <rtid> Existing result type ID.

INTEGER <rcid> Existing result case ID.

INTEGER ARRAY

<epids> (num) array of element position IDs for each element.

INTEGER ARRAY

<layerids> (num) sized array of layer ID for the result at each element.

INTEGER ARRAY

<elids> (num) sized array of element IDs.

INTEGER ARRAY

<csys_type> (num) sized array of coordinate system types where: -1=Unknown, 0=Global, 1=Nodal, 2=Element, 3=User, 4=Material, 5=Ply, 6=On Edge, 7=On Curve, 8=Data Dependent.

INTEGER ARRAY

<cid> (num) sized array of cids (csys_type=3).

REAL ARRAY

<results> (num,3) sized array of vector results at each element/layer position.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationImporting Results

786

The following routine is used to add an element vector result for a set of elements using a constant layer ID/element position ID.

Notes:

Not Callable from C.

The following routine is used to add an element tensor result for a set of elements using a constant result type ID.

db_add_v_elem_res_by_pos ( <num>, <rtids>, <rcid>, <epid>, <layerid>, <elids>, <csys_type>, <cid>, <results> )

Input:

INTEGER <num> Number of elements/results input.

INTEGER ARRAY

<rtids> (num) sized array of existing result type IDs.

INTEGER <rcid> Existing result case ID.

INTEGER <epid> Existing element position ID.

INTEGER <layerids> Existing layer ID.

INTEGER ARRAY

<elids> (num) sized array of element IDs.

INTEGER ARRAY

<csys_type> (num) sized array of coordinate system types where: -1=Unknown, 0=Global, 1=Nodal, 2=Element, 3=User, 4=Material, 5=Ply, 6=On Edge, 7=On Curve, 8=Data Dependent.

INTEGER ARRAY

<cid> (num) sized array of CIDs (csys_type=3).

REAL ARRAY

<results> (num,3) sized array of vector results at each element/result type.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

787Chapter 8: Accessing the Patran DatabaseImporting Results

Notes:

The C name differs. It is DbFAddTElemResByType.

int DbFAddTElemResByType ( num, rtid, rcid, epids, layerids, elids, csys_type, cid, results )int numint rtidint rcidint *epidsint *layeridsint *elidsint *csys_typeint *cidfloat results [ ][6]

The following routine is used to add an element tensor result for a set of elements using a constant layer ID.

db_add_t_elem_res_by_type ( <num>, <rtid>, <rcid>, <epids>, <layerids>, <elids>, <csys_type>, <cid>, <results> )

Input:

INTEGER <num> Number of elements/results input.

INTEGER <rtid> Existing result type ID.

INTEGER <rcid> Existing result case ID.

INTEGER ARRAY

<epids> (num) array of element position IDs for each element.

INTEGER ARRAY

<layerids> (num) sized array of layer ID for the result at each element.

INTEGER ARRAY

<elids> (num) sized array of element IDs.

INTEGER ARRAY

<csys_type> (num) sized array of coordinate system types where: -1=Unknown, 0=Global, 1=Nodal, 2=Element, 3=User, 4=Material, 5=Ply, 6=On Edge, 7=On Curve, 8=Data Dependent.

INTEGER ARRAY

<cid> (num) sized array of CIDs (csys_type=3).

REAL ARRAY

<results> (num,6) sized array of tensor results at each element/layer position.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationImporting Results

788

Notes:

Not Callable from C.

Re-create Results Indexing

Once all the results have been added, the indexing on results data must be re-created. The following function performs this task. This function also creates a results summary table used within Patran. Even if the indexing on results was never dropped, this function should still be called so that the results summary table gets updated.

db_add_t_elem_res_by_pos ( <num>, <rtids>, <rcid>, <epid>, <layerid>, <elids>, <csys_type>, <cid>, <results> )

Input:

INTEGER <num> Number of elements/results input.

INTEGER ARRAY

<rtids> (num) sized array of existing result type IDs.

INTEGER <rcid> Existing result case ID.

INTEGER <epid> Existing element position ID.

INTEGER <layerid> Existing layer ID.

INTEGER ARRAY

<elids> (num) sized array of element IDs.

INTEGER ARRAY

<csys_type> (num) sized array of coordinate system types where: -1=Unknown, 0=Global, 1=Nodal, 2=Element, 3=User, 4=Material, 5=Ply, 6=On Edge, 7=On Curve, 8=Data Dependent.

INTEGER ARRAY

<cid> (num) sized array of CIDs (csys_type=3).

REAL ARRAY

<results> (num,6) sized array of tensor results at each element/result type.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

db_post_results_load ()

789Chapter 8: Accessing the Patran DatabaseImporting Results

Notes:

The C name differs. It is DbFPostResultsLoad.

int DbFPostResultsLoad ()

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationExamples of Translation

790

Examples of TranslationThe following PCL programs are examples of how to extract data from or add data to a Patran database.

Results ReaderThe following PCL program shows an example of how to import results into the database from an external source. This example creates a simple form for user inputs. The “Apply” button will initiate the results loading. This example shows how to read from an ASCII formatted PATRAN 2.5 nodal results file as the external source. (Capabilities for reading PATRAN 2.5 results are provided in Patran using File->Import->Results). The source for this example can be found in the $P3_HOME/customization directory under the name “result_reader.pcl.”

/*$$ Results Reader Example PCL Form * * Purpose: * Show an example of a Reading Results into P3 * * Input: * <None> * * Output: * <None> * * Log: * * Notes: * */ #include “appforms.p” CLASS result_reader CLASSWIDE WIDGET column_dbx, lc_label_dbx, lc_desc_dbx, res_label_dbx, @ res_desc_dbx, res_type_sw, num_type_sw, @ file_dbx, file_type_sw /*$$ FUNCTION * * Purpose: * Initialize the Results Reader form. * * Input: * <None> * * Output: * <None> * * Log: * * * Notes: * * */ FUNCTION init # include “uistrings.p” WIDGET form_id, @ apply_button, @ cancel_button, wid_id REAL unframed_l_margin, @ form_wid_med, @ inter_widget_space, @ y_loc /*

791Chapter 8: Accessing the Patran DatabaseExamples of Translation

* Initialize constants */ unframed_l_margin = UNFRAMED_L_MARGIN form_wid_med = FORM_WID_MED inter_widget_space = INTER_WIDGET_SPACE /* * Create the form */ form_id = ui_form_create( @ /* callback */ “”, @ /* x */ FORM_X_LOC_MED_NX2_SML, @ /* y */ FORM_Y_LOC, @ /* position */ “UL”, @ /* width */ form_wid_med, @ /* height */ 0.0, @ /* label */ “Example Results Reader”, @ /* iconname */ “” ) y_loc = FORM_T_MARGIN /* * Create the “Result file” databox */ file_dbx = ui_databox_create( @ /* parent */ form_id, @ /* callback */ “”, @ /* x */ unframed_l_margin, @ /* y */ y_loc, @ /* label_length */ 0.0, @ /* box_length */ DBOX_WID_DOUBLE, @ /* label */ “Results File”, @ /* value */ “ ”, @ /* label_above */ TRUE, @ /* datatype */ “STRING”, @ /* num_vals */ 1 ) y_loc += DBOX_HGT_LABOVE + inter_widget_space /* * Create the “File Type” switch */ file_type_sw = ui_switch_create( @ /* parent */ form_id, @ /* callback */ “”, @ /* x */ unframed_l_margin, @ /* y */ y_loc, @ /* num_columns */ 2, @ /* label */ “File Type”, @ /* always_one */ TRUE ) wid_id = ui_item_create( file_type_sw, “1”, “Nodal(.nod)”, FALSE ) ui_wid_set( wid_id, “VALUE”, TRUE ) ui_item_create( file_type_sw, “2”, “Element(.els)”, FALSE ) y_loc += SWITCH_1R_HGT_LABEL + inter_widget_space /* * Create the “Load Case Label” databox */ lc_label_dbx = ui_databox_create( @ /* parent */ form_id, @ /* callback */ “”, @ /* x */ unframed_l_margin, @ /* y */ y_loc, @ /* label_length */ 0.0, @ /* box_length */ DBOX_WID_DOUBLE, @ /* label */ “Load Case Label”, @ /* value */ “ ”, @ /* label_above */ TRUE, @ /* datatype */ “STRING”, @ /* num_vals */ 1 ) y_loc += DBOX_HGT_LABOVE + inter_widget_space /* * Create the “Load Case Description” databox */

PCL and CustomizationExamples of Translation

792

lc_desc_dbx = ui_databox_create( @ /* parent */ form_id, @ /* callback */ “”, @ /* x */ unframed_l_margin, @ /* y */ y_loc, @ /* label_length */ 0.0, @ /* box_length */ DBOX_WID_DOUBLE, @ /* label */ “Load Case Description”, @ /* value */ “ ”, @ /* label_above */ TRUE, @ /* datatype */ “STRING”, @ /* num_vals */ 1 ) y_loc += DBOX_HGT_LABOVE + inter_widget_space /* * Create the “Result Label” databox */ res_label_dbx = ui_databox_create( @ /* parent */ form_id, @ /* callback */ “”, @ /* x */ unframed_l_margin, @ /* y */ y_loc, @ /* label_length */ 0.0, @ /* box_length */ DBOX_WID_DOUBLE, @ /* label */ “Result Label”, @ /* value */ “ ”, @ /* label_above */ TRUE, @ /* datatype */ “STRING”, @ /* num_vals */ 1 ) y_loc += DBOX_HGT_LABOVE + inter_widget_space /* * Create the “Result description” databox */ res_desc_dbx = ui_databox_create( @ /* parent */ form_id, @ /* callback */ “”, @ /* x */ unframed_l_margin, @ /* y */ y_loc, @ /* label_length */ 0.0, @ /* box_length */ DBOX_WID_DOUBLE, @ /* label */ “Result Description”, @ /* value */ “ ”, @ /* label_above */ TRUE, @ /* datatype */ “STRING”, @ /* num_vals */ 1 ) y_loc += DBOX_HGT_LABOVE + inter_widget_space /* * Create the “Result Type” switch */ res_type_sw = ui_switch_create( @ /* parent */ form_id, @ /* callback */ “”, @ /* x */ unframed_l_margin, @ /* y */ y_loc, @ /* num_columns */ 3, @ /* label */ “Result Type”, @ /* always_one */ TRUE ) wid_id = ui_item_create( res_type_sw, “1”, “Scalar”, FALSE ) ui_wid_set( wid_id, “VALUE”, TRUE ) ui_item_create( res_type_sw, “2”, “Vector”, FALSE ) ui_item_create( res_type_sw, “3”, “Tensor”, FALSE ) y_loc += SWITCH_2R_HGT_LABEL + inter_widget_space /* * Create the “Numeric Type “ switch */ num_type_sw = ui_switch_create( @ /* parent */ form_id, @ /* callback */ “”, @ /* x */ unframed_l_margin, @

793Chapter 8: Accessing the Patran DatabaseExamples of Translation

/* y */ y_loc, @ /* num_columns */ 3, @ /* label */ “Numeric Type”, @ /* always_one */ TRUE ) wid_id = ui_item_create( num_type_sw, “1”, “Real”, FALSE ) ui_wid_set( wid_id, “VALUE”, TRUE ) ui_item_create( num_type_sw, “2”, “Imaginary”, FALSE ) ui_item_create( num_type_sw, “3”, “Complex Mag.”, FALSE ) ui_item_create( num_type_sw, “4”, “Complex Phase”, FALSE ) y_loc += SWITCH_2R_HGT_LABEL + inter_widget_space /* * Create the “Result Columns” databox */ column_dbx = ui_databox_create( @ /* parent */ form_id, @ /* callback */ “”, @ /* x */ unframed_l_margin, @ /* y */ y_loc, @ /* label_length */ 0.0, @ /* box_length */ DBOX_WID_DOUBLE, @ /* label */ “Result Column(s)”, @ /* value */ “ ”, @ /* label_above */ TRUE, @ /* datatype */ “STRING”, @ /* num_vals */ 1 ) y_loc += DBOX_HGT_LABOVE + inter_widget_space ui_separator_create( @ /* parent */ form_id, @ /* callback */ “”, @ /* x */ 0.0, @ /* y */ y_loc, @ /* length */ form_wid_med, @ /* horizontal */ TRUE ) y_loc += LINE_THICKNESS + inter_widget_space /* * Create the “Apply” button */ apply_button = ui_button_create( @ /* parent */ form_id, @ /* callback */ “apply_cb”, @ /* x */ BUTTON_HALF_X_LOC1, @ /* y */ y_loc, @ /* width */ BUTTON_WID_HALF, @ /* height */ 0.0, @ /* label */ APPLY_UD, @ /* labelinside */ TRUE, @ /* highlight */ TRUE ) /* * Create the “Cancel” button */ cancel_button = ui_button_create( @ /* parent */ form_id, @ /* callback */ “cancel_cb”, @ /* x */ BUTTON_HALF_X_LOC2, @ /* y */ y_loc, @ /* width */ BUTTON_WID_HALF, @ /* height */ 0.0, @ /* label */ CANCEL, @ /* labelinside */ TRUE, @ /* highlight */ FALSE ) y_loc += BUTTON_DEFAULT_HGT + FORM_B_MARGIN /* * Adjust form height */ ui_wid_set( form_id, “HEIGHT”, y_loc ) END FUNCTION /* init */ /*$$ FUNCTION *

PCL and CustomizationExamples of Translation

794

* Purpose: * Display the Example Results Reader form. * * Input: * <None> * * Output: * <None> * * Log: * * * Notes: * * */ FUNCTION display /* * Display the form */ ui_form_display( “result_reader” ) END FUNCTION /* display */ /*$$ FUNCTION * * Purpose: * * * Input: * <None> * * Output: * <None> * * Log: * * * Notes: * * */ FUNCTION apply_cb INTEGER cols(6), ncols, restype, numtype, i STRING file_name[VIRTUAL], lc_label[VIRTUAL], lc_desc[VIRTUAL], @ res_label[VIRTUAL], res_desc[VIRTUAL], res_type[1], @ file_type[1], num_type[1], column_str[VIRTUAL] /* obtain the filename and type from the databox widgets */ ui_wid_get_vstring(file_dbx,“VALUE”,file_name) file_name = str_strip_lead(file_name) ui_wid_get( file_type_sw, “VALUE”, file_type ) /* Get the loadcase labels from the databoxes */ ui_wid_get_vstring( lc_label_dbx, “VALUE”, lc_label ) lc_label = str_strip_lead(lc_label) ui_wid_get_vstring( lc_desc_dbx, “VALUE”, lc_desc ) lc_desc =str_strip_lead(lc_desc) /* Get the Result labels */ ui_wid_get_vstring( res_label_dbx, “VALUE”, res_label ) res_desc = str_strip_lead(res_label) ui_wid_get_vstring( res_desc_dbx, “VALUE”, res_desc ) res_desc = str_strip_lead(res_desc) /* Get the result type and numeric type */ ui_wid_get( res_type_sw, “VALUE”, res_type ) restype = str_to_integer( res_type ) ui_wid_get( num_type_sw, “VALUE”, num_type ) numtype = str_to_integer( num_type ) /* Get the string containing the column numbers from the databox */ ui_wid_get_vstring( column_dbx, “VALUE”, column_str ) column_str = str_strip_lead(column_str) /* extract the column integers from the string */

795Chapter 8: Accessing the Patran DatabaseExamples of Translation

SWITCH ( restype ) CASE( 1 ) /* scalar */ cols(1) = str_to_integer(column_str) ncols = 1 CASE( 2 ) /* vector */ FOR( i=1 TO 3 ) cols(i) = str_to_integer( str_token( column_str, “ ”, i ) ) END FOR ncols = 3 CASE( 3 ) /* tensor */ FOR( i=1 TO 6 ) cols(i) = str_to_integer( str_token( column_str, “ ”, i ) ) END FOR ncols = 6 END SWITCH /* Read in the results and load to the Db */ IF( file_type == “1” ) THEN /* nodal results */ result_reader.input_nodal_result( file_name, lc_label, lc_desc, @ res_label, res_desc, restype, numtype, ncols, cols ) ELSE xf_error_start( “Not yet implemented... Stay tuned” ) xf_error_end() END IF END FUNCTION /* apply_cb */ /*$$ FUNCTION * * Purpose: * * * Input: * <None> * * Output: * <None> * * Log: * * * Notes: * * */ FUNCTION cancel_cb /* * End form and ignore changes. */ ui_form_hide( “results_reader” ) END FUNCTION /* cancel_cb */ FUNCTION input_nodal_result( file_name, lc_label, lc_desc, res_label, @ res_desc, restype, numtype, ncols, cols ) INTEGER chan, lcid, rcid, scid, rtid, secid, lyid, i, cols(), @ ncols, restype, numtype, len, fil_attrs(4), nids(VIRTUAL), @ lyids(VIRTUAL), j, c_types(VIRTUAL), cids(VIRTUAL) REAL maxval(1), col_vals(VIRTUAL), res_vals(VIRTUAL) STRING file_name[], lc_label[], lc_desc[], res_label[], res_desc[], @ title[80], chars[1](1), line[80], col_format[15] /* test for the existance of the file with a version extension */ IF( ! file_exists( file_name, “V”) ) THEN xf_error_start( “File does not exist” ) xf_error_end() RETURN( 1 ) END IF /* Open the text results file */ text_open(file_name, “ORV”,0,0,chan) /* Read the header information from the nodal results file */ text_read_string(chan, title, len) text_read(chan, “%2I9% %E15.6% %2I9%”, fil_attrs, maxval, chars ) text_read_string(chan, line, len)

PCL and CustomizationExamples of Translation

796

text_read_string(chan, line, len) /* Allocate result arrays */ sys_allocate_array(col_vals, 1, fil_attrs(4) ) sys_allocate_array(nids, 1, fil_attrs(1)+1 ) sys_allocate_array( lyids, 1, fil_attrs(1) ) IF( ncols > 1 ) THEN sys_allocate_array( res_vals, 1, fil_attrs(1), 1, ncols ) sys_allocate_array( c_types, 1, fil_attrs(1) ) sys_allocate_array( cids, 1, fil_attrs(1) ) ELSE sys_allocate_array( res_vals, 1, fil_attrs(1) ) END IF /* Create or if exists use the Loadcase */ dbt_find_load_case_id(“res_reader”,1,lc_label,1,lc_desc,lcid) /* Create a subcase for this result */ db_create_sub_case(lcid, title, scid, rcid ) /* Drop the Db indices while creating results */ db_drop_res_index() /* Create the result for this loadcase/subcase */ dbt_create_res_types(1, res_label, res_desc, restype, numtype, @ “RES_READER”, 0, rtid ) /* Create a section position id */ dbt_create_sect_pos( 1, “”, 0, [0., 0.], secid ) /* Create a layer position id */ dbt_create_layers(1, 0, secid, lyid ) /* Load the Results from the file into a result array */ /* create format string for formatted read from ascii results file */ col_format = “%I8% %”//str_from_integer(fil_attrs(4))//”E13.7%” IF( ncols == 1 ) THEN /* Read scalar results from file */ FOR( i = 1 TO fil_attrs(1) ) lyids(i) = lyid text_read(chan,col_format,nids(i:i+1),col_vals,chars) res_vals(i) = col_vals(cols(1)) END FOR ELSE /* Read vector or tensor results from file */ FOR( i = 1 TO fil_attrs(1) ) lyids(i) = lyid c_types(i) = 1 cids(i) = 0 text_read(chan,col_format,nids(i:i+1),col_vals,chars) FOR( j = 1 TO ncols ) res_vals(i,j) = col_vals(cols(j)) END FOR END FOR END IF /* Load the result into the database */ SWITCH( ncols ) CASE( 1 ) /* Scalar */ db_add_s_nod_res_by_type( fil_attrs(1), rtid, rcid, lyids, @ nids, res_vals ) CASE( 3 ) /* Vector */ db_add_v_nod_res_by_type( fil_attrs(1), rtid, rcid, lyids, @ nids, c_types, cids, res_vals ) CASE( 6 ) /* Tensor */ db_add_t_nod_res_by_type( fil_attrs(1), rtid, rcid, lyids, @ nids, c_types, cids, res_vals ) END SWITCH /* Post Results in Database */ db_post_results_load() /* Close Text File */ text_close(chan, “”) RETURN( 0 ) END FUNCTION /* input_nodal_result */ END CLASS /* uil_imaging_geom */

797Chapter 8: Accessing the Patran DatabaseExamples of Translation

Extracting Temperature Dependent and/or Non-Linear Material Data The following PCL function writes temperature dependent and/or non-linear material definitions to a PATRAN 2.5 P/FEA auxiliary data file. The source for this example can be found in the $P3_HOME/customization directory under the name “pfea_mat_aux_file.pcl”.

FUNCTION pfea_mat_aux_file ( original_channel, file_name ) /* * Purpose: Extracts all material records referenced by element property * regions in the database and then writes all the temperature * dependent and/or non-linear material records to a PATRAN * 2.5 P/FEA auxilary input file. * * Input: original_channel integer the channel of the auxilary * file. Zero if not yet opened. * file_name character string the name of the auxilary file. */ /* * There are 19 material properties which can exist in the auxilary file: * E11, E22, E33, Nu12, Nu13, Nu23, G12, G13, G23, a11, a22, a33, rho, * sig11, sig22, sig33, sig12, sig23, sig31. The “mat_types” array contains * the type of property word: 0 ( not found ), 1 ( real constant ), 2 * ( temp. depend. real ), 3 ( constant stress/strain curve ) and 4 ( temp. * depend. stress/strain curve ). The “mat_values” array contains the * constant real values of the property words. The “mat_fields” array * contains the field references for all the property words. * The “temp_values_#” arrays contain all the temperature values for * property word #. The “strain_values_#” arrays contain all the strain * values for the property word #. */ INTEGER original_channel, file_channel, mat_types(19), mat_fields(19) INTEGER tot_num_temps, num_regions, region_ids(VIRTUAL), mats_written INTEGER status, prop_set_id, dof_set_flag, condense_flag, geom_flag, form_flag INTEGER lam_flag, layer_count, material_id, material_lin, material_dir INTEGER category_id, material_type, data_exists, num_words, max_num_words INTEGER word_ids(VIRTUAL), field_ids(VIRTUAL), i, j, k, l, max_num_temps INTEGER num_temp_values(19), num_strain_values(6), max_mat_data, num_mat_data INTEGER field_var, field_dim, geom_type, geom_id, extrap_opt, data_type, coord_id INTEGER field_type, num_vars, var_type_1, var_type_2, var_type_3, func_1_size INTEGER func_2_size, func_3_size, num_var_1, num_var_2, num_var_3, position INTEGER num_loops REAL mat_values(19), var_2_value(1), var_3_value(1), temp_value, tolerance REAL temp_1_values(VIRTUAL), temp_2_values(VIRTUAL), temp_3_values(VIRTUAL) REAL temp_4_values(VIRTUAL), temp_5_values(VIRTUAL), temp_6_values(VIRTUAL) REAL temp_7_values(VIRTUAL), temp_8_values(VIRTUAL), temp_9_values(VIRTUAL) REAL temp_10_values(VIRTUAL), temp_11_values(VIRTUAL), temp_12_values(VIRTUAL) REAL temp_13_values(VIRTUAL), temp_14_values(VIRTUAL), temp_15_values(VIRTUAL) REAL temp_16_values(VIRTUAL), temp_17_values(VIRTUAL), temp_18_values(VIRTUAL) REAL temp_19_values(VIRTUAL), strain_1_values(VIRTUAL), strain_2_values(VIRTUAL) REAL strain_3_values(VIRTUAL), strain_4_values(VIRTUAL), strain_5_values(VIRTUAL) REAL strain_6_values(VIRTUAL), material_1_values(VIRTUAL), material_2_values(VIRTUAL) REAL material_3_values(VIRTUAL), material_4_values(VIRTUAL), material_5_values(VIRTUAL) REAL material_6_values(VIRTUAL), material_7_values(VIRTUAL), material_8_values(VIRTUAL) REAL material_9_values(VIRTUAL), material_10_values(VIRTUAL), material_11_values(VIRTUAL) REAL material_12_values(VIRTUAL), material_13_values(VIRTUAL), material_14_values(VIRTUAL) REAL material_15_values(VIRTUAL), material_16_values(VIRTUAL), material_17_values(VIRTUAL)

PCL and CustomizationExamples of Translation

798

REAL material_18_values(VIRTUAL), material_19_values(VIRTUAL), input_values(VIRTUAL) REAL tot_temp_values(VIRTUAL), word_values(VIRTUAL), mat_data(VIRTUAL), real_array(2) STRING file_name[], prop_set_name[31], material_name[31], material_description[2500] STRING name[20], field_name[31], title[20] LOGICAL temp_depend, non_linear, lin_def, found /* initialize variables */ mats_written = 0 file_channel = original_channel max_num_words = 0 max_num_temps = 0 max_mat_data = 0 tolerance = 0.001 /* determine the number of element property regions in the database and extract * their ids */ status = db_count_region_ids ( num_regions ) IF ( num_regions == 0 ) THEN RETURN END IF status = sys_allocate_array ( region_ids, 1, num_regions ) status = db_get_all_region_ids ( num_regions, region_ids ) /* loop through the number of regions determining whether the referenced * material record needs to be written to the aux. file or not */ FOR ( i = 1 TO num_regions ) status = db_get_region_definition ( region_ids(i), prop_set_name, prop_set_id, @ dof_set_flag, condense_flag, geom_flag, form_flag, lam_flag, @ layer_count, material_id, material_lin, material_dir ) IF ( material_id == 0 ) THEN CONTINUE END IF status = db_get_material ( material_id, material_name, category_id, material_lin, @ material_dir, material_description, material_type, @ data_exists ) IF ( data_exists == 0 ) THEN CONTINUE END IF status = db_get_matl_prop_value_count ( material_id, num_words ) IF ( num_words == 0 ) THEN CONTINUE END IF IF ( num_words > max_num_words ) THEN max_num_words = num_words status = sys_allocate_array ( word_ids, 1, num_words ) status = sys_allocate_array ( field_ids, 1, num_words ) status = sys_allocate_array ( word_values, 1, num_words ) END IF status = db_get_matl_prop_value ( material_id, word_ids, field_ids, word_values ) /* loop through all the material words, storing all the recognized words and * keeping tract of the variability ( temperature variance or nonlinearity ) of * the material records */ temp_depend = FALSE non_linear = FALSE tot_num_temps = 0 mat_types(1) = 0 mat_types(2) = 0 mat_types(3) = 0 mat_types(4) = 0 mat_types(5) = 0 mat_types(6) = 0 mat_types(7) = 0 mat_types(8) = 0 mat_types(9) = 0 mat_types(10) = 0 mat_types(11) = 0 mat_types(12) = 0

799Chapter 8: Accessing the Patran DatabaseExamples of Translation

mat_types(13) = 0 mat_types(14) = 0 mat_types(15) = 0 mat_types(16) = 0 mat_types(17) = 0 mat_types(18) = 0 mat_types(19) = 0 num_temp_values(1) = 0 num_temp_values(2) = 0 num_temp_values(3) = 0 num_temp_values(4) = 0 num_temp_values(5) = 0 num_temp_values(6) = 0 num_temp_values(7) = 0 num_temp_values(8) = 0 num_temp_values(9) = 0 num_temp_values(10) = 0 num_temp_values(11) = 0 num_temp_values(12) = 0 num_temp_values(13) = 0 num_temp_values(14) = 0 num_temp_values(15) = 0 num_temp_values(16) = 0 num_temp_values(17) = 0 num_temp_values(18) = 0 num_temp_values(19) = 0 num_strain_values(1) = 0 num_strain_values(2) = 0 num_strain_values(3) = 0 num_strain_values(4) = 0 num_strain_values(5) = 0 num_strain_values(6) = 0 FOR ( j = 1 TO num_words ) /* E11 */ IF ( word_ids(j) == 2 ) THEN IF ( field_ids(j) > 0 ) THEN temp_depend = TRUE mat_types(1) = 2 mat_fields(1) = field_ids(j) ELSE mat_types(1) = 1 mat_values(1) = word_values(j) END IF END IF /* E22 */ IF ( word_ids(j) == 3 && material_dir == 2 ) THEN IF ( field_ids(j) > 0 ) THEN temp_depend = TRUE mat_types(2) = 2 mat_fields(2) = field_ids(j) ELSE mat_types(2) = 1 mat_values(2) = word_values(j) END IF END IF /* E33 */ IF ( word_ids(j) == 4 && material_dir == 2 ) THEN IF ( field_ids(j) > 0 ) THEN temp_depend = TRUE mat_types(3) = 2 mat_fields(3) = field_ids(j) ELSE mat_types(3) = 1 mat_values(3) = word_values(j) END IF END IF /* Nu12 */ IF ( word_ids(j) == 5 ) THEN

PCL and CustomizationExamples of Translation

800

IF ( field_ids(j) > 0 ) THEN temp_depend = TRUE mat_types(4) = 2 mat_fields(4) = field_ids(j) ELSE mat_types(4) = 1 mat_values(4) = word_values(j) END IF END IF /* Nu13 */ IF ( word_ids(j) == 13 && material_dir == 2 ) THEN IF ( field_ids(j) > 0 ) THEN temp_depend = TRUE mat_types(5) = 2 mat_fields(5) = field_ids(j) ELSE mat_types(5) = 1 mat_values(5) = word_values(j) END IF END IF /* Nu23 */ IF ( word_ids(j) == 6 && material_dir == 2 ) THEN IF ( field_ids(j) > 0 ) THEN temp_depend = TRUE mat_types(6) = 2 mat_fields(6) = field_ids(j) ELSE mat_types(6) = 1 mat_values(6) = word_values(j) END IF END IF /* G12 */ IF ( word_ids(j) == 8 && material_dir == 2 ) THEN IF ( field_ids(j) > 0 ) THEN temp_depend = TRUE mat_types(7) = 2 mat_fields(7) = field_ids(j) ELSE mat_types(7) = 1 mat_values(7) = word_values(j) END IF END IF /* G13 */ IF ( word_ids(j) == 9 && material_dir == 2 ) THEN IF ( field_ids(j) > 0 ) THEN temp_depend = TRUE mat_types(8) = 2 mat_fields(8) = field_ids(j) ELSE mat_types(8) = 1 mat_values(8) = word_values(j) END IF END IF /* G23 */ IF ( word_ids(j) == 10 && material_dir == 2 ) THEN IF ( field_ids(j) > 0 ) THEN temp_depend = TRUE mat_types(9) = 2 mat_fields(9) = field_ids(j) ELSE mat_types(9) = 1 mat_values(9) = word_values(j) END IF END IF /* Alpha11 */ IF ( word_ids(j) == 24 ) THEN IF ( field_ids(j) > 0 ) THEN temp_depend = TRUE

801Chapter 8: Accessing the Patran DatabaseExamples of Translation

mat_types(10) = 2 mat_fields(10) = field_ids(j) ELSE mat_types(10) = 1 mat_values(10) = word_values(j) END IF END IF /* Alpha22 */ IF ( word_ids(j) == 25 && material_dir == 2 ) THEN IF ( field_ids(j) > 0 ) THEN temp_depend = TRUE mat_types(11) = 2 mat_fields(11) = field_ids(j) ELSE mat_types(11) = 1 mat_values(11) = word_values(j) END IF END IF /* Alpha33 */ IF ( word_ids(j) == 26 && material_dir == 2 ) THEN IF ( field_ids(j) > 0 ) THEN temp_depend = TRUE mat_types(12) = 2 mat_fields(12) = field_ids(j) ELSE mat_types(12) = 1 mat_values(12) = word_values(j) END IF END IF /* Density ( rho ) */ IF ( word_ids(j) == 16 ) THEN IF ( field_ids(j) > 0 ) THEN temp_depend = TRUE mat_types(13) = 2 mat_fields(13) = field_ids(j) ELSE mat_types(13) = 1 mat_values(13) = word_values(j) END IF END IF /* Sig11 vs. Eps11 */ IF ( word_ids(j) == 503 && material_lin == 3 ) THEN IF ( field_ids(j) > 0 ) THEN non_linear = TRUE mat_types(14) = 3 mat_fields(14) = field_ids(j) END IF END IF /* Sig22 vs. Eps11 */ IF ( word_ids(j) == 2002 && material_lin == 3 && material_dir == 2 ) THEN IF ( field_ids(j) > 0 ) THEN non_linear = TRUE mat_types(15) = 3 mat_fields(15) = field_ids(j) END IF END IF /* Sig33 vs. Eps11 */ IF ( word_ids(j) == 2003 && material_lin == 3 && material_dir == 2 ) THEN IF ( field_ids(j) > 0 ) THEN non_linear = TRUE mat_types(16) = 3 mat_fields(16) = field_ids(j) END IF END IF /* Sig12 vs. Eps11 */ IF ( word_ids(j) == 2004 && material_lin == 3 && material_dir == 2 ) THEN IF ( field_ids(j) > 0 ) THEN non_linear = TRUE

PCL and CustomizationExamples of Translation

802

mat_types(17) = 3 mat_fields(17) = field_ids(j) END IF END IF /* Sig23 vs. Eps11 */ IF ( word_ids(j) == 2005 && material_lin == 3 && material_dir == 2 ) THEN IF ( field_ids(j) > 0 ) THEN non_linear = TRUE mat_types(18) = 3 mat_fields(18) = field_ids(j) END IF END IF /* Sig31 vs. Eps11 */ IF ( word_ids(j) == 2006 && material_lin == 3 && material_dir == 2 ) THEN IF ( field_ids(j) > 0 ) THEN non_linear = TRUE mat_types(19) = 3 mat_fields(19) = field_ids(j) END IF END IF END FOR /* if this is a constant linear material record, skip to the next element property region */ IF ( !temp_depend && !non_linear ) THEN CONTINUE END IF /* determine a valid temperature list for all the temp. depend. material data given */ FOR ( j = 1 TO 19 ) IF ( mat_types(j) == 2 || mat_types(j) == 3 ) THEN status = db_get_field ( mat_fields(j), field_name, field_var, field_dim, @ geom_type, geom_id, extrap_opt, data_type, coord_id, field_type, @ num_vars, var_type_1, var_type_2, var_type_3, func_1_size, @ func_2_size, func_3_size, lin_def, num_var_1, num_var_2, @ num_var_3 ) IF ( field_dim == 0 && field_type == 1 ) THEN IF ( mat_types(j) == 2 && num_vars == 1 && num_var_1 > 0 && @ var_type_1 == 10 ) THEN num_temp_values(j) = num_var_1 IF ( j == 1 ) THEN status = sys_allocate_array( temp_1_values, 1, num_var_1 ) ELSE IF ( j == 2 ) THEN status = sys_allocate_array( temp_2_values, 1, num_var_1 ) ELSE IF ( j == 3 ) THEN status = sys_allocate_array( temp_3_values, 1, num_var_1 ) ELSE IF ( j == 4 ) THEN status = sys_allocate_array( temp_4_values, 1, num_var_1 ) ELSE IF ( j == 5 ) THEN status = sys_allocate_array( temp_5_values, 1, num_var_1 ) ELSE IF ( j == 6 ) THEN status = sys_allocate_array( temp_6_values, 1, num_var_1 ) ELSE IF ( j == 7 ) THEN status = sys_allocate_array( temp_7_values, 1, num_var_1 ) ELSE IF ( j == 8 ) THEN status = sys_allocate_array( temp_8_values, 1, num_var_1 ) ELSE IF ( j == 9 ) THEN status = sys_allocate_array( temp_9_values, 1, num_var_1 ) ELSE IF ( j == 10 ) THEN status = sys_allocate_array( temp_10_values, 1, num_var_1 ) ELSE IF ( j == 11 ) THEN status = sys_allocate_array( temp_11_values, 1, num_var_1 ) ELSE IF ( j == 12 ) THEN status = sys_allocate_array( temp_12_values, 1, num_var_1 ) ELSE IF ( j == 13 ) THEN status = sys_allocate_array( temp_13_values, 1, num_var_1 ) END IF num_mat_data = num_var_1 IF ( num_mat_data > max_mat_data ) THEN

803Chapter 8: Accessing the Patran DatabaseExamples of Translation

max_mat_data = num_mat_data status = sys_allocate_array( mat_data, 1, max_mat_data ) END IF IF ( j == 1 ) THEN status = db_get_field_table ( mat_fields(j), num_vars, num_var_1, @ num_var_2, num_var_3, temp_1_values, @ var_2_value, var_3_value, mat_data ) ELSE IF ( j == 2 ) THEN status = db_get_field_table ( mat_fields(j), num_vars, num_var_1, @ num_var_2, num_var_3, temp_2_values, @ var_2_value, var_3_value, mat_data ) ELSE IF ( j == 3 ) THEN status = db_get_field_table ( mat_fields(j), num_vars, num_var_1, @ num_var_2, num_var_3, temp_3_values, @ var_2_value, var_3_value, mat_data ) ELSE IF ( j == 4 ) THEN status = db_get_field_table ( mat_fields(j), num_vars, num_var_1, @ num_var_2, num_var_3, temp_4_values, @ var_2_value, var_3_value, mat_data ) ELSE IF ( j == 5 ) THEN status = db_get_field_table ( mat_fields(j), num_vars, num_var_1, @ num_var_2, num_var_3, temp_5_values, @ var_2_value, var_3_value, mat_data ) ELSE IF ( j == 6 ) THEN status = db_get_field_table ( mat_fields(j), num_vars, num_var_1, @ num_var_2, num_var_3, temp_6_values, @ var_2_value, var_3_value, mat_data ) ELSE IF ( j == 7 ) THEN status = db_get_field_table ( mat_fields(j), num_vars, num_var_1, @ num_var_2, num_var_3, temp_7_values, @ var_2_value, var_3_value, mat_data ) ELSE IF ( j == 8 ) THEN status = db_get_field_table ( mat_fields(j), num_vars, num_var_1, @ num_var_2, num_var_3, temp_8_values, @ var_2_value, var_3_value, mat_data ) ELSE IF ( j == 9 ) THEN status = db_get_field_table ( mat_fields(j), num_vars, num_var_1, @ num_var_2, num_var_3, temp_9_values, @ var_2_value, var_3_value, mat_data ) ELSE IF ( j == 10 ) THEN status = db_get_field_table ( mat_fields(j), num_vars, num_var_1, @ num_var_2, num_var_3, temp_10_values, @ var_2_value, var_3_value, mat_data ) ELSE IF ( j == 11 ) THEN status = db_get_field_table ( mat_fields(j), num_vars, num_var_1, @ num_var_2, num_var_3, temp_11_values, @ var_2_value, var_3_value, mat_data ) ELSE IF ( j == 12 ) THEN status = db_get_field_table ( mat_fields(j), num_vars, num_var_1, @ num_var_2, num_var_3, temp_12_values, @ var_2_value, var_3_value, mat_data ) ELSE IF ( j == 13 ) THEN status = db_get_field_table ( mat_fields(j), num_vars, num_var_1, @ num_var_2, num_var_3, temp_13_values, @ var_2_value, var_3_value, mat_data ) END IF ELSE IF ( mat_types(j) == 3 && num_vars == 2 && num_var_1 > 0 && @ num_var_2 > 0 && var_type_1 == 10 && var_type_2 == 11 ) THEN temp_depend = TRUE mat_types(j) = 4 num_temp_values(j) = num_var_1 num_strain_values(j-13) = num_var_2 IF ( j == 14 ) THEN status = sys_allocate_array( temp_14_values, 1, num_var_1 ) status = sys_allocate_array( strain_1_values, 1, num_var_2 ) ELSE IF ( j == 15 ) THEN status = sys_allocate_array( temp_15_values, 1, num_var_1 ) status = sys_allocate_array( strain_2_values, 1, num_var_2 )

PCL and CustomizationExamples of Translation

804

ELSE IF ( j == 16 ) THEN status = sys_allocate_array( temp_16_values, 1, num_var_1 ) status = sys_allocate_array( strain_3_values, 1, num_var_2 ) ELSE IF ( j == 17 ) THEN status = sys_allocate_array( temp_17_values, 1, num_var_1 ) status = sys_allocate_array( strain_4_values, 1, num_var_2 ) ELSE IF ( j == 18 ) THEN status = sys_allocate_array( temp_18_values, 1, num_var_1 ) status = sys_allocate_array( strain_5_values, 1, num_var_2 ) ELSE IF ( j == 19 ) THEN status = sys_allocate_array( temp_19_values, 1, num_var_1 ) status = sys_allocate_array( strain_6_values, 1, num_var_2 ) END IF num_mat_data = num_var_1*num_var_2 IF ( num_mat_data > max_mat_data ) THEN max_mat_data = num_mat_data status = sys_allocate_array( mat_data, 1, max_mat_data ) END IF IF ( j == 14 ) THEN status = db_get_field_table ( mat_fields(j), num_vars, num_var_1, @ num_var_2, num_var_3, temp_14_values, @ strain_1_values, var_3_value, mat_data ) ELSE IF ( j == 15 ) THEN status = db_get_field_table ( mat_fields(j), num_vars, num_var_1, @ num_var_2, num_var_3, temp_15_values, @ strain_2_values, var_3_value, mat_data ) ELSE IF ( j == 16 ) THEN status = db_get_field_table ( mat_fields(j), num_vars, num_var_1, @ num_var_2, num_var_3, temp_16_values, @ strain_3_values, var_3_value, mat_data ) ELSE IF ( j == 17 ) THEN status = db_get_field_table ( mat_fields(j), num_vars, num_var_1, @ num_var_2, num_var_3, temp_17_values, @ strain_4_values, var_3_value, mat_data ) ELSE IF ( j == 18 ) THEN status = db_get_field_table ( mat_fields(j), num_vars, num_var_1, @ num_var_2, num_var_3, temp_18_values, @ strain_5_values, var_3_value, mat_data ) ELSE IF ( j == 19 ) THEN status = db_get_field_table ( mat_fields(j), num_vars, num_var_1, @ num_var_2, num_var_3, temp_19_values, @ strain_6_values, var_3_value, mat_data ) END IF ELSE IF ( mat_types(j) == 3 && num_vars == 1 && num_var_1 > 0 && @ var_type_1 == 11 ) THEN num_strain_values(j-13) = num_var_1 IF ( j == 14 ) THEN status = sys_allocate_array( strain_1_values, 1, num_var_1 ) ELSE IF ( j == 15 ) THEN status = sys_allocate_array( strain_2_values, 1, num_var_1 ) ELSE IF ( j == 16 ) THEN status = sys_allocate_array( strain_3_values, 1, num_var_1 ) ELSE IF ( j == 17 ) THEN status = sys_allocate_array( strain_4_values, 1, num_var_1 ) ELSE IF ( j == 18 ) THEN status = sys_allocate_array( strain_5_values, 1, num_var_1 ) ELSE IF ( j == 19 ) THEN status = sys_allocate_array( strain_6_values, 1, num_var_1 ) END IF num_mat_data = num_var_1 IF ( num_mat_data > max_mat_data ) THEN max_mat_data = num_mat_data status = sys_allocate_array( mat_data, 1, max_mat_data ) END IF IF ( j == 14 ) THEN status = db_get_field_table ( mat_fields(j), num_vars, num_var_1, @ num_var_2, num_var_3, strain_1_values, @ var_2_value, var_3_value, mat_data )

805Chapter 8: Accessing the Patran DatabaseExamples of Translation

ELSE IF ( j == 15 ) THEN status = db_get_field_table ( mat_fields(j), num_vars, num_var_1, @ num_var_2, num_var_3, strain_2_values, @ var_2_value, var_3_value, mat_data ) ELSE IF ( j == 16 ) THEN status = db_get_field_table ( mat_fields(j), num_vars, num_var_1, @ num_var_2, num_var_3, strain_3_values, @ var_2_value, var_3_value, mat_data ) ELSE IF ( j == 17 ) THEN status = db_get_field_table ( mat_fields(j), num_vars, num_var_1, @ num_var_2, num_var_3, strain_4_values, @ var_2_value, var_3_value, mat_data ) ELSE IF ( j == 18 ) THEN status = db_get_field_table ( mat_fields(j), num_vars, num_var_1, @ num_var_2, num_var_3, strain_5_values, @ var_2_value, var_3_value, mat_data ) ELSE IF ( j == 19 ) THEN status = db_get_field_table ( mat_fields(j), num_vars, num_var_1, @ num_var_2, num_var_3, strain_6_values, @ var_2_value, var_3_value, mat_data ) END IF END IF END IF END IF END FOR /* loop through all the temperature lists creating one super-set list */ FOR ( j = 1 TO 19 ) IF ( num_temp_values(j) > 0 && tot_num_temps == 0 ) THEN tot_num_temps = num_temp_values(j) IF ( tot_num_temps > max_num_temps ) THEN max_num_temps = tot_num_temps + 100 status = sys_allocate_array ( tot_temp_values, 1, max_num_temps ) END IF FOR ( k = 1 TO tot_num_temps ) IF ( j == 1 ) THEN tot_temp_values(k) = temp_1_values(k) ELSE IF ( j == 2 ) THEN tot_temp_values(k) = temp_2_values(k) ELSE IF ( j == 3 ) THEN tot_temp_values(k) = temp_3_values(k) ELSE IF ( j == 4 ) THEN tot_temp_values(k) = temp_4_values(k) ELSE IF ( j == 5 ) THEN tot_temp_values(k) = temp_5_values(k) ELSE IF ( j == 6 ) THEN tot_temp_values(k) = temp_6_values(k) ELSE IF ( j == 7 ) THEN tot_temp_values(k) = temp_7_values(k) ELSE IF ( j == 8 ) THEN tot_temp_values(k) = temp_8_values(k) ELSE IF ( j == 9 ) THEN tot_temp_values(k) = temp_9_values(k) ELSE IF ( j == 10 ) THEN tot_temp_values(k) = temp_10_values(k) ELSE IF ( j == 11 ) THEN tot_temp_values(k) = temp_11_values(k) ELSE IF ( j == 12 ) THEN tot_temp_values(k) = temp_12_values(k) ELSE IF ( j == 13 ) THEN tot_temp_values(k) = temp_13_values(k) ELSE IF ( j == 14 ) THEN tot_temp_values(k) = temp_14_values(k) ELSE IF ( j == 15 ) THEN tot_temp_values(k) = temp_15_values(k) ELSE IF ( j == 16 ) THEN tot_temp_values(k) = temp_16_values(k) ELSE IF ( j == 17 ) THEN tot_temp_values(k) = temp_17_values(k)

PCL and CustomizationExamples of Translation

806

ELSE IF ( j == 18 ) THEN tot_temp_values(k) = temp_18_values(k) ELSE IF ( j == 19 ) THEN tot_temp_values(k) = temp_19_values(k) END IF END FOR ELSE IF ( num_temp_values(j) > 0 ) THEN FOR ( k = 1 TO num_temp_values(j) ) found = FALSE position = 0 IF ( j == 1 ) THEN temp_value = temp_1_values(k) ELSE IF ( j == 2 ) THEN temp_value = temp_2_values(k) ELSE IF ( j == 3 ) THEN temp_value = temp_3_values(k) ELSE IF ( j == 4 ) THEN temp_value = temp_4_values(k) ELSE IF ( j == 5 ) THEN temp_value = temp_5_values(k) ELSE IF ( j == 6 ) THEN temp_value = temp_6_values(k) ELSE IF ( j == 7 ) THEN temp_value = temp_7_values(k) ELSE IF ( j == 8 ) THEN temp_value = temp_8_values(k) ELSE IF ( j == 9 ) THEN temp_value = temp_9_values(k) ELSE IF ( j == 10 ) THEN temp_value = temp_10_values(k) ELSE IF ( j == 11 ) THEN temp_value = temp_11_values(k) ELSE IF ( j == 12 ) THEN temp_value = temp_12_values(k) ELSE IF ( j == 13 ) THEN temp_value = temp_13_values(k) ELSE IF ( j == 14 ) THEN temp_value = temp_14_values(k) ELSE IF ( j == 15 ) THEN temp_value = temp_15_values(k) ELSE IF ( j == 16 ) THEN temp_value = temp_16_values(k) ELSE IF ( j == 17 ) THEN temp_value = temp_17_values(k) ELSE IF ( j == 18 ) THEN temp_value = temp_18_values(k) ELSE IF ( j == 19 ) THEN temp_value = temp_19_values(k) END IF IF ( temp_value < ( tot_temp_values(1) - tolerance ) ) THEN position = 1 ELSE IF ( temp_value >= ( tot_temp_values(1) - tolerance ) && @ temp_value <= ( tot_temp_values(1) + tolerance ) ) THEN position = 1 found = TRUE ELSE IF ( temp_value > ( tot_temp_values(tot_num_temps) @ + tolerance ) ) THEN position = tot_num_temps + 1 ELSE IF ( temp_value >= ( tot_temp_values(tot_num_temps) @ - tolerance ) && temp_value <= ( @ tot_temp_values(tot_num_temps) + tolerance ) ) THEN position = tot_num_temps found = TRUE ELSE IF ( tot_num_temps > 1 ) THEN FOR ( l = 1 TO ( tot_num_temps - 1 ) ) IF ( temp_value >= ( tot_temp_values(l) - tolerance ) && @ temp_value <= ( tot_temp_values(l) + tolerance ) ) THEN position = l

807Chapter 8: Accessing the Patran DatabaseExamples of Translation

found = TRUE BREAK ELSE IF ( temp_value > ( tot_temp_values(l) + tolerance ) && @ temp_value < ( tot_temp_values(l+1) - tolerance ) ) THEN position = l+1 BREAK END IF END FOR END IF IF ( found || position <= 0 ) THEN CONTINUE END IF tot_num_temps = tot_num_temps + 1 IF ( tot_num_temps > max_num_temps ) THEN max_num_temps = tot_num_temps + 100 status = sys_reallocate_array ( tot_temp_values, 1, max_num_temps ) END IF IF ( position < tot_num_temps ) THEN FOR ( l = ( tot_num_temps - 1 ) TO position BY -1 ) tot_temp_values(l+1) = tot_temp_values(l) END FOR END IF tot_temp_values(position) = temp_value END FOR END IF END FOR /* evaluate each and every field at the super-set list of temperatures */ FOR ( j = 1 TO 19 ) IF ( mat_types(j) == 2 ) THEN IF ( j == 1 ) THEN status = sys_allocate_array( material_1_values, 1, tot_num_temps ) status = get_field_values ( mat_fields(j), tot_num_temps, 1, 1, @ tot_temp_values, material_1_values ) ELSE IF ( j == 2 ) THEN status = sys_allocate_array( material_2_values, 1, tot_num_temps ) status = get_field_values ( mat_fields(j), tot_num_temps, 1, 1, @ tot_temp_values, material_2_values ) ELSE IF ( j == 3 ) THEN status = sys_allocate_array( material_3_values, 1, tot_num_temps ) status = get_field_values ( mat_fields(j), tot_num_temps, 1, 1, @ tot_temp_values, material_3_values ) ELSE IF ( j == 4 ) THEN status = sys_allocate_array( material_4_values, 1, tot_num_temps ) status = get_field_values ( mat_fields(j), tot_num_temps, 1, 1, @ tot_temp_values, material_4_values ) ELSE IF ( j == 5 ) THEN status = sys_allocate_array( material_5_values, 1, tot_num_temps ) status = get_field_values ( mat_fields(j), tot_num_temps, 1, 1, @ tot_temp_values, material_5_values ) ELSE IF ( j == 6 ) THEN status = sys_allocate_array( material_6_values, 1, tot_num_temps ) status = get_field_values ( mat_fields(j), tot_num_temps, 1, 1, @ tot_temp_values, material_6_values ) ELSE IF ( j == 7 ) THEN status = sys_allocate_array( material_7_values, 1, tot_num_temps ) status = get_field_values ( mat_fields(j), tot_num_temps, 1, 1, @ tot_temp_values, material_7_values ) ELSE IF ( j == 8 ) THEN status = sys_allocate_array( material_8_values, 1, tot_num_temps ) status = get_field_values ( mat_fields(j), tot_num_temps, 1, 1, @ tot_temp_values, material_8_values ) ELSE IF ( j == 9 ) THEN status = sys_allocate_array( material_9_values, 1, tot_num_temps ) status = get_field_values ( mat_fields(j), tot_num_temps, 1, 1, @ tot_temp_values, material_9_values ) ELSE IF ( j == 10 ) THEN status = sys_allocate_array( material_10_values, 1, tot_num_temps ) status = get_field_values ( mat_fields(j), tot_num_temps, 1, 1, @

PCL and CustomizationExamples of Translation

808

tot_temp_values, material_10_values ) ELSE IF ( j == 11 ) THEN status = sys_allocate_array( material_11_values, 1, tot_num_temps ) status = get_field_values ( mat_fields(j), tot_num_temps, 1, 1, @ tot_temp_values, material_11_values ) ELSE IF ( j == 12 ) THEN status = sys_allocate_array( material_12_values, 1, tot_num_temps ) status = get_field_values ( mat_fields(j), tot_num_temps, 1, 1, @ tot_temp_values, material_12_values ) ELSE IF ( j == 13 ) THEN status = sys_allocate_array( material_13_values, 1, tot_num_temps ) status = get_field_values ( mat_fields(j), tot_num_temps, 1, 1, @ tot_temp_values, material_13_values ) END IF ELSE IF ( mat_types(j) == 3 ) THEN IF ( j == 14 ) THEN status = sys_allocate_array( material_14_values, 1, @ num_strain_values(j-13) ) status = get_field_values ( mat_fields(j), num_strain_values(j-13), 1, 1, @ strain_1_values, material_14_values ) ELSE IF ( j == 15 ) THEN status = sys_allocate_array( material_15_values, 1, @ num_strain_values(j-13) ) status = get_field_values ( mat_fields(j), num_strain_values(j-13), 1, 1, @ strain_2_values, material_15_values ) ELSE IF ( j == 16 ) THEN status = sys_allocate_array( material_16_values, 1, @ num_strain_values(j-13) ) status = get_field_values ( mat_fields(j), num_strain_values(j-13), 1, 1, @ strain_3_values, material_16_values ) ELSE IF ( j == 17 ) THEN status = sys_allocate_array( material_17_values, 1, @ num_strain_values(j-13) ) status = get_field_values ( mat_fields(j), num_strain_values(j-13), 1, 1, @ strain_4_values, material_17_values ) ELSE IF ( j == 18 ) THEN status = sys_allocate_array( material_18_values, 1, @ num_strain_values(j-13) ) status = get_field_values ( mat_fields(j), num_strain_values(j-13), 1, 1, @ strain_5_values, material_18_values ) ELSE IF ( j == 19 ) THEN status = sys_allocate_array( material_19_values, 1, @ num_strain_values(j-13) ) status = get_field_values ( mat_fields(j), num_strain_values(j-13), 1, 1, @ strain_6_values, material_19_values ) END IF ELSE IF ( mat_types(j) == 4 ) THEN status = sys_allocate_array( input_values, 1, @ tot_num_temps*num_strain_values(j-13), 1, 2 ) FOR ( k = 1 TO tot_num_temps ) FOR ( l = 1 TO num_strain_values(j-13) ) input_values(((k-1)*num_strain_values(j-13)+l),1) = tot_temp_values(k) IF ( j == 14 ) THEN input_values(((k-1)*num_strain_values(j-13)+l),2) = strain_1_values(l) ELSE IF ( j == 15 ) THEN input_values(((k-1)*num_strain_values(j-13)+l),2) = strain_2_values(l) ELSE IF ( j == 16 ) THEN input_values(((k-1)*num_strain_values(j-13)+l),2) = strain_3_values(l) ELSE IF ( j == 17 ) THEN input_values(((k-1)*num_strain_values(j-13)+l),2) = strain_4_values(l) ELSE IF ( j == 18 ) THEN input_values(((k-1)*num_strain_values(j-13)+l),2) = strain_5_values(l) ELSE IF ( j == 19 ) THEN input_values(((k-1)*num_strain_values(j-13)+l),2) = strain_6_values(l) END IF END FOR END FOR IF ( j == 14 ) THEN

809Chapter 8: Accessing the Patran DatabaseExamples of Translation

status = sys_allocate_array( material_14_values, 1, tot_num_temps, 1, @ num_strain_values(j-13) ) status = get_field_values ( mat_fields(j), tot_num_temps, 2, 1, @ input_values, material_14_values ) ELSE IF ( j == 15 ) THEN status = sys_allocate_array( material_15_values, 1, tot_num_temps, 1, @ num_strain_values(j-13) ) status = get_field_values ( mat_fields(j), tot_num_temps, 2, 1, @ input_values, material_15_values ) ELSE IF ( j == 16 ) THEN status = sys_allocate_array( material_16_values, 1, tot_num_temps, 1, @ num_strain_values(j-13) ) status = get_field_values ( mat_fields(j), tot_num_temps, 2, 1, @ input_values, material_16_values ) ELSE IF ( j == 17 ) THEN status = sys_allocate_array( material_17_values, 1, tot_num_temps, 1, @ num_strain_values(j-13) ) status = get_field_values ( mat_fields(j), tot_num_temps, 2, 1, @ input_values, material_17_values ) ELSE IF ( j == 18 ) THEN status = sys_allocate_array( material_18_values, 1, tot_num_temps, 1, @ num_strain_values(j-13) ) status = get_field_values ( mat_fields(j), tot_num_temps, 2, 1, @ input_values, material_18_values ) ELSE IF ( j == 19 ) THEN status = sys_allocate_array( material_19_values, 1, tot_num_temps, 1, @ num_strain_values(j-13) ) status = get_field_values ( mat_fields(j), tot_num_temps, 2, 1, @ input_values, material_19_values ) END IF END IF END FOR /* write out the material record */ IF ( file_channel == 0 ) THEN status = text_open ( file_name, “NW”, 0, 0, file_channel ) status = text_write_string ( file_channel, @ “$ PATRAN 2.5 P/FEA auxilary data file created by PCL “”pfea_xxx_aux_file” “functions” ) status = text_write_string ( file_channel, @ “” ) END IF mats_written = mats_written + 1 IF ( mats_written == 1 ) THEN status = text_write_string ( file_channel, @“$ Nonlinear and/or temperature dependent material records” ) status = text_write_string ( file_channel, @ “” ) END IF status = text_write_string ( file_channel, “$ Material: “//material_name ) status = text_write_string ( file_channel, “$ Description: “//material_description ) status = text_write ( file_channel, “*MID = %I%”, material_id, 0.0, “” ) IF ( material_dir == 2 ) THEN status = text_write_string( file_channel, “ORTHOTROPIC” ) ELSE status = text_write_string( file_channel, “ISOTROPIC” ) END IF IF ( tot_num_temps == 0 ) THEN num_loops = 1 ELSE num_loops = tot_num_temps END IF FOR ( j = 1 TO num_loops ) IF ( tot_num_temps > 0 ) THEN status = text_write ( file_channel, “TEMPERATURE = %G%”, 0, tot_temp_values(j), “” ) END IF FOR ( k = 1 TO 19 )

PCL and CustomizationExamples of Translation

810

IF ( k == 1 && material_dir == 1 ) THEN name = “E” ELSE IF ( k == 1 ) THEN name = “E11” ELSE IF ( k == 2 ) THEN name = “E22” ELSE IF ( k == 3 ) THEN name = “E33” ELSE IF ( k == 4 && material_dir == 1 ) THEN name = “NU” ELSE IF ( k == 4 ) THEN name = “NU12” ELSE IF ( k == 5 ) THEN name = “NU13” ELSE IF ( k == 6 ) THEN name = “NU23” ELSE IF ( k == 7 ) THEN name = “G12” ELSE IF ( k == 8 ) THEN name = “G13” ELSE IF ( k == 9 ) THEN name = “G23” ELSE IF ( k == 10 && material_dir == 1 ) THEN name = “ALPHA” ELSE IF ( k == 10 ) THEN name = “ALPHA11” ELSE IF ( k == 11 ) THEN name = “ALPHA22” ELSE IF ( k == 12 ) THEN name = “ALPHA33” ELSE IF ( k == 13 ) THEN name = “DENSITY” ELSE IF ( k == 14 && material_dir == 1 ) THEN title = “STRESS VS. STRAIN” name = “STRESS(“ ELSE IF ( k == 14 ) THEN title = “SXX VS. STRAIN” name = “SXX(“ ELSE IF ( k == 15 ) THEN title = “SYY VS. STRAIN” name = “SYY(“ ELSE IF ( k == 16 ) THEN title = “SZZ VS. STRAIN” name = “SZZ(“ ELSE IF ( k == 17 ) THEN title = “SXY VS. STRAIN” name = “SXY(“ ELSE IF ( k == 18 ) THEN title = “SYZ VS. STRAIN” name = “SYZ(“ ELSE IF ( k == 19 ) THEN title = “SZX VS. STRAIN” name = “SZX(“ END IF IF ( mat_types(k) == 1 ) THEN status = text_write ( file_channel, “%A% = %G%”, 0, mat_values(k), name ) ELSE IF ( mat_types(k) == 2 ) THEN IF ( k == 1 ) THEN status = text_write ( file_channel, “%A% = %G%”, 0, @ material_1_values(j), name ) ELSE IF ( k == 2 ) THEN status = text_write ( file_channel, “%A% = %G%”, 0, @ material_2_values(j), name ) ELSE IF ( k == 3 ) THEN status = text_write ( file_channel, “%A% = %G%”, 0, @ material_3_values(j), name ) ELSE IF ( k == 4 ) THEN status = text_write ( file_channel, “%A% = %G%”, 0, @

811Chapter 8: Accessing the Patran DatabaseExamples of Translation

material_4_values(j), name ) ELSE IF ( k == 5 ) THEN status = text_write ( file_channel, “%A% = %G%”, 0, @ material_5_values(j), name ) ELSE IF ( k == 6 ) THEN status = text_write ( file_channel, “%A% = %G%”, 0, @ material_6_values(j), name ) ELSE IF ( k == 7 ) THEN status = text_write ( file_channel, “%A% = %G%”, 0, @ material_7_values(j), name ) ELSE IF ( k == 8 ) THEN status = text_write ( file_channel, “%A% = %G%”, 0, @ material_8_values(j), name ) ELSE IF ( k == 9 ) THEN status = text_write ( file_channel, “%A% = %G%”, 0, @ material_9_values(j), name ) ELSE IF ( k == 10 ) THEN status = text_write ( file_channel, “%A% = %G%”, 0, @ material_10_values(j), name ) ELSE IF ( k == 11 ) THEN status = text_write ( file_channel, “%A% = %G%”, 0, @ material_11_values(j), name ) ELSE IF ( k == 12 ) THEN status = text_write ( file_channel, “%A% = %G%”, 0, @ material_12_values(j), name ) ELSE IF ( k == 13 ) THEN status = text_write ( file_channel, “%A% = %G%”, 0, @ material_13_values(j), name ) END IF ELSE IF ( mat_types(k) == 3 ) THEN status = text_write_string ( file_channel, title ) FOR ( l = 1 TO num_strain_values(k-13) ) IF ( k == 14 ) THEN real_array(1) = strain_1_values(l) real_array(2) = material_14_values(l) ELSE IF ( k == 15 ) THEN real_array(1) = strain_2_values(l) real_array(2) = material_15_values(l) ELSE IF ( k == 16 ) THEN real_array(1) = strain_3_values(l) real_array(2) = material_16_values(l) ELSE IF ( k == 17 ) THEN real_array(1) = strain_4_values(l) real_array(2) = material_17_values(l) ELSE IF ( k == 18 ) THEN real_array(1) = strain_5_values(l) real_array(2) = material_18_values(l) ELSE IF ( k == 19 ) THEN real_array(1) = strain_6_values(l) real_array(2) = material_19_values(l) END IF status = text_write ( file_channel, “%A%%G%) = %G%”, 0, real_array, name ) END FOR ELSE IF ( mat_types(k) == 4 ) THEN status = text_write_string ( file_channel, title ) FOR ( l = 1 TO num_strain_values(k-13) ) IF ( k == 14 ) THEN real_array(1) = strain_1_values(l) real_array(2) = material_14_values(j,l) ELSE IF ( k == 15 ) THEN real_array(1) = strain_2_values(l) real_array(2) = material_15_values(j,l) ELSE IF ( k == 16 ) THEN real_array(1) = strain_3_values(l) real_array(2) = material_16_values(j,l) ELSE IF ( k == 17 ) THEN real_array(1) = strain_4_values(l) real_array(2) = material_17_values(j,l)

PCL and CustomizationExamples of Translation

812

ELSE IF ( k == 18 ) THEN real_array(1) = strain_5_values(l) real_array(2) = material_18_values(j,l) ELSE IF ( k == 19 ) THEN real_array(1) = strain_6_values(l) real_array(2) = material_19_values(j,l) END IF status = text_write ( file_channel, “%A%%G%) = %G%”, 0, real_array, name ) END FOR END IF END FOR END FOR END FOR /* close the auxilary file if necessary */ IF ( original_channel == 0 && file_channel > 0 ) THEN text_close ( file_channel, “” ) END IF IF ( num_regions > 0 ) THEN sys_free_array ( region_ids ) END IF IF ( max_num_words > 0 ) THEN sys_free_array ( word_ids ) sys_free_array ( field_ids ) sys_free_array ( word_values ) END IF RETURN END FUNCTION

Extracting Transient Load Histories The following PCL function writes the time histories for transient loads to a PATRAN 2.5 FEA auxiliary data file. The source for this example can be found in the $P3_HOME/customization directory under the name “pfea_trans_aux_file.pcl”.

FUNCTION pfea_trans_aux_file ( original_channel, file_name, original_case_name ) /* * Purpose: Extracts the loads associated with the specified transient load case * and writes their time histories to a PATRAN 2.5 P/FEA auxilary * data file. * * Input: original_channel integer the channel of the auxilary * data file. Zero if not yet opened. * file_name character string the name of the auxilary data file. * original_case_name character string the name of the transient load * case whose transient loads’ time * histories should be written to * the P/FEA auxilary file. If the * load_case_name is blank (“ ”) or * null (“”), the default load case * will be interrogated. */ INTEGER original_channel, file_channel, length, load_ids(VIRTUAL), load_case_id INTEGER load_priorities(VIRTUAL), load_case_type, status, load_type, application_type INTEGER elem_dimension, coord_id, dynamic_flag, load_var_id, entity_type, entity_id INTEGER sub_entity_id, dynamic_field, node_position, region_type, field_id INTEGER dynamic_field_array(3), null_vector_array(3), position, i, j INTEGER num_histories, max_histories, history_ids(VIRTUAL), field_var, field_dim INTEGER geom_type, geom_id, extrap_opt, data_type, field_type, num_vars INTEGER var_type_1, var_type_2, var_type_3, func_1_size, func_2_size, func_3_size INTEGER num_var_1, num_var_2, num_var_3, max_times, num_loads

813Chapter 8: Accessing the Patran DatabaseExamples of Translation

REAL evaluation_point, load_value, load_value_array(3), scale_factor, real_array(2) REAL var_2_values(1), var_3_values(1), time_values(VIRTUAL), field_values(VIRTUAL) STRING file_name[], original_case_name[], load_case_name[80], type_name[20] STRING dynamic_case_name[80], load_case_description[256], load_name[31] STRING field_name[31] LOGICAL use_default, scalar, lin_def, found file_channel = original_channel max_times = 0 /* check for a blank or null input load case name */ use_default = TRUE length = str_length ( original_case_name ) IF ( length > 0 ) THEN FOR ( i = 1 TO length ) IF ( str_substr( original_case_name, i, 1 ) != “” ) THEN use_default = FALSE END IF END FOR END IF /* if a blank or null load case name was input, fetch the default load case */ IF ( use_default ) THEN status = db_get_active_load_case ( load_case_name ) ELSE load_case_name = original_case_name END IF /* allocate memory for load ids belonging to this load case and fetch those ids */ status = db_count_lbc_by_load_case ( load_case_name, num_loads ) IF ( num_loads == 0 ) THEN RETURN END IF status = sys_allocate_array ( load_ids, 1, num_loads ) status = sys_allocate_array ( load_priorities, 1, num_loads ) status = db_get_load_case ( load_case_name, load_case_id, load_case_type, @ load_case_description, num_loads, load_ids, dynamic_case_name, @ evaluation_point, load_priorities ) IF ( load_case_type != 2 ) THEN RETURN END IF /* ensure that the loads of this load case are evaluated upon the finite * element entities */ status = lbc_eval_fem_by_lc ( load_case_name ) num_histories = 0 max_histories = 0 /* loop through the loads writing any time histories to the auxilary file */ FOR ( i = 1 TO num_loads ) status = db_get_lbc ( load_ids(i), load_name, load_type, application_type, @ elem_dimension, coord_id, dynamic_flag ) IF ( dynamic_flag == 0 ) THEN CONTINUE END IF /* check that the load is of one of the proper types: force, pressure or temperature */ IF ( load_type == 7 ) THEN type_name = “FORCE” ELSE IF ( load_type == 8 ) THEN type_name = “PRESSURE” ELSE IF ( load_type == 9 ) THEN type_name = “TEMPERATURE” ELSE CONTINUE END IF /* determine the data type of the load: scalar or vector */ IF ( load_type == 7 ) THEN scalar = FALSE ELSE scalar = TRUE

PCL and CustomizationExamples of Translation

814

END IF /* fetch all the load values */ field_id = 0 IF ( scalar ) THEN status = db_get_all_fem_ds_by_id ( load_ids(i) ) WHILE ( db_get_next_fem_ds_by_id( load_var_id, entity_type, entity_id, @ sub_entity_id, load_value, dynamic_field, scale_factor, @ node_position, region_type ) == 0 ) IF ( dynamic_field > field_id ) THEN field_id = dynamic_field END IF END WHILE ELSE status = db_get_all_fem_dv_by_id ( load_ids(i) ) WHILE ( db_get_next_fem_dv_by_id( load_var_id, entity_type, entity_id, @ sub_entity_id, load_value_array, dynamic_field_array, @ null_vector_array, scale_factor, @ node_position, region_type ) == 0 ) FOR ( j = 1 TO 3 ) IF ( dynamic_field_array(j) > field_id ) THEN field_id = dynamic_field_array(j) END IF END FOR END WHILE END IF IF ( field_id <= 0 ) THEN CONTINUE END IF /* link the load set id with the proper time history table */ found = FALSE position = 0 IF ( num_histories > 0 ) THEN FOR ( j = 1 TO num_histories ) IF ( field_id == history_ids(j) ) THEN found = TRUE position = j END IF END FOR END IF /* open the auxilary data file, if necessary */ IF ( file_channel == 0 ) THEN status = text_open ( file_name, “NW”, 0, 0, file_channel ) status = text_write_string ( file_channel, @ “$ PATRAN 2.5 P/FEA auxilary data file created by PCL” “pfea_xxx_aux_file” “functions” ) status = text_write_string ( file_channel, @ “ ”) END IF /* write out the load case name and description */ IF ( num_histories == 0 ) THEN status = text_write_string ( file_channel, @ “$ Transient loads for load case: “//load_case_name ) status = text_write_string ( file_channel, @ “$ Load case description: “//load_case_description ) status = text_write_string ( file_channel, @ “ “ ) END IF /* if a new transient data field, add it to the list of time history fields */ IF ( !found ) THEN num_histories = num_histories + 1 position = num_histories IF ( max_histories == 0 ) THEN max_histories = max_histories + 100 status = sys_allocate_array ( history_ids, 1, max_histories ) ELSE IF ( num_histories > max_histories ) THEN max_histories = max_histories + 100 status = sys_reallocate_array ( history_ids, 1, max_histories ) END IF

815Chapter 8: Accessing the Patran DatabaseExamples of Translation

history_ids(position) = field_id END IF /* write out the dynamic command */ status = text_write_string ( file_channel, “$ Dynamic load: “//load_name ) status = text_write ( file_channel, “*DYNAMIC_LOAD = %I%”, load_ids(i), 0.0, “ “ ) status = text_write ( file_channel, “TYPE = %A%”, 0, 0.0, type_name ) status = text_write ( file_channel, “TIME_HISTORY = %I%”, position, 0.0, “ “ ) status = text_write_string ( file_channel, “ “ ) END FOR /* loop through the number of transient data fields referenced, writing * each one out */ IF ( num_histories > 0 ) THEN FOR ( i = 1 TO num_histories ) /* write out the load case name and description */ IF ( i == 1 ) THEN status = text_write_string ( file_channel, @ “$ Time histories for load case: “//load_case_name ) status = text_write_string ( file_channel, @ “$ Load case description: “//load_case_description ) status = text_write_string ( file_channel, @ “ “ ) END IF /* get information about the referenced data field */ status = db_get_field ( history_ids(i), field_name, field_var, field_dim, geom_type, @ geom_id, extrap_opt, data_type, coord_id, field_type, num_vars, @ var_type_1, var_type_2, var_type_3, func_1_size, func_2_size, @ func_3_size, lin_def, num_var_1, num_var_2, num_var_3 ) IF ( field_dim == 0 && field_type == 1 && @ num_vars == 1 && var_type_1 == 13 && num_var_1 > 0 ) THEN IF ( num_var_1 > max_times ) THEN max_times = num_var_1 + 100 status = sys_allocate_array ( time_values, 1, max_times ) status = sys_allocate_array ( field_values, 1, max_times ) END IF /* get the field time and magnitude values */ status = db_get_field_table ( history_ids(i), num_vars, num_var_1, num_var_2, @ num_var_3, time_values, var_2_values, var_3_values, field_values ) /* write out the transient data field */ status = text_write_string ( file_channel, @“$ Time dependent data field: “//field_name ) status = text_write ( file_channel, “*TIME_HISTORY = %I%”, i, 0.0, “ “ ) FOR ( j = 1 TO num_var_1 ) real_array(1) = time_values(j) real_array(2) = field_values(j) status = text_write ( file_channel, “LOAD(%G%) = %G%”, 0, real_array, “ “ ) END FOR status = text_write_string ( file_channel, @“ “ ) END IF END FOR END IF /* close the auxilary file if necessary */ IF ( original_channel == 0 && file_channel > 0 ) THEN text_close ( file_channel, “ “ ) END IF IF ( max_times > 0 ) THEN sys_free_array ( time_values ) sys_free_array ( field_values ) END IF IF ( max_histories > 0 ) THEN sys_free_array ( history_ids ) END IF IF ( num_loads > 0 ) THEN sys_free_array ( load_ids ) sys_free_array ( load_priorities ) END IF

PCL and CustomizationExamples of Translation

816

END FUNCTION

Forward Moldflow TranslatorThe following PCL function writes model information to Moldflow input files. This function is supplied only as an illustrative example. It is not a fully-functional Moldflow translator. The source for this example can be found in the $P3_HOME/customization directory under the name “trans_mold_flow.pcl”.

/* $Header: /madrid/users9/pflib/pcl/custom/RCS/trans_mold_flow.pcl,v 1.1 92/09/01 17:53:38 sprack Exp $ */ FUNCTION trans_mold_flow ( base_file_name, analysis_title, length_scale_factor, @ trans_method, group_name ) /* * Purpose: Translate the Patran model data into MOLD FLOW style input files. * * Input: base_file_name character string the base name to be used for all the * input files. * analysis_title character string the title used to describe the analysis * and the model. * length_scale_factor real conversion factor from the model length * units to millimeters. * trans_method integer a flag indicating whether the entire * model should be translated ( 0 ), only * the currently active group should be * translated ( 1 ), or only the group * specified by group_name should be * translated ( 2 ). * group_name character string the name of the group to be translated. * Only applicable if trans_method = 2. */ INTEGER trans_method, file_channel, int_array(4), group_id, num_nodes INTEGER node_ids(VIRTUAL), ref_coords(VIRTUAL), analy_coords(VIRTUAL), i, j INTEGER num_elems, elem_ids(VIRTUAL), region_ids(VIRTUAL), elem_topo_codes(VIRTUAL) INTEGER elem_nodes(VIRTUAL), actual_num_elems, current_topo_code INTEGER shape_code(2), nodes_per_elem(2), current_region, thick_field INTEGER num_words, max_num_words, word_ids(VIRTUAL), material_id, data_type INTEGER integer_scalar, field_id, node_id, frame_id, temp_ref_coords(3) INTEGER temp_analy_coords(3), status, num_codes REAL length_scale_factor, real_array(3), glob_xyz(VIRTUAL), thickness REAL average_thick(1), real_vector(3), node_xyzs(3,3), cent_xyz(3) STRING base_file_name[], analysis_title[], group_name[], char_string[31] logical tri_3_noded /* initialize variables */ max_num_words = 0 /* open the control file */ status = text_open ( base_file_name//“.mfl”, “NW”, 0, 0, file_channel ) /* write out analysis title, scale factors and base filename */ status = text_write_string ( file_channel, analysis_title ) real_array(1) = length_scale_factor real_array(2) = length_scale_factor status = text_write ( file_channel, “%G% %G%”, 0, real_array,“ ” ) status = text_write_string ( file_channel, base_file_name ) /* close the control file */

817Chapter 8: Accessing the Patran DatabaseExamples of Translation

status = text_close ( file_channel, “ ” ) /* open the node data file */ status = text_open ( base_file_name//“.nod”, “NW”, 0, 0, file_channel ) /* determine the id of the group to translate, zero if the entire model */ group_id = 0 IF ( trans_method == 1 ) THEN status = db_get_current_group_id ( group_id ) ELSE IF ( trans_method == 2 ) THEN status = db_get_group_id ( group_name, group_id ) END IF /* count the number of nodes */ IF ( group_id == 0 ) THEN db_count_nodes ( num_nodes ) ELSE db_count_nodes_in_group ( group_id, num_nodes ) END IF IF ( num_nodes == 0 ) THEN RETURN END IF /* allocate memory for storage of the node ids and coordinates */ status = sys_allocate_array ( node_ids, 1, num_nodes ) status = sys_allocate_array ( ref_coords, 1, num_nodes ) status = sys_allocate_array ( analy_coords, 1, num_nodes ) status = sys_allocate_array ( glob_xyz, 1, num_nodes, 1, 3 ) /* fetch all the node ids */ IF ( group_id == 0 ) THEN status = db_get_node_ids ( num_nodes, node_ids ) ELSE status = db_get_all_node_ids_in_group ( num_nodes, group_id, node_ids ) END IF /* extract the node coordinates */ status = db_get_nodes ( num_nodes, node_ids, ref_coords, analy_coords, glob_xyz ) /* write the nodes to the node data file */ FOR ( i = 1 TO num_nodes ) real_array(1) = glob_xyz(i,1) real_array(2) = glob_xyz(i,2) real_array(3) = glob_xyz(i,3) status = text_write ( file_channel, “%I% %G% %G% %G%”, node_ids(i), real_array, “ ” ) END FOR /* close the node data file */ status = text_close ( file_channel, “ ” ) /* open the element data file */ status = text_open ( base_file_name//“.tri”, “NW”, 0, 0, file_channel ) /* count the number of elements */ IF ( group_id == 0 ) THEN status = db_count_elems ( num_elems ) ELSE status = db_count_elems_in_group ( group_id, num_elems ) END IF IF ( num_elems <= 0 ) THEN RETURN status = sys_allocate_array ( elem_ids, 1, num_elems ) status = sys_allocate_array ( region_ids, 1, num_elems ) status = sys_allocate_array ( elem_topo_codes, 1, num_elems ) status = sys_allocate_array ( elem_nodes, 1, num_elems, 1, 3 ) actual_num_elems = num_elems current_topo_code = 0 tri_3_noded = FALSE /* fetch all the element ids */ IF ( group_id == 0 ) THEN status = db_get_elem_ids ( num_elems, elem_ids ) ELSE status = db_get_elem_ids_in_group ( num_elems, group_id, elem_ids ) END IF /* fetch the element topology codes */ status = db_get_elem_etop ( num_elems, elem_ids, elem_topo_codes ) FOR ( i = 1 TO num_elems ) IF ( current_topo_code != elem_topo_codes(i) ) THEN

PCL and CustomizationExamples of Translation

818

num_codes = 1 int_array(1) = elem_topo_codes(i) int_array(2) = 1 status = db_get_elem_topology_data ( 2, int_array, @ shape_code, nodes_per_elem ) IF ( shape_code(1) == 3 && nodes_per_elem(1) == 3 ) THEN tri_3_noded = TRUE ELSE tri_3_noded = FALSE END IF current_topo_code = elem_topo_codes(i) END IF IF ( !tri_3_noded ) THEN FOR ( j = i TO ( num_elems - 1 ) ) elem_ids(i) = elem_ids(i+1) END FOR actual_num_elems = actual_num_elems - 1 END IF END FOR IF ( actual_num_elems == 0 ) THEN RETURN /* fetch the element connectivity */ status = db_get_nodes_for_elems ( actual_num_elems, 3, elem_ids, elem_nodes ) /* fetch the region ids for all the elements */ status = db_get_region_for_elements ( actual_num_elems, elem_ids, region_ids ) current_region = 0 thick_field = 0 thickness = 0.0 FOR ( i = 1 TO actual_num_elems ) /* determine the thickness value for the current element */ IF ( region_ids(i) <= 0 ) THEN thick_field = 0 thickness = 0.0 current_region = 0 ELSE IF ( current_region != region_ids(i) ) THEN /* fetch the element property record */ status = db_count_props ( region_ids(i), num_words ) IF ( num_words > 0 ) THEN IF ( num_words > max_num_words ) THEN max_num_words = num_words + 100 status = sys_allocate_array ( word_ids, 1, max_num_words ) END IF status = db_get_props_by_region ( num_words, region_ids(i), word_ids ) thick_field = 0 thickness = 0.0 /* loop through all the property words searching for word 36: plate thickness */ FOR ( j = 1 TO num_words ) IF ( word_ids(j) == 36 ) THEN status = db_get_prop_value ( region_ids(i), word_ids(j), material_id, @ data_type, integer_scalar, real_vector, char_string, @ frame_id, node_id, field_id ) IF ( mth_abs( data_type ) == 1 || mth_abs( data_type ) == 7 ) THEN IF ( field_id > 0 ) THEN thick_field = field_id thickness = 0.0 ELSE thick_field = 0 thickness = real_vector(1) END IF END IF END IF END FOR ELSE thick_field = 0 thickness = 0.0 END IF current_region = region_ids(i) END IF /* if the plate thickness is a spatially varying field reference, evaluate the

819Chapter 8: Accessing the Patran DatabaseExamples of Translation

* field at the element centroid */ IF ( thick_field > 0 ) THEN /* get the coordinates of the nodes making up the element */ int_array(1) = elem_nodes(i,1) int_array(2) = elem_nodes(i,2) int_array(3) = elem_nodes(i,3) status = db_get_nodes ( 3, int_array, temp_ref_coords, @ temp_analy_coords, node_xyzs ) cent_xyz(1) = node_xyzs(1,1) + node_xyzs(2,1) + node_xyzs(3,1) cent_xyz(1) = cent_xyz(1) / 3.0 cent_xyz(2) = node_xyzs(1,2) + node_xyzs(2,2) + node_xyzs(3,2) cent_xyz(2) = cent_xyz(2) / 3.0 cent_xyz(3) = node_xyzs(1,3) + node_xyzs(2,3) + node_xyzs(3,3) cent_xyz(3) = cent_xyz(3) / 3.0 status = get_field_values ( thick_field, 1, 3, 1, cent_xyz, average_thick ) ELSE average_thick(1) = thickness END IF /* write out the element record to the element file */ int_array(1) = elem_ids(i) int_array(2) = elem_nodes(i,1) int_array(3) = elem_nodes(i,2) int_array(4) = elem_nodes(i,3) status = text_write ( file_channel, “%I% %I% %I% %I% %G%”, int_array, @ average_thick, “ ” ) END FOR /* close the element data file */ status = text_close ( file_channel, “ ” ) END FUNCTION

PCL and CustomizationExamples of Translation

820

Chapter 9: PATRAN 2.5 Database CompatibilityPCL and Customization

9 PATRAN 2.5 Database Compatibility

Introduction

PATRAN 2.5 Compatible Database Functions

PCL and CustomizationIntroduction

822

IntroductionThe database functions described in this chapter offer compatibility with the PATRAN 2.5 database interface (G/DB-ACCESS). It is preferable to use the standard database interface described in Accessing the Patran Database instead of these routines. These routines are provided for PATRAN 2.5 compatibility purposes only. Only the PCL callable functions are described in this chapter.

823Chapter 9: PATRAN 2.5 Database CompatibilityPATRAN 2.5 Compatible Database Functions

PATRAN 2.5 Compatible Database Functions

db_create_element_list (get, numelm, loc )

Description:

Create a List of Existing Element ID’s in Virtual Memory.

If element indexing is on, generate or release a sorted list of existing element ID’s in virtual memory. If element indexing is off, just return the maximum element ID.

Input:

LOGICAL get If true, create list; if false, release list.

Output:

INTEGER numelm Number of elements processed (if indexing is off, this is maximum element ID).

INTEGER loc Index relative to IVAL(1) in common XMEM where node ID list begins (set to zero if node indexing is off).

Error Conditions:

None.

db_create_node_list (get, numnod, loc )

Description:

Create a List of Existing Node ID’s in Virtual Memory.

Input:

LOGICAL get If true, create list; if false, release list.

Output:

INTEGER numnod Number of nodes processed (if indexing is off, this is maximum node ID).

INTEGER loc Index relative to IVAL(1) in common XMEM where node ID list begins (set to zero if node indexing is off).

Error Conditions:

None.

db_element (elno, shape, nodes, conf, pid, ceid, data, node, adata, noasoc, nodbem, status )

PCL and CustomizationPATRAN 2.5 Compatible Database Functions

824

Description:

Get Data Associated with an Element.

Input:

INTEGER elno Element number for which data is requested.

Output:

INTEGER shape 2 = bar3 = triangle4 = quadrangle5 = tetrahedron7 = wedge8 = hexagon

INTEGER nodes Number of nodes.

INTEGER conf Element configuration.

INTEGER pid Property ID or material ID (if.lt. 0). In MSC Patran, the region ID.

INTEGER ceid Congruent element ID.

REAL(3) data Material orientation angles. For bars, these are the coordinates of the bar ends if offset.

INTEGER(64) node ID of the node defining the XY-plane

REAL(6) adata Associated data. For bars, these are the coordinates of the bar ends if offset.

INTEGER noasoc Number of associated data values.

INTEGER nodbem ID of the node defining the XY-plane.

INTEGER status Return status: 0 = normal1 = non-existent element

Error Conditions:

None.

db_entity_counts (size1, size2, ncount, gcount, names, ndfeg, dftabl, mpc, status )

825Chapter 9: PATRAN 2.5 Database CompatibilityPATRAN 2.5 Compatible Database Functions

Description:

Count Database Entities.

Return the number of nodes, elements, materials and element properties in “ncount”, maximum ID’s of Phase I entities in “size1”. Maximum of Phase II entities in “size2”, total number of GFEG records in “gcount” and the total number of named components in “names”.

Input:

None.

Output:

INTEGER(12) size1 Maximum of Phase I entities.size1 [0] = Max point ID’ssize1 [1] = Max curve ID’ssize1 [2] = Max surface ID’ssize1 [3] = Max solid ID’ssize1 [4] = Max Coord ID’ssize1 [5] = Max Dline ID’s ->0size1 [6] = Max Dpat ID’s UNDEFINEDsize1 [7] = Max Dhpat ID’s UNDEFINEDsize1 [8] = Max Pmat ID’ssize1 [9] = Max List ID’s UNDEFINEDsize1 [10] = Max Data ID’s UNDEFINEDsize1 [11] = Max Field ID’s

PCL and CustomizationPATRAN 2.5 Compatible Database Functions

826

INTEGER(30) size2 Maximum of Phase II entities.size2 [0] = Max Node ID’ssize2 [1] = Max Beam ID’ssize2 [2] = Max Triangle ID’ssize2 [3] = Max Quadrangle ID’ssize2 [4] = Max Tetrahedron ID’ssize2 [5] = Max Pyramid ID’ssize2 [6] = Max Wedge ID’ssize2 [7] = Max Hexagon ID’ssize2 [8] = Max MaxEl ID’ssize2 [9] = Max MaxPid ID’ssize2 [10] = Max DofList1 ID’ssize2 [11] = Max DofList2 ID’s UNDEFINEDsize2 [12] = Max DofList3 ID’s UNDEFINEDsize2 [13] = Max DofList4 ID’s UNDEFINEDsize2 [14] = Max DofList5 ID’s UNDEFINEDsize2 [15] = Max DofList6 ID’s UNDEFINEDsize2 [16] = Max DofList7 ID’s UNDEFINEDsize2 [17] = Max DofList8 ID’s UNDEFINEDsize2 [18] = Max DofList9 ID’s UNDEFINEDsize2 [19] = Max DofList10 ID’s UNDEFINEDsize2 [20] = Max Mass ID’ssize2 [21] = Max Spring ID’ssize2 [22] = Max Weld ID’s UNDEFINEDsize2 [23] = Max Part ID’s UNDEFINEDsize2 [24] = Max Joint ID’s UNDEFINEDsize2 [25] = Max Marker ID’s UNDEFINEDsize2 [26] = RESERVED ID’s UNDEFINEDsize2 [27] = Max Force ID’s UNDEFINEDsize2 [28] = Max Output ID’s UNDEFINEDsize2 [29] = Max MCP ID’s UNDEFINED

INTEGER(5) ncount Node, element, material, property and coordinate frame counts.ncount [0] = Node countncount [1] = Element countncount [2] = Material countncount [3] = Property countncount [4] = Coordinate Frame count

INTEGER gcount Number of GFEG records.

INTEGER names Number of named components. (groups).

INTEGER(15) ndfeg Number of DFEG records for each of packet 6 through 11 and 15 through 18.

827Chapter 9: PATRAN 2.5 Database CompatibilityPATRAN 2.5 Compatible Database Functions

Remarks:

The input value database_type can have the following upper case values.

INTEGER(3000) dftabl The set ID and the number of records in each set for each DFEG packet.

INTEGER(2) mpc Total MCP equations and maximum number of MPC equations.mpc [0] = Total MPC equationsmpc [1] = Maxim MPC equations

INTEGER status = 0.

Error Conditions:

None.

db_get_maximum_id (database_type, error_value )

Description:

This function will return the entity identifier with the highest numerical value used for a specific database entity type.

Input:

STRING database_type This value is used to identify the entity type. It should always be an uppercase value. See the table below for the entity types allowed.

Output:

INTEGER error_value This value is used to return an error or status value. This value will be set to 0 if the function succeeded and will be set to 1 if the input value database_type is set incorrectly. This value will be set to a non-zero value if a database error occurs.

INTEGER <Return Value> This function can return any value and the value returned has no meaning.

database_type Description

Value

“GR” grid

PCL and CustomizationPATRAN 2.5 Compatible Database Functions

828

Example:

None.

“LIN” curve

“PA” surface

“HP” solid

“HY” solid

“COR” coordinate frame

“CID” coordinate frame

“FI” field

“NO” node

“BE” beam element

“BA” beam element

“TR” triangular element

“QU” quad element

“TE” tet element

“PY” pyramid element

“WE” wedge element

“HE” hex element

“EL” all elements

“NA” Groups

829Chapter 9: PATRAN 2.5 Database CompatibilityPATRAN 2.5 Compatible Database Functions

db_get_next_id (listed, i, loc )

Description:

If indexing is on, get ID(i) from ID-list; otherwise return i.

Input:

LOGICAL listed If true, return NEXTID = ID-list (i). If false, return NEXTID = i.

INTEGER i Index.

INTEGER loc ist of ID’s.

Output:

None.

Error Conditions:

None.

db_grid (grid, rdata, status )

Description:

Get X-Y-Z Coordinates of a Grid.

Input:

INTEGER grid Grid number for which coordinates are requested.

Output:

REAL(3) rdata Coordinates of “grid.”

INTEGER status Return status: 0 = normal1 = non-existent grid2 = no data

Error Conditions:

None.

db_hyperpatch (hpat, coef, grids, status )

Description:

Get Geometric Data for Hyperpatch “label.”

Input:

PCL and CustomizationPATRAN 2.5 Compatible Database Functions

830

INTEGER hpat Hyperpatch label for which data is requested.

Output:

REAL coef (192) 64x3 matrix of geometric hyperpatch coefficients.

INTEGER grids (8) Corner points grid ID’s.

INTEGER status Return status:0 = normal1 = non-existent hyperpatch2 = no data

Error Conditions:

None.

831Chapter 9: PATRAN 2.5 Database CompatibilityPATRAN 2.5 Compatible Database Functions

db_import_database (dbname, types, elist, offset, prefix, merge_flags, nsig, node_equiv, point_equiv, method, tolerance )

Description:

Main driver for the database import operation.

Input:

STRING[ ] dbname The name of the database whose data is to be imported.

STRING[20]() types A list of types of entities to be imported.

STRING[256]() elist Array of entity lists for each entity type ("All", "None", or a list of labels or names).

INTEGER() offset Array of ID offsets for each numbered entity conflict resolution (one offset per entity type).

STRING[31]() prefix Array of prefixes for named entity conflict resolution (one prefix per entity type).

LOGICAL() merge_flags The values of the merge toggles for materials, element properties, lbcs, load cases, fields, and groups respectively.

INTEGER nsig The number of significant digits for real number comparisons.

LOGICAL node_equiv Node equivalencing flag.

LOGICAL point_equiv Point equivalencing flag.

STRING[ ] method Equivalence method ("cube" or "sphere").

REAL tolerance Equivalence tolerance.

<Return Value> = 0 Function was successful.

Output:

None.

Side Effects:

Messages A summary spreadsheet will be displayed.

Database The requested data will be imported to the primary database.

Graphics The requested data will be posted to the current or specified group.

Error Conditions:

To be determined.

PCL and CustomizationPATRAN 2.5 Compatible Database Functions

832

db_import_database_V2 (dbname, types, elist, offset, prefix, merge_flags, nsig, node_equiv, point_equiv, method, tolerance, dfem_combine, lbc_equivopt )

Description:

Version 2 of the main driver for the database import operation with the addition of LBC equivalencing.

Input:

STRING[ ] dbname The name of the database whose data is to be imported.

STRING[20]() types A list of types of entities to be imported.

STRING[256]() elist Array of entity lists for each entity type ("All", "None", or a list of labels or names).

INTEGER() offset Array of ID offsets for each numbered entity conflict resolution (one offset per entity type).

STRING[31]() prefix Array of prefixes for named entity conflict resolution (one prefix per entity type).

LOGICAL() merge_flags The values of the merge toggles for materials, element properties, lbcs, load cases, fields, and groups respectively.

INTEGER nsig The number of significant digits for real number comparisons.

LOGICAL node_equiv Node equivalencing flag.

LOGICAL point_equiv Point equivalencing flag.

STRING[ ] method Equivalence method ("cube" or "sphere").

REAL tolerance Equivalence tolerance.

LOGICAL dfem_combine Discrete FEM field combining flag.

STRING[8]() lbc_equivopt Array of equivalence options for BCs, Vector Loads, and Scalar Loads (“useprim”, ”add” or “average”).

<Return Value> = 0 Function was successfu

Output:

None.

Side Effects:

Messages A summary spreadsheet will be displayed.

Database The requested data will be imported to the primary database.

Graphics The requested data will be posted to the current or specified group.

833Chapter 9: PATRAN 2.5 Database CompatibilityPATRAN 2.5 Compatible Database Functions

Error Conditions:

To be determined.

PCL and CustomizationPATRAN 2.5 Compatible Database Functions

834

db_import_database_V3 (dbname, types, elist, offset, prefix, merge_opts, nsig, node_equiv, point_equiv, method, tolerance, dfem_combine, lbc_equivopt )

Description:

Version 3 of the main driver for the database import operation with the addition of Material and Property merging with non-duplicate names. The only difference from db_import_database_V2, is the merge_opts argument.

Input:

STRING[ ] dbname The name of the database whose data is to be imported.

STRING[20]() types A list of types of entities to be imported.

STRING[256]() elist Array of entity lists for each entity type ("All", "None", or a list of labels or names).

INTEGER() offset Array of ID offsets for each numbered entity conflict resolution (one offset per entity type).

STRING[31]() prefix Array of prefixes for named entity conflict resolution (one prefix per entity type).

STRING[ ]() merge_opts The values of the merge options for materials, element properties, lbcs, load cases, fields, groups, and DOF lists respectively. Valid options for materials and element properties are:

“NONE”=Do not merge“DATA_ONLY”=Ignore name on merge, only data must

match. Merges to the first alphanumeric found with duplicate data.“DATA_CHECK_NAME”=Check for duplicate name first. If found, and data is duplicate, merge. If not found, or found and data is not duplicate, behave same as “DATA_ONLY”.“DATA_AND_NAME”=Name and data must be duplicate to merge.

Valid options for lbcs, load cases, fields, groups, and DOF lists are:

“NONE”=Do not merge“DATA_AND_NAME”=Name and/or name and data must be duplicate to merge.

INTEGER nsig The number of significant digits for real number comparisons.

835Chapter 9: PATRAN 2.5 Database CompatibilityPATRAN 2.5 Compatible Database Functions

LOGICAL node_equiv Node equivalencing flag.

LOGICAL point_equiv Point equivalencing flag.

STRING[ ] method Equivalence method ("cube" or "sphere").

REAL tolerance Equivalence tolerance.

LOGICAL dfem_combine Discrete FEM field combining flag.

STRING[8]() lbc_equivopt Array of equivalence options for BCs, Vector Loads, and Scalar Loads (“useprim”, ”add” or “average”).

<Return Value> = 0 Function was successful.

Output:

None.

Side Effects:

Messages A summary spreadsheet will be displayed.

Database The requested data will be imported to the primary database.

Graphics The requested data will be posted to the current or specified group.

Error Conditions:

To be determined.

PCL and CustomizationPATRAN 2.5 Compatible Database Functions

836

db_line (line, coef, grids, status )

Description:

Get Geometric Data for Line “line.”

Input:

INTEGER line Line label for which data is requested.

Output:

REAL(12) coef 4x3 matrix of geometric line coefficients.

NTEGER(2) grids End point grid ID’s.

INTEGER status Return status:0 = normal1 = non-existent line2 = no data

Error Conditions:

None.

db_mpc (mpcid, nterms, nbuf, ntot, ndep, idat, constr, mpcdat, num, status )

Description:

Not supported in MSC Patran.

Input:

INTEGER mpcid Unknown.

INTEGER nterms Unknown.

INTEGER nbuf Unknown.

Output:

INTEGER nterms Unknown.

INTEGER ntot Unknown.

INTEGER ndep Unknown.

INTEGER(12) idat Unknown.

REAL constr Unknown.

INTEGER() mpcdat Unknown.

INTEGER num Unknown.

INTEGER status Unknown.

837Chapter 9: PATRAN 2.5 Database CompatibilityPATRAN 2.5 Compatible Database Functions

Error Conditions:

None.

PCL and CustomizationPATRAN 2.5 Compatible Database Functions

838

db_node (node, xyz, conden, type, nodof, config, coordf, spcf, status)

Description:

Get Data Associated with a Nodal Point.

Input:

INTEGER node Node number for which data is requested.

Output:

REAL(3) xyz x, y, z global coordinates.

INTEGER conden Condensation flag (0 = unreferenced).

STRING type Node type (Hollerith).

INTEGER nodof Number of degrees-of-freedom.

INTEGER config Node configuration.

INTEGER coordf Reference coordinate system number.

INTEGER(6) spcf Up to 6 single point constraint flags.

INTEGER status Return status:0 = normal1 = non-existent node

Error Conditions:

None.

db_patch (patch, coef, grids, status )

Input:

INTEGER patch Patch number for which data is requested.

Output:

REAL(48) coef 16x3 matrix of geometric patch coefficients.

INTEGER(4) grids Corner point grid ID’s.

INTEGER status Return status:0 = norma1 = non-existent patch2 = no data

Error Conditions:

None.

839Chapter 9: PATRAN 2.5 Database CompatibilityPATRAN 2.5 Compatible Database Functions

dbi_query_database (dbname, report_flag, report_file, ntypes, types, counts, mins, maxs, geotol )

Description:

Query the contents of the specified database

Input:

STRING[ ] dbname The name of the database.

LOGICAL report_flag TRUE if a report is to be generated.

STRING[ ] report_file The name of the report file.

Output:

INTEGER ntypes The number of entity types.

INTEGER() types The entity types (e.g. DbTypPoint)

INTEGER() counts The number of entities of each type.

INTEGER() mins The minimum ID (label) for each type.

INTEGER() maxs The maximum ID (label) for each type.

REAL geotol Geometric tolerance in query database.

<Return Value> = 0 Function was successful

Error Conditions:

None.

PCL and CustomizationPATRAN 2.5 Compatible Database Functions

840

Chapter 10: Broken, Obsolete, Modified and New FunctionsPCL and Customization

10 Broken, Obsolete, Modified and New Functions

Introduction

Basic Functions (Chapter 3)

System and Utility Functions (Chapter 4)

User Interface and List Processor Functions (Chapter 5)

Creating New Analysis Forms Using PCL (Chapter 6)

Modifying the Database Using PCL (Chapter 7)

Accessing the Patran Database (Chapter 8)

PATRAN 2.5 Database Compatibility (Chapter 9)

PCL and CustomizationIntroduction

842

IntroductionThis chapter of the PCL and Customization document contains a listing of all the functions that have been found to contain some sort of error in Chapters 2 through 9 of the documentation that could affect the use of the function. The routine name is given along with a description of what issues were found, a resolution to the issue, and the original function information. Where applicable, the new function information is also given. All spelling, spacing, and grammar errors have been fixed and in those instances where the issues are only with the documentation of the function, a change has been made in the new release of the PCL and Customization.

843Chapter 10: Broken, Obsolete, Modified and New FunctionsBasic Functions (Chapter 3)

Basic Functions (Chapter 3)string_newline_count Issue:None.

Resolution:Name.

Type:New.

string_newline_position Issue:None.

Resolution:Name.

Type:New.

PCL and CustomizationSystem and Utility Functions (Chapter 4)

844

System and Utility Functions (Chapter 4)sys_class_get Issue:Inadequate function description.

Resolution:Modified function description.

Type:Modified.

Original Description Information:

sys_class_get ( class_name, varname )

Description:

Retrieve the contents of a variable from a specified class.

Input:

STRING classname Class name specified as a string.

STRING varname Variable name specified as a string.

Output:

LOGICAL <Return Value> True if hash table found; FALSE otherwise.

Error Conditions:

None.

New Description Information:

sys_class_get ( class_name, )

Description:

This function will return the value of a classwide variable from a class of PCL functions.

Input:

STRING class_name[32] This value specifies the name of the PCL function class from which the variable value will be retrieved.

STRING variable_name[32]

This value specifies the name of the variable which will have its value retrieved.

Output:

DYNAMIC_ILRSW <Return Value> This function returns the value from the specified variable which is a member of the specified class.

Error Conditions:

None.

845Chapter 10: Broken, Obsolete, Modified and New FunctionsSystem and Utility Functions (Chapter 4)

Remarks:

This function assumes that the caller already knows the data type of the variable whose contents will be returned.

Example:

None.

sys_eval Issue:Argument list changed.

Resolution:Updated the function listing in the body of the document.

Type:Modified.

Original Description Information:

sys_eval ( string )

Description:

Compile and execute PCL expression contained in a string.

Input:

STRING string PCL expression contained in the string. The expression is evaluated under global context, therefore it can not make use of local variables.

Output:

STRING tablename Name of a system hash table.

ANY <Return Value>

Result of the evaluation of the PCL expression. Datatype depends on the contents of the string expression.

New Description Information:

sys_eval ( pcl_expression )

Description:

This function will execute a PCL expression contained in a string.

Input:

STRING pcl_expression This value provides the PCL expression that will be evaluated. This expression is evaluated in a global context where it will be assumed that any variables in the PCL expression will have a global scope. This global context prevents the use of any local variables in the PCL expression.

Output:

DYNAMIC <Return Value> This function will return the results of the evaluated PCL expression. The type of the data returned will be defined by the evaluated PCL expression.

PCL and CustomizationSystem and Utility Functions (Chapter 4)

846

Error Conditions:

None.

847Chapter 10: Broken, Obsolete, Modified and New FunctionsUser Interface and List Processor Functions (Chapter 5)

User Interface and List Processor Functions (Chapter 5)

Remarks:

Memory is allocated for the output variable within this function. If memory was allocated prior to the call, it is released prior to re-allocation. Therefore, if this function is used within a loop, there is no need to release the memory of the output variable.

Example:

INTEGER status, case_sensitiveSTRING in_list[100], keyword[32], return_list[VIRTUAL]

in_list = “Node 1 Curve 4 Node 2:3 Element 5”keyword = “Node”case_sensitive = 0 /* FALSE */$ for which return_list=”Node 1 2:3”$ notice that we do not obtain “Node 1:3”

lp_sub_str_ent_type Issue:Not supported in Patran.

Resolution:Removed the function description from the documentation.

Type:Obsolete.

Description:

This function concatenates substrings from the list processor string according to entity type keyword. List processor functionaliy is not envoqued (the strings is not interpreted).

Input:

STRING in_list[] This value specifies the list processor string of entities.

STRING keyword[] This value specifies the keyword for extracting entity substrings. Ex: “Point”, “Curve”, “Surface”, “Solid”, “Node”, Element”, “MPC”.

INTEGER case_sensitive This value specifies 0 (FALSE) not to be case sensitive, 1 (TRUE) otherwise.

Output:

STRING return_list[VIRTUAL] This value returns a list processor string of entities.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate an error.

Error Conditions:

-1 This is an internal error status condition. There is no corresponding status message in the message database.

PCL and CustomizationUser Interface and List Processor Functions (Chapter 5)

848

status = lp_sub_str_ent_type(in_list, keyword, case_sensitive, @ return_list)IF (0 < status) THEN msg_to_form(status, 4, 0, 0, 0.0, ““)ELSE IF (0 > status) THEN /* Error information already displayed */ ELSE write_line(“return_list =”, return_list) END IFEND IF

ui_file_create Issue:Argument description changed.

Resolution:Updated the function description in the body of the document..

Type:Modified.

Original Description Information:

ui_file_create (parent, callback, x, y, width, num_rows, filter_label, filter_mask, dirs_label, files_label, selection_label, selection, ok_label, filterbutton_label, cancel_label )

Function:

Creates a file selection widget.

Input:

WIDGET parent Parent widget ID. Must be a frame, a form or a modal form.

STRING callback Name of the PCL function that is called for an event in this widget. The function must be in the class in which the widget is created. Use ““ if events for this widget are not of interest.

NUMERIC x X location of the widget in inches relative to the parent.

NUMERIC y Y location of the widget in inches relative to the parent.

NUMERIC width Width of the file widget, in inches.

INTEGER num_rows Number of items to display in the files and directory listboxes.

STRING filter_label Label describing the filter databox.

STRING filter_mask Used to specify which files appear in the listbox.

STRING dirs_label Label to appear above the listbox containing the directories.

STRING files_label Label to appear above the listbox containing the files relevant to the filter_mask.

STRING selection_label Label describing the selection databox.

STRING selection Filename to appear in the databox labeled selection_label. Also highlights in listbox, if present.

STRING ok_label Label describing the OK button.

STRING filterbutton_label Label describing the Filter button.

STRING cancel_label Label describing the Cancel button.

849Chapter 10: Broken, Obsolete, Modified and New FunctionsUser Interface and List Processor Functions (Chapter 5)

Output:

WIDGET <Return Value> Widget ID. NULL if the widget could not be created.

Error Conditions:

None.

PCL and CustomizationUser Interface and List Processor Functions (Chapter 5)

850

Comments:

The PCL callback function will be called when the OK button or the Cancel button is selected. Selecting the OK button instructs the UIMS to pass two arguments; the complete pathname of the selected file and “OPEN.” Selecting the Cancel button instructs the UIMS to pass two arguments; the first is not used and will be set to ““, and “CANCEL.”

851Chapter 10: Broken, Obsolete, Modified and New FunctionsUser Interface and List Processor Functions (Chapter 5)

New Description Information:

ui_file_create (parent, callback, x, y, width, num_rows, filter_label, filter_mask, dirs_label, files_label, selection_label, selection, ok_label, filterbutton_label, cancel_label )

Description:

This function will create a file selection form.

Input:

WIDGET parent_id This value specifies a widget identifier for the parent widget of this form.

STRING callback_func[] This value specifies the name of the PCL function that will be called for an event representing a form event. This call back function must be a member of the class in which this widget is created.

REAL x_location This value specifies the x axis location of the file widget in pixels relative to the upper left corner of the parent widget.

REAL y_location This value specifies the y axis location of the file widget in pixels relative to the upper left corner of the parent widget.

REAL width This value specifies the width of the widget in pixels, excluding the border.

INTEGER number_rows This value specifies the number of rows that will be displayed in files and directory list boxes of the form.

STRING filter_label[] This value specifies the title used on the form to describe the filter data box.

STRING filter_mask[] This value specifies the path and filter mask that determines which files will be displayed in the file list box.

STRING directory_label[] This value specifies the text used on the form to describe the directory data box.

STRING files_label[] This value specifies the text used on the form to describe the files data box.

STRING selection_label[] This value specifies the text used on the form to describe the selection data box.

STRING file_name[] This value specifies a file name to be displayed in the selection data box. If the file name specified is listed in the file list box the file list box entry will be highlighted.

STRING ok_label[] This value specifies the text used to label the “OK” button.

STRING filterbutton_label[] This value specifies the text used to label the “Filter” button.

STRING cancel_label[] This value specifies the text used to label the “Cancel” button.

PCL and CustomizationUser Interface and List Processor Functions (Chapter 5)

852

Remarks:

The PCL callback function will be called when the “OK” or the “Cancel button” is selected. This PCL callback fuction should be designed to accept two strings as arguments and to return nothing. When the “OK” button is selected the callback function will have the complete path and name of the selected file passed as the first argument and the work “OPEN” passed as the second argument. When the “Cancel” button is selected an empty string or ““ will be passed as the first argument and the work “CANCEL” will be passed as the second argument.

The following input values can be manipulated through a call to the function ui_wid_set():

Output:

WIDGET <Return Value> This function returns avalid form widget identifier when executed successfully and a value on WIDGET_NULL to indicate a change an error.

Error Conditions:

None.

853Chapter 10: Broken, Obsolete, Modified and New FunctionsUser Interface and List Processor Functions (Chapter 5)

Input Value Name Corresponding

ui_wid_set() Parameter Name

callback_function NAME

x_location X

y_location Y

width WIDTH

number_rows None available.

filter_label[] FILTERLABEL

filter_mask[] DIRECTORY and FILTER

directory_label[] None available.

files_label[] FILESLABEL

selection_label[] FILENAMELABEL

file_name[] FILENAME

ok_label[] OKBUTTONLABEL

filterbutton_label[] FILTERBUTTONLABEL

cancel_label[] CANCELBUTTONLABEL

ui_wid_set Issue:Argument description changed.

Resolution:Updated the function description in the body of the document.

Type:Modified.

Original Description Information:

ui_wid_set ( widget, parm, value )

Description:

Sets a widget parameter.

Input:

WIDGET widget Widget whose parameter is to be set.

STRING parm Name of parameter to set.

SEE BELOW value Value of parameter.

Output:

LOGICAL <Return Value>

TRUE if no error.

PCL and CustomizationUser Interface and List Processor Functions (Chapter 5)

854

Comments:

The datatype of the value must be that of the widget's parm. For example, for a call to:

ui_wid_set (button, “ENABLE”, logical_variable);

the third argument must be declared as a logical. For the call:

ui_wid_set (button, “X”, real_variable);

the third argument must be declared as a real.

Possible parm names:

Button parameters:“DISPLAY or VISIBLE” (LOGICAL) - TRUE if this widget is to be displayed.“ENABLE” (LOGICAL) - TRUE if this widget is selectable.“HEIGHT” (REAL) - Height of the widget.“LABEL” (STRING) - Text to be displayed.“NAME” (STRING) - Name of the widget.“WIDTH” (REAL) - Width of the widget.“X” (REAL) - X location of widget.“Y” (REAL) - Y location of widget.

Cascade Item parameters:“DISPLAY or VISIBLE” (LOGICAL) - TRUE if this widget is to be displayed.“ENABLE” (LOGICAL) - TRUE if this widget is selectable.“ACCELERATOR” (STRING) - Accelerator key to drop the menu.“LABEL” (STRING) - Text to be displayed.“NAME” (STRING) - Name of the widget.“MNEMONIC” (STRING) - Key mnemonic to drop the menu.

Color Bar parameters:“DISPLAY” or “VISIBLE” (LOGICAL) - TRUE if this widget is displayed.“ENABLE” (LOGICAL) - TRUE if this widget is selectable.“ITEMCOLOR” (INTEGER(2)) - Item color of the widget. The ui_wid_set or ui_wid_get call must be passed an array of size two. The first element of the carry should contain the item number. On a call to ui_wid_set the second element of the array should contain the index of the color desired. A call to the function ui_wid_get will return the color index in the second element.“CURRENTITEM” (INTEGER) - Currently depressed color button of the colorbar.“NITEMS” (INTEGER) - Number of color buttons in the colorbar.“LABEL” (STRING) - Label of the accompanying label widget. Invalid if colorbar is not created with a label.

Color Menu parameters:“DISPLAY” or “VISIBLE” (LOGICAL) - TRUE if this widget is displayed.“COLOR” (INTEGER) - Color of the widget.“LABEL” (STRING) - Label of the accompanying label widget. Invalid if colorbar is not created with a label.“LABEL” (STRING) - Label of the accompanying label widget. Invalid if colorbar is not created with a label.“WIDTH” (REAL) - Width of the widget.

Error Conditions:

None.

855Chapter 10: Broken, Obsolete, Modified and New FunctionsUser Interface and List Processor Functions (Chapter 5)

“HEIGHT” (REAL) - Height of the widget.

Databox and Selectdatabox parameters:“APPENDVALUE” (STRING) - Append the string onto the current value.“COLUMNS” (INTEGER) - Width of the widget as the number of visible characters. Valid only for databoxes.“DATATYPE” (STRING) - Name of the type of data that will be accepted by the databox. “DISPLAY or VISIBLE” (LOGICAL) - TRUE if the widget is to be displayed.“ENABLE” (LOGICAL) - TRUE if this widget is selectable.“FILTER_ENTITY” - Valid only for selectdataboxes.“HEIGHT” (REAL) - Height of the widget.“LABEL” (STRING) - Label of the databox.“MAXNUMCHARS” (INTEGER) - Upper limit of characters allowed in the databox. Valid only for databoxes.“NAME” (STRING) - Name of the widget.“PROMPT” (STRING) - Prompt to be displayed when the selectdatabox has focus and if the datatype displays a selection menu. Valid only for selectdataboxes.“READONLY” - Valid only for databoxes.“SINGLESELECT” (LOGICAL) - Used only for selectdataboxes. TRUE for the selectdatabox if only one pick is to appear in the selectdatabox.“UNSELECT” (LOGICAL) - FALSE if all text is to be selected.“VALUE” (type defined by the databox's datatype) - Current value of the databox.“WIDSETNOTIFY” (LOGICAL) - TRUE if the callback function is to be called for ui_wid_set calls.“WIDTH” (REAL) - Width of the widget.“X” (REAL) - X location of widget.“Y” (REAL) - Y location of widget.

File parameters:“CANCELBUTTONLABEL” (STRING) - Label to appear in the cancel button.“DIRECTORY” (STRING) - Pathname of the directory.“DISPLAY or VISIBLE” (LOGICAL) - TRUE if this widget is to be displayed.“ENABLE” (LOGICAL) - TRUE if this widget is selectable.“FILENAME” (STRING) - Name of the file to appear in the file databox.“FILENAMELABEL” (STRING) - Label to appear above the file databox.“FILESLABEL” (STRING) - Label for the files databox.“FILTER” (STRING) - Mask to be used when filtering files.“FILTERBUTTONLABEL” (STRING) - Label for the filter button.“FILTERLABEL” (STRING) - Label for the filter databox.“FILTERPATH” (STRING) - Value of the filter databox.“HEIGHT” (REAL) - Height of the widget.“NAME” (STRING) - Name of the widget.“OKBUTTONLABEL” (STRING) - Label for the OK button.“WIDTH” (REAL) - Width of the widget.“X” (REAL) - X location of widget.“Y” (REAL) - Y location of widget.

Form and modalform parameters:“DISPLAY or VISIBLE” (LOGICAL) - TRUE if widget is currently displayed.“ENABLE” (LOGICAL) - TRUE if this widget is selectable.“HEIGHT” (REAL) - Height of widget.“LABEL” (STRING) - Label to appear in the banner of the form. “NAME” (STRING) - Name of the widget.“WIDTH” (REAL) - Width of widget.“X” (REAL) - X location of widget.“Y” (REAL) - Y location of widget.

Frame, Scrollframe, and Selectframe parameters:“DISPLAY or VISIBLE” (LOGICAL) - TRUE if the frame’s children that have been specifically left ON via a ui_wid_set() are to be displayed.

PCL and CustomizationUser Interface and List Processor Functions (Chapter 5)

856

“DISPLAYALL or VISIBLEALL” (LOGICAL) - TRUE if the frame’s children are to be displayed regardless of whether the children have been displayed or hidden via a ui_wid_set().“ENABLE” (LOGICAL) - TRUE if frames children are to be selectable.“HEIGHT” (REAL) - Height of widget.“LABEL” (STRING) - String to appear above the frame.“NAME” (STRING) - Name of the widget.“TOGGLEVALUE” - Valid only for selectframes.“WIDTH” (REAL) - Width of widget.“WORKINGHEIGHT” - Valid only for scrollframes.“WORKINGWIDTH” - Valid only for scrollframes.“X” (REAL) - X location of widget.“Y” (REAL) - Y location of widget.

Item parameters:“DISPLAY or VISIBLE” (LOGICAL) - TRUE if widget is currently displayed. Invalid for listbox items.“ACCELERATOR” (CHAR) - Specifies CRTL<char> sequence to invoke item. Item need not be visible for accelerator to work. Invalid for listbox items.“ENABLE” (LOGICAL) - TRUE if this widget is selectable. Not valid for listbox items.“ICON” (STRING) - Name of the icon used in lieu of the label. See ui_itemicon_create (p. 326).“LABEL” (STRING) - Text to be displayed.“MNEMONIC” (CHAR) - Specifies key to invoke item. Item must be visible for mnemonic to work. Only valid for menu items.“NAME” (STRING) - Name of the widget.“VALUE” (LOGICAL) - Value of the widget. Invalid for menubar items.

Label parameters:“DISPLAY or VISIBLE” (LOGICAL) - TRUE if this widget is to be displayed.“ENABLE” (LOGICAL) - TRUE if the label is in bold print.“HEIGHT” (REAL) - Height of the widget.“ICON” (STRING) - Name of the icon to be displayed in lieu of the label. Valid only for widgets created with ui_labelicon_create.“LABEL” (STRING) - Text to be displayed.“NAME” (STRING) - Name of the widget.“WIDTH” (REAL) - Width of the widget.“X” (REAL) - X location of widget.“Y” (REAL) - Y location of widget.

Listbox parameters:“BOTTOMITEM” (STRING) - Label of the item that is to be the bottom visible item.“BOTTOMPOS” (INTEGER) -Number of the items to appear at the bottom of the listbox.“DISPLAY or VISIBLE” (LOGICAL) - TRUE if this widget is to be displayed.“DUPLICATEITEM” (LOGICAL) - TRUE if this listbox allows items having the same value to appear more than once.“ENABLE” (LOGICAL) - TRUE if this widget is selectable.“HEIGHT” (REAL) - Height of the widget.“LABEL” (STRING) - Label to describe the listbox.“NAME” (STRING) - Name of the listbox.“ROWS” (INTEGER) - Number of rows that can be visible in the displayed listbox.“SELECTIONTYPE” (STRING) - Selection type of the listbox. “SINGLE”, “MULTIPLE”, “BROWSE”, “EXTEND”, or “READONLY”.“TOPITEM” (STRING) - Label of the item that is to be the top visible item.“VALUE” (STRING ARRAY) - Selected items of the widget.“WIDTH” (REAL) - Width of the widget.“X” (REAL) - X location of widget.“Y” (REAL) - Y location of widget.“UNSELECT” (LOGICAL) - FALSE if all items are to be selected.

857Chapter 10: Broken, Obsolete, Modified and New FunctionsUser Interface and List Processor Functions (Chapter 5)

Menu parameters:“ENABLE” (LOGICAL) - TRUE if this widget is selectable.“LABEL” (STRING) - Label of the menu.“MNEMONIC” (CHAR) - Specifies key to invoke menu.

Menubar parameters:“DISPLAY or VISIBLE” (LOGICAL) - TRUE if this widget is to be displayed.“ENABLE” (LOGICAL) - TRUE if this widget is selectable.

Optionmenu parameters:“DISPLAY or VISIBLE” (LOGICAL) - TRUE if this widget is to be displayed.“ENABLE” (LOGICAL) - TRUE if this widget is selectable.“LABEL” (STRING) - Label of the optionmenu.“NAME” (STRING) - Name of the optionmenu.“VALUE” (STRING) - Currently displayed item label of the optionmenu.“X” (REAL) - X location of widget.“Y” (REAL) - Y location of widget.

Selectdatabox parameters:

See Databox and Selectdatabox parameters:, 855.

Separator:“DISPLAY or VISIBLE”“HEIGHT” (REAL) - Height of the widget.“WIDTH” (REAL) - Width of the widget.“X” (REAL) - X location of the widget.“Y” (REAL) -Y location of the widget.

Slidebar parameters:“DECPOINTS” (INTEGER) - Number of digits to appear after the decimal point. Used only when show_value (see ui_slidebar_create (p. 356)) is TRUE.“DISPLAY or VISIBLE” (LOGICAL) - TRUE if this widget is to be displayed.“ENABLE” (LOGICAL) - TRUE if this widget is selectable.“LABEL” (STRING) - Text to be displayed.“MAXLABEL” (STRING) - Label to appear at the upper end of the slidebar.“MAXVALUE” (REAL) - Maximum allowable value.“MINLABEL” (STRING) - Label to appear at the lower end of the slidebar.“MINVALUE” (REAL) - Minimum allowable value.“NAME” (STRING) - Name of the widget.“VALUE” (REAL) - Value of the widget.“X” (REAL) - X location of widget.“Y” (REAL) - Y location of widget.

Spreadsheet:“DISPLAY or VISIBLE” (LOGICAL) - TRUE if widget is currently displayed.“ENABLE” (LOGICAL) - TRUE if this widget is selectable.“LABEL” (STRING) - Main label to be displayed with the widget.“UNSELECT” (LOGICAL) - TRUE to unselect all cells. FALSE does nothing.

Switch parameters:“COLUMNS” (INTEGER) - Number of columns of items that the switch should contain.“DISPLAY or VISIBLE” (LOGICAL) - TRUE if this widget is to be displayed.“ENABLE” (LOGICAL) - TRUE if this widget is selectable.“LABEL” (STRING) - Label to be displayed with the widget.“NAME” (STRING) - Name of the widget.“VALUE” (STRING) - Name of the item that is currently on. If “NONE”, all switch items will be turned OFF.“X” (REAL) - X location of widget.

PCL and CustomizationUser Interface and List Processor Functions (Chapter 5)

858

“Y” (REAL) - Y location of widget.

Text:“APPENDVALUE” (STRING) - String to append onto the current value.“DISPLAY or VISIBLE” (LOGICAL) - TRUE if widget is currently displayed.“EDITABLE” (LOGICAL) - TRUE if the user may alter the text value.“ENABLE” (LOGICAL) - TRUE if this widget is selectable.“HEIGHT” (REAL) - Height of the widget.“MAXNUMCHARS” (INTEGER) - Maximum number of characters that can be contained in the widget.“NAME” (STRING) - Name of the widget.“POSITION” (INTEGER) - Location of the insertion bar in the text box.“UNSELECT” (LOGICAL) - FALSE if all text is to be selected.“VALUE” (STRING) - Text that appears in the widget. To include a newline character, place “\n” in the string.“WIDTH” (REAL) - Width of the widget.“X” (REAL) - X location of widget.“Y” (REAL) - Y location of widget.

Toggle parameters:“DISPLAY or VISIBLE” (LOGICAL) - TRUE if this widget is currently displayed.“ENABLE” (LOGICAL) - TRUE if this widget is selectable.“ICON” (STRING) - Name of icon to be used, valid only when created with ui_toggleicon_create.“LABEL” (STRING) - Text to be displayed to describe the toggle.“NAME” (STRING) - Name of the widget.“VALUE” (LOGICAL) - Value of the widget.“WIDTH” (REAL) - Width of the widget.“X” (REAL) - X location of widget.“Y” (REAL) - Y location of widget.

Window parameters:“DISPLAY or VISIBLE” (LOGICAL) - TRUE if widget is currently displayed.“ENABLE” (LOGICAL) - TRUE if this window is selectable.“HEIGHT” (REAL) - Height of widget.“LABEL” (STRING) - String to appear in the window’s banner.“NAME” (STRING) - Name of the window.“WIDTH” (REAL) - Width of widget.“X” (REAL) - X location of widget.“Y” (REAL) - Y location of widget.

859Chapter 10: Broken, Obsolete, Modified and New FunctionsUser Interface and List Processor Functions (Chapter 5)

Remarks:

The data type of the input value parameter_value must match the data type specified for the input value paramter_name as listed in the tables below. The parameter names that can be used and the functions used to create the widgets with which they can be used are listed in the tables below.

Button parameters:

New Description Information:

ui_wid_set ( widget_id, parameter_name, parameter_value )

Description:

This function will set a widget parameter value.

Input:

WIDGET widget_id This value specifies the identifier of the widget that will be modified.

STRING parameter_name[] This value specifies the name of the paramter to be modified. See below for more information.

DYNAMIC_ILRS parameter_value This value specifies the array of flags used to identify the specific entity types to be exported. See the remarks below for more information.

Output:

LOGICAL <Return Value> This function returns a value of TRUE when executed successfully and a non TRUE value to indicate a change in status or an error.

Error Conditions:

This function may return a nonzero value if an error occurs.

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if this widget is to be displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

REAL HEIGHT Height of the widget.

STRING LABEL Text to be displayed.

STRING NAME Name of the widget.

REAL WIDTH Width of the widget.

REAL X X location of widget.

REAL y Y location of widget.

PCL and CustomizationUser Interface and List Processor Functions (Chapter 5)

860

Cascade Item parameters:

Color Bar parameters:

Color Menu parameters:

Databox and Selectdatabox parameters:

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if this widget is to be displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

STRING ACCELERATOR Accelerator key to drop the menu.

STRING LABEL Text to be displayed.

STRING NAME Name of the widget.

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if this widget is to be displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

INTEGER(2) ITEMCOLOR Item color of the widget. The ui_wid_set or ui_wid_get call must be passed an array of size two. The first element of the carry should contain the item number. On a call to ui_wid_set the second element of the array should contain the index of the color desired. A call to the function ui_wid_get will return the color index in the second element.

INTEGER CURRENTITEM Currently depressed color button of the colorbar.

INTEGER NITEMS Number of color buttons in the colorbar.

STRING LABEL Label of the accompanying label widget. Invalid if colorbar is not created with a label.

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if this widget is to be displayed.

INTEGER COLOR Color of the widget.

STRING LABEL Label of the accompanying label widget. Invalid if colorbar is not created with a label.

REAL WIDTH Width of the widget.

REAL HEIGHT Height of the widget.

861Chapter 10: Broken, Obsolete, Modified and New FunctionsUser Interface and List Processor Functions (Chapter 5)

File Parameters:

See the ui_file_create() function description for more information.

Data Type Parameter Name Description

STRING APPENDVALUE Append the string onto the current value.

INTEGER COLUMNS Width of the widget as the number of visible characters. Valid only for databoxes.

STRING DATATYPE Name of the type of data that will be accepted by the databox.

LOGICAL DISPLAY or VISIBLE TRUE if this widget is to be displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

FILTER_ENTITY Valid only for selectdataboxes.

REAL HEIGHT Height of the widget.

STRING LABEL Label of the databox.

INTEGER MAXNUMCHARS Upper limit of characters allowed in the databox. Valid only for databoxes.

STRING NAME Name of the widget.

STRING PROMPT Prompt to be displayed when the selectdatabox has focus and if the datatype displays a selection menu. Valid only for selectdataboxes.

READONLY Valid only for databoxes.

LOGICAL SINGLESELECT Used only for selectdataboxes. TRUE for the selectdatabox if only one pick is to appear in the selectdatabox.

LOGICAL UNSELECT FALSE if all text is to be selected.

(type defined by the databox's datatype)

VALUE Current value of the databox.

LOGICAL WIDSETNOTIFY TRUE if the callback function is to be called for ui_wid_set calls.

REAL WIDTH Width of the widget.

REAL X X location of widget.

REAL Y Y location of widget.

PCL and CustomizationUser Interface and List Processor Functions (Chapter 5)

862

Data Type Parameter Name Description

STRING CANCELBUTTONLABEL This value specifies the text used to label the “Cancel” button. See the input value cancel_label in the ui_file_create() function description for more information.

STRING DIRECTORY This value specifies the path which is used together with the filter mask specified with the input variable parameter_name value FILTER to determine which files and directories are displayed in the form. See the parameter_name value FILTERPATH for more information. See the input value filter_mask in the ui_file_create() function description for more information.

LOGICAL ENABLE This value specifies, when set to TRUE, that the file form can be selected, is active, and can be used for input. If this value is set to FALSE, the form will be grayed out and cannot be selected and used for input.

STRING FILENAME This value specifies a file name to be displayed in the selection databox. If the file name specified is listed in the file list box the file list box entry will be highlighted. See the input value file_name in the ui_file_create() function description for more information.

STRING FILENAMELABEL This value specifies the text used on the form to describe the selection databox. See the input value selection_label in the ui_file_create() function description for more information.

STRING FILESLABEL This value specifies the text used on the form to describe the files databox. See the input value files_label in the ui_file_create() function description.

STRING FILTER This value specifies the filter mask which is used together with the path specified with the input variable parameter_name value DIRECTORY to determine which files and directories are displayed in the form. See the parameter_name value FILTERPATH for more information.See the input value filter_mask in the ui_file_create() function description for more information.

STRING FILTERBUTTONLABEL This value specifies the text used to label the “Filter” button. See the input value filterbutton_label in the ui_file_create() function description.

863Chapter 10: Broken, Obsolete, Modified and New FunctionsUser Interface and List Processor Functions (Chapter 5)

STRING FILTERLABEL This value specifies the title used on the form to describe the filter databox. See the input value filter_label in the ui_file_create() function description.

STRING FILTERPATH This value sets the path and filter mask value in the filter databox and determines what will be displayed in the directory and files databoxes. This parameter_name value combines the operations of the parameter_name values DIRECTORY and FILTER. See the input value filter_mask in the ui_file_create() function description for more information.

REAL HEIGHT This value specifies the height of the widget in inches, excluding the border.

STRING NAME This value specifies the name of the PCL function that will be called for an event representing a form event. This call back function must be a member of the class in which the ui_file_create() widget is created. See the input value callback_func in the ui_file_create() function description for more information.

STRING OKBUTTONLABEL This value specifies the text used to label the “OK” button. See the input value ok_label in the ui_file_create() function description for more information.

STRING WIDTH This value specifies the width of the widget in inches, excluding the border. See the input value width in the ui_file_create() function description for more information.

REAL X This value specifies the x axis location of the file widget in inches relative to the upper left corner of the parent widget. See the input value x_location in the ui_file_create() function description for more information.

REAL Y This value specifies the y axis location of the file widget in inches relative to the upper left corner of the parent widget. See the input value y_location in the ui_file_create() function description for more information.

PCL and CustomizationUser Interface and List Processor Functions (Chapter 5)

864

Form and modalform parameters:

Frame, Scrollframe, and Selectframe parameters:

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if this widget is currently displayed.

LOGICAL ENABLE TRUE if this widget is selectable.

REAL HEIGHT Height of the widget.

STRING LABEL Label to appear in the banner of the form.

STRING NAME Name of the widget.

REAL WIDTH Width of the widget.

REAL X X location of widget.

REAL y Y location of widget.

Data Type Parameter Name Description

LOGICAL DISPLAY or VISIBLE TRUE if the frame’s children that have been specifically left ON via a ui_wid_set() are to be displayed.

LOGICAL DISPLAYALL or VISIBLEALL

TRUE if the frame’s children are to be displayed regardless of whether the children have been displayed or hidden via a ui_wid_set().

LOGICAL ENABLE TRUE if frame’s children are to be selectable.

REAL HEIGHT Height of the widget.

STRING LABEL String to appear above the frame.

STRING NAME Name of the widget.

TOGGLEVALUE Valid only for selectframes.

REAL WIDTH Width of the widget.

WORKINGHEIGHT Valid only for scrollframes.

WORKINGWIDTH Valid only for scrollframes.

REAL X X location of widget.

REAL y Y location of widget.

865Chapter 10: Broken, Obsolete, Modified and New FunctionsCreating New Analysis Forms Using PCL (Chapter 6)

Creating New Analysis Forms Using PCL (Chapter 6)

PCL and CustomizationModifying the Database Using PCL (Chapter 7)

866

Modifying the Database Using PCL (Chapter 7)

This function requires the same arguments as the add function.

db_delete_general_field_func Issue:Not specified in Patran.

Resolution:Removed the function decription from the documentation.

Type:Obsolete.

lbc_defn_create.lbc_var_defn

Issue:Argument list changed.

Resolution:Updated the function listing in the body of the document.

Type:Modified.

Original Description Information:

lbc_defn_create.lbc_var_defn ( <load_id>, <category>, <targ_elem_dim>, <variable_label>, <variable_id>, <display_order>, <data_type>, <scal_or_vect>, <null_flag>, <norm_flag>, <graph_sym>, <connect_label>, <anchor>, <conflict_flag>, <display_type>, <eval_flag> )

Input:

INTEGER <load_id> The ID of this load type. This ID must have been previously defined.

INTEGER <category> Specifies what type of entities the LBC will eventually be evaluated at.

1 = Nodal.

2 = Element Uniform.

3 = Element Variable.

INTEGER <targ_elem_dim> Specifies the dimensionality of the element the LBC will eventually be applied to.

1 = one dimensional.

2 = two dimensional.

3 = three dimensional.

STRING <variable_label> Specifies the string associated with the variable’s data box (e.g. “Moment <M1 M2 M3>”). If no input data is to be specified, this label must be a blank string.

867Chapter 10: Broken, Obsolete, Modified and New FunctionsModifying the Database Using PCL (Chapter 7)

INTEGER <variable_id> Specifies the id associated to this variable. Ids must be unique within each load type.

INTEGER <display_order> Specifies in what order this databox is to be displayed. Valid numbers are from 1 to n, where n is the number of variables defined for this load type.

INTEGER <data_type> Specifies the data type which is valid for this databox.

1 = integer.

3 = real/field to be evaluated by LBC

application.

4 = character (not implemented).

5 = node id.

7 = field (not evaluated by LBC application).

INTEGER <scal_or_vect> If data type is real, specifies whether it is a scalar or vector quantity.

0 = scalar.

1 = vector.

INTEGER <null_flag> Flag specifying whether blank components of a vector load are to be interpreted as zeroes (as with forces) or nulls (as with displacements):

0 = interpret blank components as zeroes.

1 = interpret blank components as nulls.

INTEGER <norm_flag> Specifies the positive direction for a local normal vector.

0 = local normal is not used.

1 = positive is into the body.

2 = positive is out of the body.

INTEGER(3) <graph_sym> Specifies the graphic symbols to be used for this variable. The first element in this array specifies the symbol for the first application region, the second element specifies the symbol for the second application region. The third element is reserved for future use. The second element is not used unless two application regions are specified. Refer to Table 7-1 for definition of the graphics symbols.

PCL and CustomizationModifying the Database Using PCL (Chapter 7)

868

INTEGER(4) <connect_label> Specifies the label used to connect application regions. This specification applies to load types with multiple application regions only. The array elements have the following meaning:

connect_label(1):

0 = no connection is displayed between the application regions.

1 = a solid line is displayed connecting the application regions with the label specified in connect_label(2).

connect_label(2):

2 = no label is displayed.

3 = the LBC set name is used as the label.

7 = the variable’s Field name is used as the label.

connect_label(3):

Not implemented, set to zero.

connect_label(4):

Not implemented, set to zero.

INTEGER(3) <anchor> Specifies the anchor style for vectors. The first element in this array specifies the anchor style for the first application region, the second element specifies the anchor style for the second application region. The third element is reserved for future use. The second element is not used unless two application regions are specified. The following anchor styles are available:

1= anchor at base.

2 = anchor at tip.

3 = anchor at middle.

INTEGER <conflict_flag> Specifies whether conflicts for this variable should be resolved.

0= do not resolve conflicts.

1= resolve conflicts.

869Chapter 10: Broken, Obsolete, Modified and New FunctionsModifying the Database Using PCL (Chapter 7)

INTEGER(3) <display_type> Specifies the display style to be used with the graph_sym parameters. The display style controls whether or not symbols and labels will be plotted for this variable. The ability to specify Lbc Set Name or Field Name as a label can also be specified here. The first element in this array specifies the display style for the first application region, the second element specifies the display style to be used with the second application region. The third element is reserved for future use. The second element is not used unless two application regions are specified.

0= no display.

1= marker with standard label (the variable quantity).

2= marker with no label.

3= marker with LBC set name label.

4= label only, no marker.

5= graphics symbol at node with node id (for node id data type only).

6= marker with constrained DOF and coordinate frame id label (for null flag = 1 only).

7= marker with Field name label.

INTEGER <eval_flag> Specifies which entities fields will be evaluated at. Used for load types with multiple application region only.

0= evaluate at entities in all application regions.

1= evaluate at entities in first application region only.

2= evaluate at entities in second application region only.

Output:

INTEGER <Return Value> Status return value. The value will be 0 if the routine is successful.

New Description Information:

lbc_defn_create.lbc_var_defn ( load_id, category, targ_elem_dim, variable_label, variable_id, display_order, data_type, scalar_or_vector, null_type, normal_direction, graph_symbol, connect_label, anchor, conflict_resolution, display_style, evaluation_location )

PCL and CustomizationModifying the Database Using PCL (Chapter 7)

870

Description:

This function will assign input data variable definitions to a load type.

Input:

INTEGER load_id This value specifies the load type identifier. This identifier must reference an existing load type.

INTEGER category This value specifies the type of entities at which the loads and boundary conditions will be evaluated. This value can be set to 1 for nodal entities, 2 for uniform element entities, or 3 for variable element entities.

INTEGER targ_elem_dim This value specifies the dimensionality of the element to which the load and boundary condition will be applied. This value can be set to 1 for one dimension, 2 for two dimensions, or 3 for three dimensions.

When the input value category is set to 1 for nodal entities, this value is not used because the dimensionality for nodes is undefined and this input value should be set to 0.

STRING variable_label [31]

This value specifies the text that will be associated with the input value variable_id. This text will be used to label the display of the information associated with the input value variable_id. If input data is not specified for this load type then this value must be an empty string.

INTEGER variable_id This value specifies the identifier for the variables associated with this load type. This identifier must be unique within each load type.

INTEGER display_order This value specifies the order in which variables associated with this load type would be displayed in a data box. This value can range from 1 to the number of variables associated with the identifier specified by the input variable variable_id.

INTEGER data_type This value specifies the data type for the variables associated with the input value variable_id. This value can be set to 1 for integers, 3 for real or field values evaluated by the loads and boundary conditions, 5 for a node identifier, or 7 for a field that is not evaluated by the loads and boundary conditions.

INTEGER scalar_or_vector

This value specifies when set to 0 that the data type is a scalar value or when set to 1 that the data type is a vector value.

This value is used only if the input argument data_type is set to 3 for real or field values evaluated by the loads and boundary conditions.

INTEGER null_type This value specifies, when set to 0, that blank components of a vector load are to be interpreted as zeros, as with forces. When this value is set to 1, blank components of a vector load will be interpreted as nulls, as with displacements.

871Chapter 10: Broken, Obsolete, Modified and New FunctionsModifying the Database Using PCL (Chapter 7)

INTEGER normal_direction

This value specifies, when set to 0 that a local normal is not used. When this value is set to 1, the positive direction for a local normal vector will be into the body. When this value is set to 2, the positive direction for a local normal will be out of the body.

INTEGER graph_symbol(3)

This value specifies the graphic symbols to be used for the variable assigned to the load type. The first array element specifies the symbol for the first application region, the second element the symbol for the second application region, and the third element is reserved for future use. The second element is not used unless two application regions are specified. Refer to Table 7-1 for the definitions of the graphic symbols that can be used with this value.

INTEGER connect_label(4)

This value specifies the label used to connect the application regions. This value applies to load types with multiple application regions only.

The first array element can be set to 0 to specify that no connection is displayed between the application regions or 1 to specify that a solid line is displayed connecting the application regions with the label specified in the second array element of this input value.

The second array element can be set to 2 to specify that a label is not displayed, 3 to specify that the load and boundary condition set name is used as a label, or 7 to indicate that the variable field name is to be used as a label.

The third array element should always be set to 0 and is reserved for future use.

The fourth array element is reserved for future use.

INTEGER) anchor(3) This value specifies the anchor style for vectors.

The first array element specifies the anchor style for the first application region.

The second array element specifies the anchor style for the second application region.

The third array element is reserved for future use.

The following anchor style values are available: 1 to anchor at the vector base, 2 to anchor at the vector tip, and 3 to anchor at the middle of the vector.

INTEGER conflict_resolution

This value specifies, when set to 0, that variable conflicts will not be resolved. Setting this value to 1 will allow variable conflicts to be resolved.

PCL and CustomizationModifying the Database Using PCL (Chapter 7)

872

INTEGER display_style(3)

This value specifies the display style that will be used to display the values specified with the input argument graph_symbol. The display style controls the use of symbols and labels plotted with the variable definitions.

This value can be used to specify the use of the loads and boundary condition set name or field name that can be displayed as a label.

The first array element specifies the display style for the first application region.

The second array element specifies the display style for the second application region and is used only if two application regions are specified.

The third array element is reserved for future use.

The following display style values can be used: 0 for no display, 1 for a display with markers with standard or variable quantity labels, 2 for a display with no marker labels, 3 for a display with markers with loads and boundary condition set name labels, 4 for a display with labels with no markers, 5 for a display with a graphics symbol at the node with the node id, 6 for a display with markers with constrained degree of freedom and coordinate frame id labels, or 7 for a display with markers with field name labels.

A display style value of 5 can be used with an input value data_type that specifies node identifiers only. A display style value of 6 can be used with a null_type input value of 1 only.

INTEGER evaluation_location

This value specifies the application regions at which entity fields will be evaluated. This value is used only with load types that specify multiple application regions. The following values can be used: 0 to evaluate the entity fields in all application regions, 1 to evaluate the entity fields in the first application region, or 2 to evaluate the entity fields in the second application region.

Output:

INTEGER <Return Value>

This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

Error Conditions:

None.

Remarks:

This function should be called only for new load types. Existing load types will already have an input data definition assigned.

873Chapter 10: Broken, Obsolete, Modified and New FunctionsAccessing the Patran Database (Chapter 8)

Accessing the Patran Database (Chapter 8)

Notes:

The C name differs. It is DbFCreateLbc.

int DbFCreateLbc ( load_name, application_type, load_type, elem_dimension, dynamic_flag, coord_id, load_id ) char *load_name int application_type

db_create_lbc Issue:Not supported in Patran.

Resolution:Remove the function decription from the documentation.

Type:Obsolete.

Note: This function is obsolete and no longer usable. Please use db_create_lbc_new, 730 instead.

Input:

CHARACTER STRING

<load_name> The external name used to reference this load.

INTEGER <application_type> The internal ID of the load of interest.1 = load applied to nodes2 = load applied to elements and constant over the element3 = load applied to elements and varying over the element

INTEGER <load_type> The ID of the load type of this load. See Table 7-4 for the load ID’s currently being used by Patran.

INTEGER <elem_dimension> The dimensionality of the loaded elements:1 = line element2 = surface element3 = solid element

INTEGER <dynamic_flag> A flag specifying whether this load is constant with respect to time or frequency (0) or varies with respect to time or frequency (1).

INTEGER <coord_id> The ID of the coordinate frame along which the loads are acting. -1 if acting in the global system or not appropriate for this load.

Output:

INTEGER <load_id> The internal ID assigned to this load by Patran.

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationAccessing the Patran Database (Chapter 8)

874

int load_type int elem_dimension int dynamic_flag int coord_id int *load_id

Notes:

The C name differs. It is DbFCreateLbcDS.

db_create_lbc_ds Issue:Not supported in Patran.

Resolution:Remove the function decription from the documentation.

Type:Obsolete.

Note: This function is still usable, but obsolete. Please use db_create_lbc_input_data (p. 598) instead.

Input:

INTEGER <load_id> The internal ID of the load of interest.

INTEGER <num_variables> The number of load variables defined for this load.

INTEGER ARRAY

<variable_ids> The IDs of the <num_variables> load variables defined for this load. See db_create_nodal_lbc_var_defn, 547 and db_create_elem_lbc_var_defn, 546 for details about the load variable IDs.

REAL ARRAY <real_values> The real scalar values for each of the <num_variables> load variables.

INTEGER ARRAY

<spatial_fields> The spatially varying field references for each of the <num_variables> load variables. Zero signifies that there is no spatial variance in the load.

INTEGER ARRAY

<dynamic_fields> The <num_variables> dynamic field references for all the load variables. Zero implies that the corresponding load variable is constant with respect to time or frequency.

REAL ARRAY <scale_factors> The <num_variables> scale factors to be applied to each of the load variables.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

875Chapter 10: Broken, Obsolete, Modified and New FunctionsAccessing the Patran Database (Chapter 8)

int DbFCreateLbcDS ( load_id, num_variables, variable_ids, real_values, spatial_fields, dynamic_fields, scale_factors )int load_idint num_variablesint variable_ids [ ]float real_values [ ]int spatial_fields [ ]int dynamic_fields [ ]float scale_factors [ ]

db_create_lbc_dv Issue:Not supported in Patran.

Resolution:Remove the function decription from the documentation.

Type:Obsolete.

Note: This function is still usable, but obsolete. Please use db_create_lbc_input_data (p. 598) instead.

PCL and CustomizationAccessing the Patran Database (Chapter 8)

876

Notes:

The C name differs. It is DbFCreateLbcDV.

int DbFCreateLbcDV ( load_id, num_variables, variable_ids, real_values, spatial_fields, dynamic_fields, null_flags, scale_factors )int load_idint num_variables

Input:

INTEGER <load_id> The internal ID of the load of interest.

INTEGER <num_variables> The number of load variables defined for this load.

INTEGER ARRAY

<variable_ids> The IDs of the <num_variables> load variables defined for this load. See db_create_nodal_lbc_var_defn, 547 and db_create_elem_lbc_var_defn, 546 for details about the load variable IDs.

REAL ARRAY <real_values> The values for the 3 components for each of the <num_variables> load variables. If a corresponding spatial field reference exists, this value is meaningless.

INTEGER ARRAY

<spatial_fields> The spatially varying field references for the 3 components for each of the <num_variables> load variables. Zero signifies that there is no spatial variance in the load and the corresponding <real_values> value should be used. If a spatial reference exists, the corresponding <real_values> value should be ignored.

INTEGER ARRAY

<dynamic_fields> The dynamic field references for the 3 components for each of the <num_variables> load variables. Zero implies that the corresponding load variable vector component is constant with respect to time or frequency.

INTEGER ARRAY

<null_flags> The null component flags for the 3 components for each of the <num_variables> load variables. -1 means that no data was filled in for that vector component, whereas 0 means that data was input for the corresponding vector component.

REAL ARRAY <scale_factors> The <num_variables> scale factors to be applied to each of the load variables.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

877Chapter 10: Broken, Obsolete, Modified and New FunctionsAccessing the Patran Database (Chapter 8)

int variable_ids [ ]float real_values [ ][3]int spatial_fields [ ][3]int dynamic_fields [ ][3]int null_flags [ ][3]float scale_factors [ ]

Notes:

The C name differs. It is DbFCreateLbcSS.

db_create_lbc_ss Issue:Not supported in Patran.

Resolution:Remove the function decription from the documentation.

Type:Obsolete.

Note: This function is still usable, but obsolete. Use db_create_lbc_input_data (p. 598) instead.

Input:

INTEGER <load_id> The internal ID of the load of interest.

INTEGER <num_variables> The number of load variables defined for this load.

INTEGER ARRAY

<variable_ids> The IDs of the <num_variables> load variables defined for this load. See db_create_nodal_lbc_var_defn, 547 and db_create_elem_lbc_var_defn, 546 for details about the load variable IDs.

REAL ARRAY

<real_values> The real scalar values for each of the <num_variables> load variables. These values are meaningless if spatial field references exist.

INTEGER ARRAY

<spatial_fields> The spatially varying field references for each of the <num_variables> load variables. Zero signifies that there is no spatial variance in the load and the corresponding <real_values> value should be used. If there is a spatial field reference, the corresponding <real_values> should be ignored.

REAL ARRAY

<scale_factors> The <num_variables> scale factors to be applied to each of the load variables.

Output:

INTEGER <Return Value> This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.

PCL and CustomizationAccessing the Patran Database (Chapter 8)

878

int DbFCreateLbcSS ( load_id, num_variables, variable_ids, real_values, spatial_fields, scale_factors )int load_idint num_variablesint variable_ids [ ]float real_values [ ]int spatial_fields [ ]float scale_factors [ ]

db_get_elem_top_def Issue:None.

Resolution:None.

Type:New.

db_get_node_ass_elem Issue:None.

Resolution:None.

Type:New.

db_get_node_ass_geo Issue:None.

Resolution:None.

Type:New.

db_get_node_ass_mpc Issue:None.

Resolution:None.

Type:New.

db_get_elem_use_all_node Issue:None.

Resolution:None.

Type:New.

db_get_matl_prop_value2 Issue:None.

Resolution:None.

Type:New.

879Chapter 10: Broken, Obsolete, Modified and New FunctionsPATRAN 2.5 Database Compatibility (Chapter 9)

PATRAN 2.5 Database Compatibility (Chapter 9)db_get_elem_use_all_node Issue:None.

Resolution:None.

Type:New.

Description:

Not Functional in Patran.

Input:

INTEGER elno Unknown.

INTEGER sid Unknown.

INTEGER ptr Unknown.

Output:

INTEGER sid Unknown.

INTEGER ptr Unknown.

REAL disp Unknown.

INTEGER status Unknown.

Error Conditions:

None.

db_cfeg Issue:Not supported in Patran.

Resolution:Removed the function decription from the documentation.

Type:Obsolete.

Description:

Not Functional in Patran.

Input:

INTEGER numw Unknown.

INTEGER nbuf Unknown.

Output:

INTEGER cfeg Unknown.

INTEGER numw Unknown.

INTEGER numr Unknown.

PCL and CustomizationPATRAN 2.5 Database Compatibility (Chapter 9)

880

INTEGER(14)

idata Unknown.

INTEGER() eldata Unknown.

INTEGER num Unknown.

INTEGER status Unknown.

Error Conditions:

None.

db_coordinate_frame Issue:Not supported in Patran.

Resolution:Removed the function decription from the documentation.

Type:Obsolete.

Description:

Get Data Defining a Coordinate Frame.

Return the type, coordinates of 3 points and the 3- by -3 rotation matrix defining a coordinate frame.

Input:

INTEGER cordid Coordinate frame ID for which data is requested.

Output:

INTEGER type Coordinate frame type:1 = rectangular2 = cylindrical3 = spherical

REAL(3) a Global coordinates of the origin.

REAL(3) b Global coordinates of a point on the frames z-axis.

REAL(3) c Global coordinates of a point on the frames x-z plane.

REAL(9) r 3x3 rotative matrix (r[1][1], r[2][1]...) which will transform points in this frame to the global frame.

INTEGER status Return status: 0 = normal1 = non-existent Coordinate

Error Conditions:

None.

881Chapter 10: Broken, Obsolete, Modified and New FunctionsPATRAN 2.5 Database Compatibility (Chapter 9)

db_data Issue:Not supported in Patran.

Resolution:Removed the function decription from the documentation.

Type:Obsolete.

Description:

Not Supported in Patran.

Input:

INTEGER datano Unknown.

Output:

*STRING-DBXSA1* data Unknown.

INTEGER num Unknown.

INTEGER status Unknown.

Error Conditions:

None.

db_data_hyperpatch Issue:Not supported in Patran.

Resolution:Removed the function decription from the documentation.

Type:Obsolete.

Description:

Not Supported in Patran.

Input:

INTEGER dhpatch Unknown.

Output:

REAL(64) data Unknown.

INTEGER status Unknown.

Error Conditions:

None.

PCL and CustomizationPATRAN 2.5 Database Compatibility (Chapter 9)

882

db_data_line Issue:Not supported in Patran.

Resolution:Removed the function decription from the documentation.

Type:Obsolete.

Description:

Not Supported in Patran.

Input:

INTEGER dline Unknown.

Output:

REAL(4) data Unknown.

INTEGER status Unknown.

Error Conditions:

None.

db_data_patch Issue:Not supported in Patran.

Resolution:Removed the function decription from the documentation.

Type:Obsolete.

Description:

Not Supported in Patran.

Input:

INTEGER dpatch Unknown.

Output:

REAL(16) data Unknown.

INTEGER status Unknown.

Error Conditions:

None.

db_dof _list Issue:Not supported in Patran.

Resolution:Removed the function decription from the documentation.

Type:Obsolete.

883Chapter 10: Broken, Obsolete, Modified and New FunctionsPATRAN 2.5 Database Compatibility (Chapter 9)

Description:

Not Supported in Patran.

Input:

INTEGER type Unknown.

INTEGER listid Unknown.

INTEGER nbuf Unknown.

INTEGER nword Unknown.

Output:

INTEGER nword Unknown.

INTEGER() list Unknown.

INTEGER nlist Unknown.

INTEGER status Unknown.

Error Conditions:

None.

db_element_convection Issue:Not supported in Patran.

Resolution:Removed the function decription from the documentation.

Type:Obsolete.

Description:

Not Supported in Patran.

Input:

INTEGER elno Unknown.

INTEGER sid Unknown.

INTEGER ptr Unknown.

Output:

INTEGER sid Unknown.

INTEGER ptr Unknown.

INTEGER flag Unknown.

INTEGER user Unknown.

INTEGER nflag Unknown.

INTEGER(8) nodes Unknown.

REAL(8) cnvt Unknown.

PCL and CustomizationPATRAN 2.5 Database Compatibility (Chapter 9)

884

INTEGER ncval Unknown.

INTEGER status Unknown.

Error Conditions:

None.

885Chapter 10: Broken, Obsolete, Modified and New FunctionsPATRAN 2.5 Database Compatibility (Chapter 9)

db_element_heat_flux Issue:Not supported in Patran.

Resolution:Removed the function decription from the documentation.

Type:Obsolete.

Description:

Not Supported in Patran.

Input:

INTEGER elno Unknown.

INTEGER sid Unknown.

INTEGER ptr Unknown.

Output:

INTEGER sid Unknown.

INTEGER ptr Unknown.

INTEGER flag Unknown.

INTEGER user Unknown.

INTEGER dim Unknown.

INTEGER nflag Unknown.

INTEGER(8) nodes Unknown.

REAL(8) heat Unknown.

INTEGER nhval Unknown.

INTEGER status Unknown.

Error Conditions:

None.

db_element_pressure Issue:Not supported in Patran.

Resolution:Removed the function decription from the documentation.

Type:Obsolete.

Description:

Not Supported in Patran.

Input:

INTEGER elno Unknown.

PCL and CustomizationPATRAN 2.5 Database Compatibility (Chapter 9)

886

INTEGER sid Unknown.

INTEGER ptr Unknown.

Output:

INTEGER sid Unknown.

INTEGER ptr Unknown.

INTEGER type Unknown.

INTEGER elflag Unknown.

INTEGER noflag Unknown.

INTEGER(6) comp Unknown.

INTEGER(8) node Unknown.

INTEGER nfe Unknown.

REAL(30) pdata Unknown.

INTEGER num Unknown.

INTEGER status Unknown.

Error Conditions:

None.

887Chapter 10: Broken, Obsolete, Modified and New FunctionsPATRAN 2.5 Database Compatibility (Chapter 9)

db_element_radiation Issue:Not supported in Patran.

Resolution:Removed the function decription from the documentation.

Type:Obsolete.

Description:

Not Supported in Patran.

Input:

INTEGER elno Unknown.

INTEGER sid Unknown.

INTEGER ptr Unknown.

Output:

INTEGER sid

INTEGER ptr

INTEGER flag

INTEGER user

INTEGER nflag Unknown.

INTEGER(8) nodes Unknown.

REAL(8) radn Unknown.

INTEGER nrval Unknown.

INTEGER status Unknown.

Error Conditions:

None.

db_element_temperature Issue:Not supported in Patran.

Resolution:Removed the function decription from the documentation.

Type:Obsolete.

Description:

Not Supported in Patran.

Input:

INTEGER elno Unknown.

INTEGER sid Unknown.

PCL and CustomizationPATRAN 2.5 Database Compatibility (Chapter 9)

888

INTEGER ptr Unknown.

Output:

INTEGER sid Unknown.

INTEGER ptr Unknown.

INTEGER flag Unknown.

INTEGER user Unknown.

REAL temp Unknown.

INTEGER status Unknown.

Error Conditions:

None.

889Chapter 10: Broken, Obsolete, Modified and New FunctionsPATRAN 2.5 Database Compatibility (Chapter 9)

db_element_view_factor Issue:Not supported in Patran.

Resolution:Removed the function decription from the documentation.

Type:Obsolete.

Description:

Not Supported in Patran.

Input:

INTEGER elno Unknown.

INTEGER sid Unknown.

INTEGER ptr Unknown.

Output:

INTEGER sid Unknown.

INTEGER ptr Unknown.

INTEGER user Unknown.

INTEGER node1 Unknown.

INTEGER node2 Unknown.

INTEGER cvsid Unknown.

INTEGER obstr Unknown.

INTEGER dyn Unknown.

INTEGER surf Unknown.

INTEGER(6) nodes Unknown.

INTEGER status Unknown.

Error Conditions:

None.

db_field Issue:Not supported in Patran.

Resolution:Removed the function decription from the documentation.

Type:Obsolete.

Description:

Not Supported in Patran.

Input:

PCL and CustomizationPATRAN 2.5 Database Compatibility (Chapter 9)

890

INTEGER field Unknown.

Output:

INTEGER ftype Unknown.

INTEGER vecscl Unknown.

INTEGER ispcl Unknown.

REAL(18) cfdata Unknown.

REAL(21) coeffs Unknown.

STRING chars Unknown.

INTEGER status Unknown.

Error Conditions:

None.

db_hyperpatch_gfeg Issue:Not supported in Patran.

Resolution:Removed the function decription from the documentation.

Type:Obsolete.

Description:

Not supported in Patran.

Input:

INTEGER hpat Unknown.

INTEGER nodes Unknown.

INTEGER nbuf Unknown.

Output:

INTEGER nodes Unknown.

INTEGER format Unknown.

INTEGER(18) idata Unknown.

INTEGER first Unknown.

INTEGER type Unknown.

REAL(6) rdata Unknown.

INTEGER(10) idata2 Unknown.

*NUMERIC*() buffer Unknown.

INTEGER num Unknown.

INTEGER status Unknown.

Error Conditions:

None.

891Chapter 10: Broken, Obsolete, Modified and New FunctionsPATRAN 2.5 Database Compatibility (Chapter 9)

db_line_gfeg Issue:Not supported in Patran.

Resolution:Removed the function decription from the documentation.

Type:Obsolete.

Description:

Unknown.

Input:

INTEGER line Unknown.

INTEGER nodes Unknown.

INTEGER nbuf Unknown.

Output:

INTEGER nodes Unknown.

INTEGER format Unknown.

INTEGER(18)

idata Unknown.

INTEGER first Unknown.

INTEGER type Unknown.

REAL(6) rdata Unknown.

INTEGER(10)

idata2 Unknown.

*NUMERIC*()

buffer Unknown.

INTEGER num Unknown.

INTEGER status Unknown.

Error Conditions:

None.

db_list Issue:Not supported in Patran.

Resolution:Removed the function decription from the documentation.

Type:Obsolete.

Description:

Not supported in Patran.

PCL and CustomizationPATRAN 2.5 Database Compatibility (Chapter 9)

892

Input:

INTEGER list Unknown.

Output:

*STRING-DBXSA1*

data Unknown.

INTEGER num Unknown.

INTEGER status Unknown.

Error Conditions:

None.

893Chapter 10: Broken, Obsolete, Modified and New FunctionsPATRAN 2.5 Database Compatibility (Chapter 9)

db_material Issue:Not supported in Patran.

Resolution:Removed the function decription from the documentation.

Type:Obsolete.

Description:

Not supported in Patran.

Input:

INTEGER matl Unknown.

INTEGER ntrms Unknown.

INTEGER nbuf Unknown.

INTEGER nwords Unknown.

Output:

INTEGER matyp Unknown.

REAL(96) data Unknown.

REAL() pdata Unknown.

INTEGER num Unknown.

INTEGER status Unknown.

Error Conditions:

None.

db_named_component Issue:Not supported in Patran.

Resolution:Removed the function decription from the documentation.

Type:Obsolete.

Description:

Unknown.

Input:

INTEGER comp Unknown.

INTEGER ptr Unknown.

INTEGER nbuf Unknown.

Output:

INTEGER ptr Unknown.

PCL and CustomizationPATRAN 2.5 Database Compatibility (Chapter 9)

894

INTEGER nwords Unknown.

STRING name Unknown.

INTEGER() buffer Unknown.

INTEGER num Unknown.

INTEGER status Unknown.

Error Conditions:

None.

895Chapter 10: Broken, Obsolete, Modified and New FunctionsPATRAN 2.5 Database Compatibility (Chapter 9)

db_nodal_force Issue:Not supported in Patran.

Resolution:Removed the function decription from the documentation.

Type:Obsolete.

Description:

Not supported in Patran.

Input:

INTEGER elno Unknown.

INTEGER sid Unknown.

INTEGER ptr Unknown.

Output:

INTEGER sid Unknown.

INTEGER ptr Unknown.

INTEGER cid Unknown.

INTEGER(6) comp Unknown.

REAL(6) data Unknown.

INTEGER ndata Unknown.

INTEGER status Unknown.

Error Conditions:

None.

Description:

Not supported in Patran.

Input:

INTEGER node Unknown.

INTEGER sid Unknown.

INTEGER ptr Unknown.

Output:

INTEGER sid Unknown.

INTEGER ptr Unknown.

INTEGER flag Unknown.

INTEGER user Unknown.

REAL heat Unknown.

PCL and CustomizationPATRAN 2.5 Database Compatibility (Chapter 9)

896

INTEGER status Unknown.

Error Conditions:

None.

897Chapter 10: Broken, Obsolete, Modified and New FunctionsPATRAN 2.5 Database Compatibility (Chapter 9)

db_nodal_restraint Issue:Not supported in Patran.

Resolution:Removed the function decription from the documentation.

Type:Obsolete.

Description:

Not supported in Patran.

Input:

INTEGER node Unknown.

INTEGER sid Unknown.

INTEGER ptr Unknown.

Output:

INTEGER sid Unknown.

INTEGER ptr Unknown.

INTEGER cid Unknown.

INTEGER(6) comp Unknown.

REAL(6) data Unknown.

INTEGER ndata Unknown.

INTEGER status Unknown.

Error Conditions:

None.

db_nodal_temperature Issue:Not supported in Patran.

Resolution:Removed the function decription from the documentation.

Type:Obsolete.

PCL and CustomizationPATRAN 2.5 Database Compatibility (Chapter 9)

898

Description:

Not supported in Patran.

Input:

INTEGER node Unknown.

INTEGER sid Unknown.

INTEGER ptr Unknown.

Output:

INTEGER sid Unknown.

INTEGER ptr Unknown.

INTEGER flag Unknown.

INTEGER user Unknown.

REAL temp Unknown.

INTEGER status Unknown.

Error Conditions:

None.

db_patch_gfeg Issue:Not supported in Patran.

Resolution:Removed the function decription from the documentation.

Type:Obsolete.

Description:

Not supported in Patran.

Input:

INTEGER patch Unknown.

INTEGER nodes Unknown.

INTEGER nbuf Unknown.

Output:

INTEGER nodes Unknown.

INTEGER format Unknown.

INTEGER(18)

idata Unknown.

INTEGER first Unknown.

INTEGER type Unknown.

PCL and CustomizationPATRAN 2.5 Database Compatibility (Chapter 9)

899

REAL(6) rdata Unknown.

INTEGER(10)

idata2 Unknown.

*NUMERIC*()

buffer Unknown.

INTEGER num Unknown.

INTEGER status Unknown.

Error Conditions:

None.

db_property Issue:Not supported in Patran.

Resolution:Removed the function decription from the documentation.

Type:Obsolete.

Description:

Not supported in Patran.

Input:

INTEGER elno Unknown.

Output:

INTEGER mat Unknown.

INTEGER shape Unknown.

INTEGER nodes Unknown.

INTEGER config Unknown.

REAL(96) data Unknown.

INTEGER(96)

type Unknown.

INTEGER num Unknown.

INTEGER status Unknown.

Error Conditions:

None.

PCL and CustomizationPATRAN 2.5 Database Compatibility (Chapter 9)

900

MSC.Fatigue Quick Start Guide

I n d e xPCL and Customization

PCL and Customization

<analysis_type> PCLanalysis_main.button_class_closed PCLanalysis_main.disable_jobname_and_desc

ription PCLanalysis_main.dont_commit_on_apply

PCLanalysis_main.dont_update_on_apply PCLanalysis_main.get_analysis_menu_items

PCLanalysis_main.get_code_and_type PCLanalysis_main.get_current_job_info PCLanalysis_main.get_file_suffixes PCLanalysis_main.get_job_name_and_desc

PCLanalysis_main.get_panel_info PCLanalysis_main.load_job_name_dbox PCLanalysis_main.refresh_jobname_listbox

PCLanalysis_main.set_display_flags PCLanalysis_main.set_jobname_blank PCLanalysis_main.set_jobname_current PCLapp_count_id_list PCLapp_count_token_list PCLapp_get_handle PCLapp_lp_err_msg PCLapp_next_id PCLapp_next_label PCLblock_close PCLblock_get_name PCLblock_open PCLblock_read PCLblock_write PCLdb_add_general_field_func PCLdb_add_lbc_c_and_t_for_ac PCL

db_add_lbc_defn_for_ac PCLdb_add_lbc_to_load_case PCLdb_add_lbc_type_for_ac PCLdb_add_mpc_to_group PCLdb_add_s_elem_res_by_pos PCLdb_add_s_elem_res_by_type PCLdb_add_s_nod_res_by_pos PCLdb_add_s_nod_res_by_type PCLdb_add_t_elem_res_by_pos PCLdb_add_t_elem_res_by_type PCLdb_add_t_nod_res_by_pos PCLdb_add_t_nod_res_by_type PCLdb_add_v_elem_res_by_pos PCLdb_add_v_elem_res_by_type PCLdb_add_v_nod_res_by_pos PCLdb_add_v_nod_res_by_type PCLdb_associate_element_to_region PCLdb_bar_displacement PCLdb_cfeg PCLdb_close_database PCLdb_commit PCLdb_commit_raw PCLdb_coordinate_frame PCLdb_count_elements_in_region PCLdb_count_elems PCLdb_count_elems_in_group PCLdb_count_general_field_func PCLdb_count_lbc_by_load_case PCLdb_count_mpcs PCLdb_count_mpcs_in_group PCLdb_count_mpcs_in_group PCLdb_count_nodes PCLdb_count_nodes PCLdb_count_nodes_in_group PCL

PCL and Customization

910

db_count_props PCLdb_count_region_ids PCLdb_cr_const_models_specified PCLdb_create_allowable_matl_prop PCLdb_create_allowable_phys_prop PCLdb_create_analysis_code PCLdb_create_analysis_type PCLdb_create_app_region_defn PCLdb_create_bulk_lbc_app_region_n PCLdb_create_condense_opt PCLdb_create_constitutive_model PCLdb_create_coord PCLdb_create_degree_of_freedom PCLdb_create_dof_set PCLdb_create_elem_lbc_var_defn PCLdb_create_element_list PCLdb_create_element_type PCLdb_create_elems PCLdb_create_fem_ds PCLdb_create_fem_dv PCLdb_create_fem_ss PCLdb_create_fem_sv PCLdb_create_field PCLdb_create_field_dfem PCLdb_create_field_dfem_v2 PCLdb_create_field_lbc PCLdb_create_formulation_opt PCLdb_create_geometric_opt PCLdb_create_laminate_opt PCLdb_create_lbc PCLdb_create_lbc_app_region PCLdb_create_lbc_ds PCLdb_create_lbc_dv PCLdb_create_lbc_fem_data PCLdb_create_lbc_fem_data_2reg PCLdb_create_lbc_input_data PCLdb_create_lbc_new PCLdb_create_lbc_ss PCLdb_create_lbc_sv PCL

db_create_lbc_type_defn PCLdb_create_load_case PCLdb_create_material PCLdb_create_matl_category PCLdb_create_matl_const_model PCLdb_create_matl_dir PCLdb_create_matl_lin PCLdb_create_matl_prop_alias PCLdb_create_matl_prop_defn PCLdb_create_matl_prop_value PCLdb_create_mpc_nodal PCLdb_create_mpc_term PCLdb_create_mpc_type_def PCLdb_create_mtl_allowable_magics PCLdb_create_mtl_magics PCLdb_create_mtl_magics_defn PCLdb_create_mtl_magics_options PCLdb_create_nodal_lbc_var_defn PCLdb_create_node_list PCLdb_create_nodes PCLdb_create_phys_prop_defn PCLdb_create_phys_prop_region PCLdb_create_phys_prop_value PCLdb_create_pp_set_defn_wnord PCLdb_create_selected_etype_wc PCLdb_create_selected_prop_set PCLdb_create_sub_case PCLdb_create_sub_mpc PCLdb_create_valid_const_models PCLdb_create_valid_mtl_categories PCLdb_data PCLdb_data_hyperpatch PCLdb_data_line PCLdb_data_patch PCLdb_delete_general_field_func PCLdb_dof _list PCLdb_drop_res_index PCLdb_element PCLdb_element_convection PCL

911INDEX

db_element_heat_flux PCLdb_element_pressure PCLdb_element_radiation PCLdb_element_temperature PCLdb_element_view_factor PCLdb_entity_counts PCLdb_field PCLdb_get_active_flag PCLdb_get_active_load_case PCLdb_get_all_fem_ds_by_id PCLdb_get_all_fem_dv_by_id PCLdb_get_all_fem_ss_by_id PCLdb_get_all_fem_sv_by_id PCLdb_get_all_field_names PCLdb_get_all_load_case_names PCLdb_get_all_mpc_term PCLdb_get_all_node_ids_in_group PCLdb_get_all_region_ids PCLdb_get_all_sub_mpc PCLdb_get_anal_code_id PCLdb_get_comp_lam_ids_by_id PCLdb_get_coord PCLdb_get_coord_ref_coord PCLdb_get_coord_ref_nodes PCLdb_get_current_group_id PCLdb_get_default_anal_code PCLdb_get_elem_etop PCLdb_get_elem_ids PCLdb_get_elem_ids_in_group PCLdb_get_elem_top_def PCLdb_get_elem_top_def PCLdb_get_elem_topology_data PCLdb_get_elem_use_all_node PCLdb_get_elem_use_all_node PCLdb_get_elements_in_region PCLdb_get_field PCLdb_get_field_function PCLdb_get_field_id PCLdb_get_field_name PCL

db_get_field_table PCLdb_get_general_field_func PCLdb_get_group_id PCLdb_get_group_name PCLdb_get_lbc PCLdb_get_lbc_defn PCLdb_get_lbc_fem_count PCLdb_get_lbc_fem_data PCLdb_get_lbc_id_for_type PCLdb_get_lbc_new PCLdb_get_lbc_type_defn_by_id PCLdb_get_lbc_var_value PCLdb_get_load_case PCLdb_get_load_case2 PCLdb_get_material PCLdb_get_matl_const_model PCLdb_get_matl_const_model_count PCLdb_get_matl_prop_value PCLdb_get_matl_prop_value_count PCLdb_get_matl_prop_value2 PCLdb_get_matl_prop_value2 PCLdb_get_max_mpc PCLdb_get_max_physical_property PCLdb_get_maximum_id PCLdb_get_mpc PCLdb_get_mpc_ids PCLdb_get_mpc_type_def PCLdb_get_mpcs_in_group PCLdb_get_next_fem_ds_by_id PCLdb_get_next_fem_dv_by_id PCLdb_get_next_fem_ss_by_id PCLdb_get_next_fem_sv_by_id PCLdb_get_next_field_name PCLdb_get_next_id PCLdb_get_next_load_case_name PCLdb_get_next_mpc_term PCLdb_get_next_sub_mpc PCLdb_get_node_ass_elem PCLdb_get_node_ass_elem PCL

PCL and Customization

912

db_get_node_ass_geo PCLdb_get_node_ass_geo PCLdb_get_node_ass_mpc PCLdb_get_node_ass_mpc PCLdb_get_node_ids PCLdb_get_nodes PCLdb_get_nodes_for_elems PCLdb_get_prop_value PCLdb_get_props_by_region PCLdb_get_region_definition PCLdb_get_region_for_elements PCLdb_grid PCLdb_hyperpatch PCLdb_hyperpatch_gfeg PCLdb_import_database PCLdb_import_database_V2 PCLdb_import_database_V3 PCLdb_is_open PCLdb_line PCLdb_line_gfeg PCLdb_list PCLdb_material PCLdb_modify_field_dfem PCLdb_modify_field_dfem_v2 PCLdb_modify_field_lbc PCLdb_modify_field_name PCLdb_modify_lbc_name PCLdb_modify_material_name PCLdb_modify_phys_prop_region_name PCLdb_mpc PCLdb_mpc_exist PCLdb_name_get PCLdb_named_component PCLdb_nodal_force PCLdb_nodal_heatflux PCLdb_nodal_restraint PCLdb_nodal_temperature PCLdb_node PCLdb_open_database PCL

db_patch PCLdb_patch_gfeg PCLdb_post_coord PCLdb_post_results_load PCLdb_property PCLdb_set_comp_lam_by_id PCLdb_set_coord_ref_coord PCLdb_set_coord_ref_nodes PCLdb_set_elem_verification_parms PCLdb_start_transaction_raw PCLdb_undo PCLdbi_query_database PCLDbNameGet PCLdbt_assoc_global_variables PCLdbt_create_elem_positions PCLdbt_create_global_variables PCLdbt_create_layers PCLdbt_create_res_types PCLdbt_create_res_types PCLdbt_create_sect_pos PCLelementprops_def_create.make_elem_sum

mary PCLem_proceed_normal PCLem_proceed_quick PCLem_synchronize PCLep_get_app_reg_str PCLep_word_val_at_el_cen PCLep_word_val_at_el_cen_by_reg PCLfem_get_patran25_etop PCLfem_u_count_id_list PCLfem_u_extract_node_ids PCLfem_u_get_id_list PCLfem_u_get_subid_list PCLfields_genrl_inp_data.form_up PCLfields_genrl_inp_data.get_data PCLfields_genrl_inp_data.pass_ind_var_ids

PCLfields_genrl_inp_data.write_term_data PCLfile_add_path PCL

913INDEX

file_append_version PCLfile_build_fname PCLfile_copy PCLfile_create_directory PCLfile_delete PCLfile_delete_path PCLfile_executable PCLfile_exists PCLfile_exists_local PCLfile_exists_version PCLfile_expand_home PCLfile_get_bfname PCLfile_get_dfname PCLfile_get_efname PCLfile_get_filespec PCLfile_get_next_path PCLfile_get_p3_home PCLfile_init_path PCLfile_list_end PCLfile_list_next PCLfile_list_start PCLfile_query_remote PCLfile_readable PCLfile_unique_name PCLfile_writeable PCLfio_close PCLfio_delete PCLfio_opena PCLfio_openr PCLfio_openw PCLfio_read PCLfio_rewind PCLfio_save_vars PCLfio_write PCLfio_writec PCLfio_writef PCLget_field_values_25 PCLgm_conv_world_to_device PCLgm_draw_arrow PCL

gm_draw_line PCLgm_draw_marker PCLgm_draw_result_arrow PCLgm_draw_text PCLgm_segment_create PCLgm_segment_delete PCLgm_segment_flush PCLgm_viewport_center_get PCLgm_viewport_refresh PCLgm_viewport_subject_get PCLgm_viewport_world_limits_get PCLgm_viewports_refresh PCLio_write PCLio_write_line PCLio_writec PCLio_writef PCLlbc_defn_create.lbc_defn PCLlbc_defn_create.lbc_var_defn PCLlbc_defn_create.lbc_var_defn PCLlbc_defn_create.valid_targets PCLlbc_get_one_app_reg_str PCLloadsbcs_eval_all PCLlp_eval PCLlp_eval_cleanup PCLlp_keyword_text PCLlp_picklist_string_creator_v PCLlp_print_list PCLlp_print_sublist PCLlp_sub_str_by_keyword PCLlp_sub_str_ent_type PCLlp_sublist_attribute_get_float PCLlp_sublist_attribute_get_floata PCLlp_sublist_attribute_get_int PCLlp_sublist_attribute_get_inta PCLlp_sublist_attribute_get_string PCLlp_sublist_count PCLlp_sublist_fetch PCLlp_sublist_next PCLlp_sublist_reset PCL

PCL and Customization

914

lp_sublist_type PCLmsg_get_string PCLmsg_to_form PCLmsg_to_text PCLmth_abs PCLmth_acosd PCLmth_acosr PCLmth_array_search PCLmth_asind PCLmth_asinr PCLmth_atan2d PCLmth_atan2r PCLmth_atand PCLmth_atanr PCLmth_cosd PCLmth_cosr PCLmth_exp PCLmth_ln PCLmth_log PCLmth_max PCLmth_min PCLmth_mod PCLmth_nint PCLmth_round PCLmth_sign PCLmth_sind PCLmth_sinr PCLmth_sort PCLmth_sort_column PCLmth_sort_row PCLmth_sqrt PCLmth_tand PCLmth_tanr PCLmy_spawn PCLpcntcomplete_close PCLpcntcomplete_init PCLpcntcomplete_update PCLrecord_begin_read PCLrecord_begin_write PCL

record_close PCLrecord_end_rw PCLrecord_get_header PCLrecord_get_name PCLrecord_get_position PCLrecord_open_new PCLrecord_open_old PCLrecord_read_chars PCLrecord_read_halfints PCLrecord_read_int4bits PCLrecord_read_int8bits PCLrecord_read_intbits PCLrecord_read_ints PCLrecord_read_logicals PCLrecord_read_pointers PCLrecord_read_reals PCLrecord_read_rechead PCLrecord_set_position PCLrecord_update PCLrecord_write_chars PCLrecord_write_halfints PCLrecord_write_int4bits PCLrecord_write_int8bits PCLrecord_write_intbits PCLrecord_write_ints PCLrecord_write_logicals PCLrecord_write_pointers PCLrecord_write_reals PCLrecord_write_rechead PCLrecord_writerec_chars PCLrecord_writerec_intchr PCLrecord_writerec_ints PCLrecord_writerec_reals PCLsf_commit PCLsf_force_write PCLsf_pause PCLsf_play PCLsf_play_default PCLsf_record_default PCL

915INDEX

sf_rotation PCLsf_verbose PCLsf_write PCLsf_write_disable PCLstr_abbreviation PCLstr_assign PCLstr_datatype PCLstr_equal PCLstr_find_match PCLstr_find_nomatch PCLstr_formatc PCLstr_formatf PCLstr_from_ascii PCLstr_from_integer PCLstr_from_logical PCLstr_from_real PCLstr_index PCLstr_length PCLstr_maxlength PCLstr_pattern PCLstr_strip_lead PCLstr_strip_trail PCLstr_substr PCLstr_to_ascii PCLstr_to_integer PCLstr_to_logical PCLstr_to_lower PCLstr_to_real PCLstr_to_upper PCLstr_token PCLstream_close PCLstream_get_header PCLstream_get_name PCLstream_get_position PCLstream_open PCLstream_read_char PCLstream_read_int PCLstream_read_real PCLstream_set_header PCL

stream_set_position PCLstream_skip_char PCLstream_skip_int PCLstream_skip_real PCLstream_update PCLstream_write_char PCLstream_write_int PCLstream_write_real PCLstring_newline_count PCLstring_newline_count PCLstring_newline_position PCLstring_newline_position PCLstring_read PCLstring_write PCLsys_allocate_array PCLsys_allocate_string PCLsys_array_hbound PCLsys_array_lbound PCLsys_array_nbound PCLsys_class_get PCLsys_class_get PCLsys_class_set PCLsys_clock PCLsys_cputime PCLsys_date PCLsys_eval PCLsys_eval PCLsys_free_array PCLsys_free_string PCLsys_func_where PCLsys_get_env PCLsys_get_errno_msg PCLsys_get_info PCLsys_get_user PCLsys_hash_stat PCLsys_input PCLsys_library PCLsys_move_raw PCLsys_path PCL

PCL and Customization

916

sys_poll_option PCLsys_product PCLsys_reallocate_array PCLsys_reallocate_string PCLsys_release PCLsys_sf_argopt PCLsys_sf_callopt PCLsys_sf_commit PCLsys_sf_undo PCLsys_sf_vwclear PCLsys_sf_write PCLsys_stop_input PCLsys_time PCLsys_trace PCLsys_traceback PCLtext_close PCLtext_file_query PCLtext_flush PCLtext_get_file_size PCLtext_get_name PCLtext_get_position PCLtext_open PCLtext_read PCLtext_read_string PCLtext_set_position PCLtext_truncate PCLtext_write PCLtext_write_string PCLui_answer_message PCLui_button_create PCLui_buttonicon_create PCLui_c_popupmenu PCLui_cascadeitem_create PCLui_colorbar_create PCLui_colormenu_create PCLui_cursor_set PCLui_databox_create PCLui_databox_get_current PCLui_exec_function PCL

ui_file_create PCLui_file_create PCLui_form_create PCLui_form_delete PCLui_form_display PCLui_form_hide PCLui_form_to_file PCLui_form_to_frame PCLui_frame_create PCLui_framemaker PCLui_item_create PCLui_item_delete PCLui_item_deleteall PCLui_item_deleteselected PCLui_item_display PCLui_item_hide PCLui_item_idfromlabel PCLui_item_labelfromname PCLui_item_namefromlabel PCLui_item_relabel PCLui_itemicon_create PCLui_label_create PCLui_labelicon_create PCLui_list_select_nitems PCLui_listbox_create PCLui_listbox_items_create PCLui_listbox_items_delete PCLui_listbox_select_items PCLui_listbox_unselectall PCLui_menu_create PCLui_modalform_create PCLui_optionmenu_create PCLui_override_message PCLui_post_popupmenu PCLui_read_integer PCLui_read_logical PCLui_read_real PCLui_read_string PCLui_ring_bell PCL

917INDEX

ui_scrollframe_create PCLui_scrollitem_setvisible PCLui_selectdatabox_create PCLui_selectframe_create PCLui_separator_create PCLui_set_fixedfont PCLui_set_focus PCLui_slidebar_create PCLui_spread_cell_delete PCLui_spread_cells_delete PCLui_spread_create PCLui_spread_get_cell PCLui_spread_get_cell_info PCLui_spread_get_cell_length PCLui_spread_get_layer_value PCLui_spread_get_num_vis_rows PCLui_spread_get_selected PCLui_spread_get_top_row PCLui_spread_row_create PCLui_spread_row_delete PCLui_spread_set_cell PCLui_spread_set_cell_info PCLui_spread_set_cells PCLui_spread_set_display PCLui_spread_set_label PCLui_spread_set_layer_value PCLui_spread_set_selected PCLui_spread_set_top_row PCLui_spread_set_value_label PCLui_switch_create PCLui_text_create PCLui_toggle_create PCLui_toggleicon_create PCLui_tree_add_image PCLui_tree_add_item PCLui_tree_add_items PCLui_tree_calldata_get_count PCLui_tree_calldata_get_items PCLui_tree_clear_selection PCL

ui_tree_create PCLui_tree_delete_image PCLui_tree_delete_item PCLui_tree_delete_items PCLui_tree_expand_item PCLui_tree_get_selection PCLui_tree_select_item PCLui_tree_select_items PCLui_tree_select_node PCLui_tree_set_selection PCLui_treeitem_get_child_count PCLui_treeitem_get_children PCLui_treeitem_get_image PCLui_treeitem_get_label PCLui_treeitem_get_parent PCLui_treeitem_is_ expanded PCLui_treeitem_is_selected PCLui_treeitem_set_image PCLui_treeitem_set_label PCLui_verify_name PCLui_wid_delete PCLui_wid_exists PCLui_wid_get PCLui_wid_get_vstring PCLui_wid_refresh PCLui_wid_restore PCLui_wid_save PCLui_wid_set PCLui_wid_set PCLui_write PCLui_write_line PCLui_writec PCLui_writef PCLuil_pref_analysis.set_analysis_pref PCLuser_message PCLutl_display_process_error PCLutl_get_cust_info PCLutl_get_host_name PCLutl_get_product PCL

PCL and Customization

918

utl_get_user_name PCLutl_get_version PCLutl_process_error PCLutl_process_kill PCLutl_process_spawn PCLutl_process_wait PCLvirtual_close PCLvirtual_get_position PCLvirtual_open_scratch PCLvirtual_read_char PCLvirtual_read_int PCLvirtual_read_real PCLvirtual_set_position PCLvirtual_skip_char PCLvirtual_skip_int PCLvirtual_skip_real PCLvirtual_write_char PCLvirtual_write_int PCLvirtual_write_real PCLwrite PCLwrite_line PCLxf_error_continue PCLxf_error_end PCLxf_error_start PCLxf_read_from_user PCLxf_read_stdin PCLxf_write_command PCLxf_write_comment PCLxf_write_print PCLxf_write_query PCLxf_write_stderr PCLxf_write_stdout PCL