Quantcast
Channel: PTC Community : Document List - All Communities
Viewing all articles
Browse latest Browse all 1247

de re Mapkeys

$
0
0

Generally, this document is about Mapkeys, and not a place to collect mapkeys. I think the place to collect mapkeys is a Mapkey Index document and separate documents for each mapkey/mapkey group. For example, the rather lengthy mapkeys should get their own documents, but one liners that do pan-zoom-rotate, for example, can get their own.


Personal Preference


Generally, I recommending storing mapkeys in .txt files and at worst, have only one mapkey in config.pro to open the import config dialog to get to them. This way the config.pro stays unedited except as required and contains config options. The mapkeys can be maintained with Notepad, or other editor without trouble.


I also recommend that the mapkey window be kept open so that the mapkeys can be selected and Run from the mapkey window. This has the advantage that the names don't step on each other and the names can be both significant and the user can see the description as required.


Beginning

 

When any text that is not directed to a dialog box is typed from the keyboard, Creo continuously tries to match the characters to mapkeys. As soon as it sees any match it runs the related stored commands. This means that the user can't have keyboard access to both "X" and "XZ" because as soon as the "X" matches it executes the "X" commands and so "XZ" is never usable. Worse, typing "XZ" will run the "X" command, but leave the "Z", which may not match anything and Creo can't run a mapkey until the "Z" is removed with backspacing.

 

As mentioned above, they can be selected from the Mapkey dialog box and Run.

 

Handy config options

- new_parameter_ui no.yes

- cmdmgr_trail_output yes

- display_mapkeys_dialog_on_top yes (creo 3?)

 

Start with Olaf Corten's suggestion (from use of "main_dlg_cur" command for mapkeys -- from Wildfire5.0 to Creo1.0)

 

Use this config.pro option: cmdmgr_trail_output YES  (before starting recording)

 

Your ProE trail file then consists mostly of commands like these

    ~ Command `ProCmdModelOpen`

instead of

    ~ Activate `main_dlg_cur` `File.psh_open`

 

Further Olaf smarts (use of "main_dlg_cur" command for mapkeys -- from Wildfire5.0 to Creo1.0)

 

  1. Open the config.pro with a text editorset the config option cmdmgr_trail_output YES and save the config.pro
  2. (re)start ProE
  3. find all mapkeys with "main_dlg_cur" commands (e.g. ~ Activate `main_dlg_cur` `File.psh_open` )
  4. Update them manually: perform the same mapkey step(s) in ProE
  5. open your trail file with a text editor
  6. look at the latest added lines at the bottom (e.g. ~ Command `ProCmdModelOpen` )
  7. Replace the "main_dlg_cur" commands with the "~ Command" commands in the config.pro.
  8. And while you're at it: remove all ~Select - ~ Close combinations. They're not needed.
  9. Save the config.pro Or Re-Record them:

 

Open the Mapkey dialogue

Pre-Creo1: Tools-> Mapkeys-> [select mapkey]-> Modify-> Record

Creo1: File-> Options-> Environment-> Mapkeys Settings-> [select mapkey]-> Modify-> Record

 

Now perform the same mapkey step(s) in ProEStop the recording and save.

(Note when re-recording them you will get duplicate mapkeys in your config.pro. The last one will be the newest.)

 

This is a spreadsheet that is said to have a bunch of mapkeys in it fromMike Foster- I have not checked them recently enough to remember, but I must have looked at them at one time.

(use of "main_dlg_cur" command for mapkeys -- from Wildfire5.0 to Creo1.0)

 

From    Mapkey help

 

That should work. A couple of best practices I have learned while working with mapkeys:

1. Whenever possible avoid clicking icons or using context menus if you can use the menus along the top to achieve the same results. If these mapkeys are going to be used by more  people than yourself, not everyone will have the same icons but the menus along the top will remain the same. Also context menus change sometimes for prt vs asm vs drw.

2. Don't rely on the default options for dialog boxes. Pro/E remembers and saves the last picked options. So if when you record the mapkey the "Solid Models" drop down is selected by default the mapkey won't record that you specifically want that. So if the option changes in the future because you have run another find query and then you run the mapkey, your mapkey will fail.

3. If you can type in the name of the options you want into the drop down boxes. Sometimes you can sometimes you can't. If you don't type it in, Pro/E will often simply record the number from the top of the drop down you picked. The number of items in the drop down can change and then your mapkey will break.

4. When saving to file locations just type the full path in. IE: C:\temp\myfile.prt. Everyone can have different working directories and if you don't type the absolute path it might not work if you change your working directory.

