Skip to main content
5-Regular Member
September 22, 2025
Solved

How to create a mapkey that toggles a custom layer

  • September 22, 2025
  • 2 replies
  • 452 views

I've found instructions to toggle a custom layer that include writing two .pro configs, then referencing those in the mapkey, but those instructions are from around 2012, and I'm wondering if there is a more straightforward way to toggle a custom layer with a single mapkey.

 

I've currently got a mapkey that hides a custom layer, "CURVES", with the following code:

 

mapkey z ~ Select `main_dlg_cur` `PHTLeft.PHLayerUI.AssyTree` 1 \
mapkey(continued) `node0:CURVES`;\
mapkey(continued) ~ RButtonArm `main_dlg_cur` `PHTLeft.PHLayerUI.AssyTree` `node0:CURVES`;\
mapkey(continued) ~ Command `ProCmdViewHide` ;\
mapkey(continued) ~ PopupOver `main_dlg_cur` `LayerActionMenu` 1 `PHTLeft.PHLayerUI.AssyTree`;

 

Is it possible to modify this to allow for toggling?

 

Currently using Creo 11.0.4.0

Best answer by tbraxton

Short answer is no. In order to "toggle" using mapkeys you will need to create two versions of the mapkey and call them on the fly within Creo using config.pro files or mapkey.pro files if in Creo 11+.

Refer to the video demonstration and sample code posted in this previous thread which will explain what needs to be done to get a pseudo toggle to work. It is not a true logical toggle as the current state is never known but in practice this will not matter.

 

Solved: Mapkey Toggle Grid (HIDE Grid / SHOW Grid) - PTC Community

 

You will need two versions of the mapkey saved with the same mnemonic to two files to be read in on the fly. One version will show your layer, and the other version will hide your layer. Each of these mapkeys must include code that redefines what the mapkey does (show/hide). Below are the mapkeys used to enable the glow function shown in the video. The toggle action is completed by changing the setting of config option "enable_selection_glow".

 

!**** Toggle function for selection glow
enable_selection_glow	no

!**** mapping mapkey to turn on glow
mapkey $F4 @MAPKEY_LABELGlow Toggle;%.ifcp;\
mapkey(continued) ~ Input `file_open` `Inputname` `D:\\ProE Standards\\Config Calls\\on_glow.pro`;\
mapkey(continued) ~ Command `ProFileSelPushOpen_Standard@context_dlg_open_cmd` ;\
mapkey(continued) ~ Activate `ribbon_options_dialog` `OkPshBtn`;
!**** Toggle function for selection glow
enable_selection_glow	yes

!**** mapping mapkey to turn off glow
mapkey $F4 @MAPKEY_LABELGlow Toggle;%.ifcp;\
mapkey(continued) ~ Input `file_open` `Inputname` `D:\\ProE Standards\\Config Calls\\no_glow.pro`;\
mapkey(continued) ~ Command `ProFileSelPushOpen_Standard@context_dlg_open_cmd` ;\
mapkey(continued) ~ Activate `ribbon_options_dialog` `OkPshBtn`;

 

 

2 replies

tbraxton
22-Sapphire II
tbraxton22-Sapphire IIAnswer
22-Sapphire II
September 22, 2025

Short answer is no. In order to "toggle" using mapkeys you will need to create two versions of the mapkey and call them on the fly within Creo using config.pro files or mapkey.pro files if in Creo 11+.

Refer to the video demonstration and sample code posted in this previous thread which will explain what needs to be done to get a pseudo toggle to work. It is not a true logical toggle as the current state is never known but in practice this will not matter.

 

Solved: Mapkey Toggle Grid (HIDE Grid / SHOW Grid) - PTC Community

 

You will need two versions of the mapkey saved with the same mnemonic to two files to be read in on the fly. One version will show your layer, and the other version will hide your layer. Each of these mapkeys must include code that redefines what the mapkey does (show/hide). Below are the mapkeys used to enable the glow function shown in the video. The toggle action is completed by changing the setting of config option "enable_selection_glow".

 

!**** Toggle function for selection glow
enable_selection_glow	no

!**** mapping mapkey to turn on glow
mapkey $F4 @MAPKEY_LABELGlow Toggle;%.ifcp;\
mapkey(continued) ~ Input `file_open` `Inputname` `D:\\ProE Standards\\Config Calls\\on_glow.pro`;\
mapkey(continued) ~ Command `ProFileSelPushOpen_Standard@context_dlg_open_cmd` ;\
mapkey(continued) ~ Activate `ribbon_options_dialog` `OkPshBtn`;
!**** Toggle function for selection glow
enable_selection_glow	yes

!**** mapping mapkey to turn off glow
mapkey $F4 @MAPKEY_LABELGlow Toggle;%.ifcp;\
mapkey(continued) ~ Input `file_open` `Inputname` `D:\\ProE Standards\\Config Calls\\no_glow.pro`;\
mapkey(continued) ~ Command `ProFileSelPushOpen_Standard@context_dlg_open_cmd` ;\
mapkey(continued) ~ Activate `ribbon_options_dialog` `OkPshBtn`;

 

 

Community Manager
October 1, 2025

Hi @pmuewi,

 

I wanted to see if you got the help you needed.

If so, please mark the appropriate reply as the Accepted Solution. It will help other members who may have the same question.
Of course, if you have more to share on your issue, please pursue the conversation. 

 

Thanks,
Anurag