Wednesday, May 28, 2008

Pro/ENGINEER: Anatomy of a Trail File, Part 2

Read Part 1

Recording/Editing Techniques

Trail files are often touted as a crash recovery mechanism. While they can serve this function in very limited circumstances, they are usually not that helpful for this activity. For repetitive tasks, however, trail files are extraordinarily helpful.

To make them extraordinarily helpful, trail files must be recorded and edited very carefully. Right out of the box, Pro/ENGINEER doesn't record very efficient trail files. They will function, but can be excessively verbose and difficult to edit.

Here is an example of a trail file segment that opens a part file. It's a good example of how not to record trail files. Generally speaking, avoid typing in names when you can select them.

~ Select `main_dlg_cur` `MenuBar1` \
1 `File`
~ Close `main_dlg_cur` `MenuBar1`
~ Activate `main_dlg_cur` `File.psh_open`
< 2 0.256000
~ Input `file_open` `Inputname` \
`a`
~ Input `file_open` `Inputname` \
`ab`
~ Input `file_open` `Inputname` \
`abc`
~ Input `file_open` `Inputname` \
`abc.`
~ Input `file_open` `Inputname` \
`abc.p`
~ Input `file_open` `Inputname` \
`abc.pr`
~ Input `file_open` `Inputname` \
`abc.prt`
~ Update `file_open` `Inputname` \
`abc.prt`
~ Activate `file_open` `Inputname`
!Command ProCmdModelOpenExe was pushed from the software.
!15-May-08 17:39:09 Start ./abc.prt.2
!15-May-08 17:39:11 End ./abc.prt.2
 
Compare this against a trail recorded by selecting (not typing) the name of the model to open, and using the config.pro option CMDMGR_TRAIL_OUTPUT set to YES. This option is meant to simplify trail file output and make the menu picks less dependent on the menus. If Tools / Customize Screen is used to move menus around, this mapkey will continue to work, but the previous one might fail.

~ Command `ProCmdModelOpen` 
< 2 0.256000
~ Select `file_open` `Ph_list.Filelist` \
1 `abc.prt`
~ Activate `file_open` `Open`
!Command ProCmdModelOpenExe was pushed from the software.
!15-May-08 17:36:11 Start ./abc.prt.2
!15-May-08 17:36:16 End ./abc.prt.2
 
As you can see the results are much simpler. In fact, following the rules from Part 1, four of the eight lines can additionally be reduced:

~ Command `ProCmdModelOpen` 
~ Select `file_open` `Ph_list.Filelist` \
1 `abc.prt`
~ Activate `file_open` `Open`
 

There will be times when you need to automate something using an existing trail file but you either don't have the luxury or the desire to re-record the trail file. In this case you want to eliminate the fluff, but keep the necessary elements. From the verbosely recorded sequence, the following can be completely eliminated:

~ Input `file_open` `Inputname` \
`a`
~ Input `file_open` `Inputname` \
`ab`
~ Input `file_open` `Inputname` \
`abc`
~ Input `file_open` `Inputname` \
`abc.`
~ Input `file_open` `Inputname` \
`abc.p`
~ Input `file_open` `Inputname` \
`abc.pr`
 

Of the remaining lines, the first two can typically be eliminated.

~ Input `file_open` `Inputname` \
`abc.prt`
~ Update `file_open` `Inputname` \
`abc.prt`
 

Which leaves this as a result:

~ Update `file_open` `Inputname` \
`abc.prt`
 

When you are replaying a trail file without changing the model used (i.e. for running a benchmark), a lot of these edits are not required. When you are using the trail file as a template for different models, these type of edits are very important, making it much easier to adapt the trail file.


Next time: Robust selection techniques with trail files

1 comment:

Shinoy said...

This is really informative.