5. If you edit the files by hand you can use the following characters:

!                        This comments out the line (ed. this only works between mapkeys; the command flow inside mapkeys won't work if interrupted)
%                      You can use this to call another mapkey. IE %aa;
\                        This has to be at the end of every line except for the last to indicate the mapkey continues
@SYSTEM         Use this followed by a path to call a script. IE @SYSTEMC:\\temp\\myscript.bat
\                         If you have a really long (>95 characters) file path you can break it up with the \ character without a ; IE:

mapkey(continued) @SYSTEMC:\\really\\long\\file\\path\mysc
mapkey(continued) ript.bat;

That's all I can think of for now.

Chris

 

 

Advanced Mapkeys

One feature that has been mentioned as handy is that bad commands in mapkeys are simply rejected. So one can build a mapkey that works on parts and fix into it parts that work on assemblies and the command interpreter will ignore the part that doesn't apply. SeeStrategies to implement multi mode mapkey functionality

 

A hint to making a more universal mapkey: Re: Mapkey difficulty with Creo UI across modes

from Jose Costa

In selecting the results from the Find tool, to select all of them, it may be useful to replace what looks like the list item with a universal reference:

 

Replace the line

mapkey(continued) ~ Select `selspecdlg0` `ResultList` 1 `7:52:`

with

mapkey(continued) ~ Select `selspecdlg0` `ResultList` -1; \


Mapkeys for selection filters

 

See Useful mapkey for changing the selection filter


Mapkey Cautions

 

Re: Mapkey best practices in Creo

 

When mapkeys from older versions are still functioning in later versions, it usually means that there was no change in this area.

However, in some rare cases they trigger a mechanism, that loads small parts of the old user interface, to enable the mapkey successfully processing.

These parts of the old UI will usually persist in a session and can alter the UI for this function even when the user is manually selecting menus.

 

Mapkey Editing

 

Mapkeys are actually run-on sentences of commands. They are individually line-length limited. The line-continuation character is "\" which will be present on every line except the last line. The missing "\" is how the mapkey processor knows it has reached the end. If, in editing a mapkey, a "\" is removed that should not be, upon importing the mapkey one will typically be rewarded by a long string of stop signs.

 

Mapkey import error handling is basic. It won't point out errors, it just fails to import completely or anything at all, depending on the type of error.

 

As a result it is best to create complex mapkeys a small amount at a time and understand how each part works before joining them.

 

The total length of a mapkey is 65,000+ characters.

 

Another feature, mentioned by Paul Sobejko, in Re: Copy parameter in Mapkey won't work after re-booting Creo, the "mapkey(continued)" portion is not required; the line continuation character is enough.

 

Mapkey lines can be divided after any ";' (semicolon) so that it makes reading/editing mapkeys a lot easier. Just add the "/" continuation character at the end of each line except the last line of each mapkey.

 

 

Pushing mapkeys to the command ribbon

 

sharing custom icons in the Creo 2.0 ribbon

 

Mapkey Writing/Editing Tips by Lucas Hoogeveen

 

Covers:

Quickly Update Mapkeys in the Current Creo Session (I recommend not storing mapkeys in the config.pro, but instead in separate .txt files)

Execute Multiple Mapkeys in one Mapkey

Getting Input from Users

Removing Duplicate Code from Mapkeys

OS Script or executing system CMD lines

Creating mapkeys from Trail Files

 

Mapkeys and VBA

 

A powerful use of mapkeys is in combination with VBA. I've had good luck with Excel VBA because it is easy to use Excel to manage large quantities of data, do some data manipulation, and create lists that are accessible to VBA for creating repetitious actions, such as opening all the drawings in a list of names and exporting them.

 

Mainly it is a matter of creating a file using VBA and then using PRINT #x, "abcdefghijklmnop" where"x" is the file handle from the OPEN command and "abcdefghijklmnop" is each line from the recorded mapkey. To make the mapkey adaptable it is necessary to replace the affected part with a variable.

 

One thing to watch for is that every line needs a "/" suffix, except the last, but in processing a list one may not know ahead of time when that will occur, particularly if using a FOR EACH loop. I create an initialization section that is missing the "/" from its last line and then the main loop adds the "/" and carriage return (newline/crlf) character at the top, so that when the loop ends, it ends without putting the "/" after the last line. This is useful when the segments of the mapkey have variable contents, such as the different handling that parts and assemblies can require. 


Viewing all articles
Browse latest Browse all 1247

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>