0% found this document useful (0 votes)
22 views10 pages

Exercise 03 Quickpick Icon

This document provides instructions for adding a custom icon to the PATRAN QuickPick menu that will shrink finite elements when selected. The steps are: 1. Create a PCL class called p302 containing a function to shrink elements by 20%. 2. Edit the icon file p302_shrink.icon to represent a shrink operation. 3. Modify the p3quickpick.def file to associate the icon with the p302 class and its shrink function. 4. Compile the PCL class into a library and add it to the PATRAN startup file p3epilog.pcl. 5. Open a sample database in PATRAN to test that selecting the new icon shrinks elements

Uploaded by

bocioaga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views10 pages

Exercise 03 Quickpick Icon

This document provides instructions for adding a custom icon to the PATRAN QuickPick menu that will shrink finite elements when selected. The steps are: 1. Create a PCL class called p302 containing a function to shrink elements by 20%. 2. Edit the icon file p302_shrink.icon to represent a shrink operation. 3. Modify the p3quickpick.def file to associate the icon with the p302 class and its shrink function. 4. Compile the PCL class into a library and add it to the PATRAN startup file p3epilog.pcl. 5. Open a sample database in PATRAN to test that selecting the new icon shrinks elements

Uploaded by

bocioaga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

LESSON 3

Adding an Icon to
QuickPick

Objectives:
■ Write a PCL Class to shrink Finite Elements.

■ Create a shrink icon.

■ Add the icon to the QuickPick menu.

PATRAN 302 Exercise Workbook - Release 8.0 3-1


3-2 PATRAN 302 Exercise Workbook - Release 8.0
LESSON 3 Adding an Icon to the QuickPick Menu

Exercise Description:
In this exercise you will first create a PCL Class which
contains a PCL Built-in function to shrink finite elements.
You will then create a icon to invoke the PCL function. By
modifying the p3quickpick.def file, you will add the icon to
the quickpick menu.

Shown below is the resulting quickpick menu with the new


icon.

Suggested Exercise Steps:


■ Using Jot (SGI), xedit(SUN), vuepad(HP) or vi, write a PCL
class named p302 which contains a shrink function.The
function contains one line:

ga_display_shrfem_set( "general", 0.2 )

■ Copy the file $P3_HOME/icons/qptemplate.icon to your


working directory and rename it p302_shrink.icon.

■ Using a bitmap editor, edit the icon to make it appear like a


shrunk element.

■ Copy the file P3_HOME/p3quickpick.def into your

PATRAN 302 Exercise Workbook - Release 8.0 3-3


working directory.

■ Change the first line to:

*MAXROWS = 17

■ Add the following lines to the file after *MAXROWS = 17.

*ICON = p302_shrink.icon
*CLASS = p302
*FUNCTION = shrink
*LOAD ITEM

■ Start up PATRAN and type the following at the command line:

!!compile p302.pcl into p302.plb

■ Exit from PATRAN and create a new file called p3epilog.pcl.

■ Add the following lines to the file:

!!library p302.plb

■ Restart PATRAN.

■ Open a database (icon.db). Create a patch and mesh it with 4


elements.

■ Select Display from the top menu bar

■ Select Quickpick

■ Select the first icon, the elements should shrink by 20%.

Files:
All the files used in this exercise are listed below. Each listing includes
the file, where it originated, its format (text/binary) and summary
information as to how it relates to this exercise.

File Supplied/CreatedFormatDescription

p302.pcl Created text This text file contains the PCL Class and
PCL Built-in function to shrink finite
elements. This file is created using a
text editor.

p302.plb Created binary This is the compiled version of the p302.pcl


file. This file contains the class and
function which is executed by MSC/
PATRAN when the Icon is depressed.

3-4 PATRAN 302 Exercise Workbook - Release 8.0


LESSON 3 Adding an Icon to the QuickPick Menu

qptemplate.icon Supplied text This is a PATRAN default quickpick


