0% found this document useful (0 votes)
35 views

Exercise 01 Keymapping PCL Functions

This document provides instructions for keymapping PATRAN commands to function keys using a PCL function. The steps are: 1. Import a part file into a new PATRAN database 2. Record commands like changing views and settings to create a session file 3. Edit the session file to define it as a PCL function called Set_Display_Att 4. Map the F6 key in PATRAN preferences to call this PCL function 5. Test that the keymapped commands now run when F6 is pressed 6. Make the keymapping permanent by compiling the function into a library loaded each session

Uploaded by

bocioaga
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

Exercise 01 Keymapping PCL Functions

This document provides instructions for keymapping PATRAN commands to function keys using a PCL function. The steps are: 1. Import a part file into a new PATRAN database 2. Record commands like changing views and settings to create a session file 3. Edit the session file to define it as a PCL function called Set_Display_Att 4. Map the F6 key in PATRAN preferences to call this PCL function 5. Test that the keymapped commands now run when F6 is pressed 6. Make the keymapping permanent by compiling the function into a library loaded each session

Uploaded by

bocioaga
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

LESSON 1

Keymapping PCL Functions

X
Z

Objectives:
■ Import an express neutral file

■ Key Map several PATRAN commands to one key.

■ Use the session file generated by PATRAN to create a


PCL function.

PATRAN 302 Exercise Workbook - Release 8.0 1-1


1-2 PATRAN 302 Exercise Workbook - Release 7.0
EXERCISE 1 Keymapping PCL Functions

Model Description:
In this exercise you will import an express neutral file into
a Patran database. You will then perform a few display
changes with the model, recording these changes in a
session file. A terminal window will be opened, and (using
a text editor) the recorded session file will be converted
into a PCL function. The function will then be keymapped
to a specific function key.

Exercise Procedure:
1. In your xterm window type p3 to start MSC/PATRAN.
Then create a new database called, shield.db.

File/New ...
New Database Name: shield.db
OK

Click OK in the New Model Preference form.

2. Import the graphics file.

File/Import...
Object: model
Source: Parasolid xmt
Express Neutral Files: shield_v11.xmt_txt
Apply

Look at the Import Summary form. Notice the types of geometry that
were imported with this parasolid file. Click OK at the bottom of the
form.

OK

3. Start recording a new session file by doing the following:

File/Session/Record ...
Recording File: keymap_sample.pcl

PATRAN 302 Exercise Workbook - Release 7.0 1-3


Apply

The next steps are going to be done in sequential order so that you
may later change the journal file into a simple PCL function.

4. Change the view to Iso1 View.

Iso1 View

5. Open the Display/Geometry form and move the shrink


geometry slide bar until it reads .30. This should shrink
all your geometry by 30 percent. Change the point size
to 5. Turn on the Tsurf labels..

Display/Geometry ...
Geometric Shrink: .30
Point Size: 5
Colors and Labels: ■ Surface
■ Tsurf
Apply
Cancel

6. Change the rendering to smooth shaded using the


following toolbar icon:

Smooth Shaded

7. After completing these steps go to File/Session/


Record... and click the Stop button. This will end this
portion of the session file.

File/Session/Record ...
Stop
Cancel

8. Now open a UNIX window or DOS command prompt


and use a text editor to make the following changes to
keymap_sample.pcl.01:

1-4 PATRAN 302 Exercise Workbook - Release 7.0


EXERCISE 1 Keymapping PCL Functions

You will need to exit entirely out of PATRAN before you can
edit the file in Windows NT. Delete any line that starts with
a dollar sign then pound symbol ($# - these are just
comments in the PATRAN Command Language). Just
before the line:
ga_view_aa_set( 23., -34., 0. )
add the line:
FUNCTION Set_Display_Att()
After the last line:
uil_toolbar.shaded_smooth ( )
enter this line:
END FUNCTION
This session file that was just edited can now be used to as a PCL
function that can be executed in PATRAN.

9. Close the database and, once again, open a new database


with the same name as before.

File/Close

File/New ...
New Database Name: shield.db
OK

When prompted that a database already exists with the same name,
respond that you wish to overwrite the old database.

Yes

Click OK in the New Model Preference form

10. In the command window of PATRAN type:

!!input keymap_sample.pcl.01
11. In the main menu of PATRAN go into Preferences/Key
Map... and set up the F6 key to utilize the recently made
PCL function.

Preferences/Key Map ...


■ F Key F6

PATRAN 302 Exercise Workbook - Release 7.0 1-5


To Action: CallPCL
■ Customize
Map String: None<Key>F6: CallPCL
(“Set_Display_Att”)
Apply

Note: The only thing that needs to be typed into the databox is the
name of the function: “Set_Display_Att”, and this needs to
be entered inside the parentheses.

Close the Keymap Preferences form.

Close

12. Import the part file just as before.

File/Import...
Object: model
Source: Parasolid xmt
Express Neutral Files: shield_v11.xmt_txt
Apply

Look at the Import Summary form. Notice the types of geometry


that were imported with this parasolid file. Click OK at the bottom
of the form.

OK

1-6 PATRAN 302 Exercise Workbook - Release 7.0


EXERCISE 1 Keymapping PCL Functions

13. Click on the defualt viewport to make it active (the


keymapping will not work if the viewport is not the active
screen) Press the F6 key when the part file is done
loading.The surfaces of the part should now shrink and
appear like the following:

16

15
17

21

19
12
11
20 10

9
22
8
7
24 251

23
14 6
13 5
18 4 32
Y

Z X

14. Make the keymapped function a permanent feature of all


your PATRAN sessions.

Open a UNIX window. Then, look at the file called


.Patran.EventMaps. Notice that the last line contains the keymap
string that you input from the Keymap Preferences form.
Unfortunately, if you were to restart PATRAN and try to use the F6
key again, nothing would happen because the PCL function was not
loaded. Instead of manually inputting the function every time you start
PATRAN, there is an easier way to make the function available for
every session.

Compile the PCL function into a library by inputting the following


command in the PATRAN command window:
!!compile keymap_sample.pcl.01 keymap

Use a text editor to create a file by the name of p3epilog.pcl which


contains the following line:
!!library keymap.plb

PATRAN 302 Exercise Workbook - Release 7.0 1-7


When done, quit PATRAN and restart it. Then, once again, create a
new database called shield.db.

File/New ...
New Database Name: shield.db
OK

When prompted that a database already exists with the same name,
respond that you wish to overwrite the old database.

Yes

Click OK in the New Model Preference form.


Import the Express Neutral file one last time.

File/Import...
Object: model
Source: Parasolid xmt
Express Neutral Files: shield_v11.xmt_txt
Apply

Once again, close the warning and import summary.

OK

Push F6. Notice that PATRAN executes the PCL function.

This ends the exercise.

1-8 PATRAN 302 Exercise Workbook - Release 7.0

You might also like