cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Where to Obtain Mapkey Value for Mapkey Created in Creo?

HanSolo97
10-Marble

Where to Obtain Mapkey Value for Mapkey Created in Creo?

I have created a mapkey in creo and need to call in using VB API
The ipfcsession.RunMacro() requires "MapKey Value minus shortcut and name" to be passed as argument.

Where to obtain this mapkey value for a mapkey i created in creo?

The documentation says Tools->Options but this is very less detail..i cant find any in options dialog box 

HanSolo97_0-1600419557125.png

 

ACCEPTED SOLUTION

Accepted Solutions

Save the mapkey(s) to the config.pro file (or an external file) ... then you can open it to get the value in any text editor.

View solution in original post

2 REPLIES 2

Save the mapkey(s) to the config.pro file (or an external file) ... then you can open it to get the value in any text editor.

You can run an existing mapkey by name using the VBA toolkit. 

 

' Example exisitng mapkey name in Creo:  gen_map 

Dim macro_text As String
macro_text = "%gen_map"
session.RunMacro (macro_text)

 

I'm not sure why this isn't clearly stated in the documentation.  It is much more direct and doesn't require any translation of text from the config file into your VB code.  Took me a few more hours than I would've liked to figure that out.  Hopefully this helps someone.  See below.  This works for me using Creo 10 and Excel VBA  with Creo VB API Type Library for 10.0.0.0  library reference:

The syntax to use an existing named mapkey looks to be the same as used to call an existing mapkey from within a mapkey when creating / editting mapkeys in the config file text.  

 

runmacro("%<mapkey_text_name>") 

 

Per the API doc, you would run something like this.  I'm still not sure on the allowable length of the string to feed to runmacro.

 

runmacro("~ Close `main_dlg_cur` `appl_casc`;~ Command `ProCmdRibbonOptionsDlg` ; \ Select `ribbon_options_dialog` `PageSwitcherPageList` 1 `env_layouts`;\Activate `ribbon_options_dialog` `env_layouts.Env_MapkeySet_Btn`;")

 

! ***** mapkey from config file

! ******** Or save in it's own config from the mapkey editor

!

mapkey gen_map @MAPKEY_LABELOpen Mapkey Dialog;\
mapkey(continued) ~ Close `main_dlg_cur` `appl_casc`;~ Command `ProCmdRibbonOptionsDlg` ;\
mapkey(continued) ~ Select `ribbon_options_dialog` `PageSwitcherPageList` 1 `env_layouts`;\
mapkey(continued) ~ Activate `ribbon_options_dialog` `env_layouts.Env_MapkeySet_Btn`;

.

 

 

 

Announcements
NEW Creo+ Topics: Real-time Collaboration


Top Tags