template. This file can be copied and
edited by any bitmap editor.

p302_shrink.icon Created text This file is the modified qptemplate.icon


file. This icon is created for this
exercise. This icon is called by the
quickpick.def file which associates the
icon to an action.

p3quickpick.def Supplied text This is a PATRAN definition file for the


QuickPick. This file can be copied by
the user to their home or local directory.
This is a text file which relates icons,
pcl classes and functions. This file is
read when p3 is executed.

p3epilog.pcl Created text This is a text file which contains start-up


information when MSC/PATRAN is
executed. For this exercise, this file will
let PATRAN load the p302.plb.

icon.db Created binary This is a sample database which is used


to verify the quickpick was successfully
built.

Exercise Procedure:
1. Write a new PCL class called p302 by creating a
file, p302.pcl using an on-line editor, either vi, jot, Write the
vuepad or xedit and add the following lines to it: PCL class
CLASS p302
/*
* Quickpick icon to shrink elements
* Exercise for the PAT302 class
*/
FUNCTION shrink
ga_display_shrfem_set( "general", 0.2 )
END FUNCTION
END CLASS /* p302 */

Save and exit the file.

2. Copy the file from $P3_HOME/icons/


qptemplate.icon to your working directory and
rename it to p302_shrink.icon. There are many icon
editors and the specific icon editor you will use for this

PATRAN 302 Exercise Workbook - Release 8.0 3-5


Write the PCL class

exercise and they are depend on which system you are


working on (see Appendix C for a list of icon editors).
To invoke an icon editor, simply type the icon editor
command for your system. For example, if you are
using a machine that operates under the Motif Window
Manager (mwm), you could invoke the mwm icon
editor, bitmap, by typing:

bitmap p302_shrink.icon

at the command line. The following should appear:

3-6 PATRAN 302 Exercise Workbook - Release 8.0


LESSON 3 Adding an Icon to the QuickPick Menu

Edit the bitmap by using the editing tools on the right


bar to produce something like:

Save the file and quit the bitmap editor.

3. Copy the file $P3_HOME/p3quickpick.def into the


working directory. Change the permission mode of the file Edit
from read_only to write-able using the following
command: p3quickpick
.def
chmod 777 p3quickpick.def

Using the editor, change the first line of the file to:

*MAXROWS = 17

and then insert the following after the above line:

*ICON = p302_shrink.icon
*CLASS = p302
*FUNCTION = shrink
*LOAD ITEM

4. Type the following command in the prompt window to


start the P3/PCL Compiler: Using the
PCL
p3pclcomp
Compiler

PATRAN 302 Exercise Workbook - Release 8.0 3-7


Edit p3epilog.pcl

After that, type in the command shown below:

-> !!compile p302.pcl into p302.plb

Exit the P3/PCL compiler.

5. Edit or create a new file, p3epilog.pcl in your working


Edit directory. Add this line:
p3epilog.pcl
!!library p302.plb

6. Start P3/PATRAN and open a new database icon.db.


Select Tools/quickpick/vertical from the top menu bar.
The following should appear:
Display the
icon bar

The Shrink
Icon

3-8 PATRAN 302 Exercise Workbook - Release 8.0


LESSON 3 Adding an Icon to the QuickPick Menu

7. Create a square surface by typing PA at the command


line. Mesh the surface with 4 quad elements. Test the icon
◆ Finite Elements
Action: Create

Object: Mesh

Method: Surface

Global Edge Length 0.5


Element Topology Quad4
Mesher Isomesh
Surface List Surface 1

Press Apply and the following should appear:

y
z x

PATRAN 302 Exercise Workbook - Release 8.0 3-9


Test the icon

Now press the new icon on the QuickPick bar and the
finite elements will shrink by 20% as shown belo

y
z x

Close the database to complete this exercise.

3-10 PATRAN 302 Exercise Workbook - Release 8.0

You might also like