Pro Engineer/Mapkeys

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Purpose[edit | edit source]

Mapkeys are macros that allow multiple Pro/Engineer commands to be executed in series by issuing a single short command. Mapkeys thereby make the user interface customizable and can offer productivity enhancements to users. If there is a series of commands you use frequently, or even a single function you would like to map to a keyboard command for faster access, Mapkeys offer a quick solution.

Creating Mapkeys[edit | edit source]

Start by choosing Tools > Mapkeys from the main menu. The Mapkeys dialog appears. The dialog shows a list of existing mapkeys:


Press New... and the Record Mapkey dialog appears:

Mapkeys record.png

The Key Sequence must be a series of characters from the list below. To use a function key, lead its name with a dollar sign, e.g. $F1. Otherwise, enter a series of visible characters (see list below). Optionally, enter a name for the mapkey—this will show in the main table of mapkeys and can serve as a reminder of the function of the key. A more verbose comment can be left in the Description field, which is also optional.

At this time, the function of the command must be specified. It can either be a recording of a series of clicks and keypresses, or it can be entered as a script. A rudimentary text editor is offered for scripting in the OS Script tab. Otherwise, to create a basic recorded mapkey, press Record and begin. press Stop when the desired commands have been recorded. Note that every detail of your actions is recorded. Recordings may be stopped and resumed for convenience.

Note that many commands are not available at all times. For example, the sketcher tools are not available in the main part view mode. Also, a number of possible clicks may be out of reach due to hidden toolbars, dialogs, or other GUI features.

Through this interface, the keys that invoke existing recordings cannot be modified. However, they can be changed by saving to a Configure file (the default file is called On the other hand, the recording or script connected with a particular key sequence can be replaced at any time.

Once the mapkey is created, click OK, and Close the Mapkeys dialog. To use the mapkey, simply press the key sequence.

Details[edit | edit source]

Mapkeys are not necessarily single keys, as the name suggests, but in fact are generally commands of multiple characters, and can can be up to 77-character-long strings consisting of all the visible typed characters.


Spaces, tabs, and newlines cannot be used. There is no distinction made for numpad keys, and the keys cannot be extended by Ctrl, Alt, Shift, or other meta combinations. This makes the above alphabetic characters case-insensitive.

Alternatively, Mapkeys may be invoked by the function keys F1-F12. In this case, they must be single keypresses; the function keys cannot be combined with other letters, numbers, or symbols. These are specified by leading the desired function key with a dollar sign, e.g. $F5

Mapkeys commands are always typed on the keyboard and are executed immediately upon pressing the final character of the command. Visual feedback of entered keys (other than the function keys) is shown in the lower left status bar until the command is complete. Mapkeys are not executed until their entire command strings are typed completely, and as of Pro/Engineer Wildfire 2, there is no automatic completion mechanism available. If a Mapkeys command is typed incorrectly, such that a nonexistent command has been entered, Pro/Engineer does not offer any warning. In this case it is up to the user to notice that the typed characters remain in the status bar. If excess characters remain in the Mapkeys status bar after typing a command incorrectly, they must be manually cleared by pressing Enter or by taking focus away from the Pro/Engineer window before Mapkeys may be used again. For these reasons, Mapkeys commands are best kept as short as possible. Users should be cautious about pressing spacebar while using Pro/Engineer because, although spaces are not allowed to be part of a Mapkeys command, this is only enforced in the creation dialog. Spaces are allowed to be typed during regular program use. If a space leads the front of a command, it will keep it from working. The user may waste time not noticing the invisible space causing the failure.

There is a bug in Pro/Engineer that if the 77 characters have been filled, Enter does not clear them. Press Backspace to erase one character first.

Q&A[edit | edit source]

Question:[edit | edit source]

In previous versions of Pro/E, we had mapkeys for easy change of some parameters (like Description). I can't get it to work with the new UI for parameters and relations. If I put the config options new_relation_ui and new_parameter_ui to no, my mapkeys work fine. I have tried to record them from start, but with no success.

Answer:[edit | edit source]

When you record your macro, the first thing you do is to set the options new_relation_ui and new_parameter_ui to no. Record the rest of your macro/mapkey normally, then when finished, reset the same options back to yes.

An alternative to this would be to record a macro/mapkey to set the options to no and another mapkey to set them to yes. Since mapkeys can be nested, your macro could execute the no mapkey at the beginning of your routine and then execute the yes mapkey at the end. For example:

mapkey(continued) ~ Select `main_dlg_cur` `MenuBar1`1 `Utilities`;\
mapkey(continued) ~ Close `main_dlg_cur` `MenuBar1`;\
mapkey(continued) ~ Activate `main_dlg_cur` `Utilities.psh_util_pref`;\
mapkey(continued) ~ FocusOut `preferences` `InputOpt`;\
mapkey(continued) ~ Select `preferences` `AssyTree`1 `node0:new_parameter_ui : no : 3`;\
mapkey(continued) ~ Open `preferences` `EditPanel`;~ Close `preferences` `EditPanel`;\
mapkey(continued) ~ Select `preferences` `EditPanel`1 `yes *`;\
mapkey(continued) ~ Activate `preferences` `AddOpt`;~ FocusOut `preferences` `InputOpt`;\
mapkey(continued) ~ Activate `preferences` `ApplySave`;~ FocusOut `preferences` `InputOpt`;\
mapkey(continued) ~ Activate `preferences` `Close`;
mapkey(continued) ~ Select `main_dlg_cur` `MenuBar1`1 `Utilities`;\
mapkey(continued) ~ Close `main_dlg_cur` `MenuBar1`;\
mapkey(continued) ~ Activate `main_dlg_cur` `Utilities.psh_util_pref`;\
mapkey(continued) ~ FocusOut `preferences` `InputOpt`;\
mapkey(continued) ~ Select `preferences` `AssyTree`1 `node0:new_parameter_ui : yes : 3`;\
mapkey(continued) ~ Open `preferences` `EditPanel`;~ Close `preferences` `EditPanel`;\
mapkey(continued) ~ Select `preferences` `EditPanel`1 `no`;~ Activate `preferences` `AddOpt`;\
mapkey(continued) ~ FocusOut `preferences` `InputOpt`;~ Activate `preferences` `ApplySave`;\
mapkey(continued) ~ FocusOut `preferences` `InputOpt`;~ Activate `preferences` `Close`;

Question:[edit | edit source]

How do you make nested mapkeys?

What would @dp04 mean for a "key sequence?

Answer:[edit | edit source]

To nest mapkeys (call a mapkey from another mapkey), add % into the top level mapkey.

For example, here is a mapkey named print that calls two mapkeys named zr and laser.

mapkey print @MAPKEY_NAMEPrint Extents;%zr;%laser;