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 the Community Ranking System, a fun gamification element of the PTC Community. X

Translate the entire conversation x

How to create a mapkey that toggles a custom layer

pmuewi
5-Regular Member

How to create a mapkey that toggles a custom layer

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

ACCEPTED SOLUTION

Accepted Solutions
tbraxton
22-Sapphire I
(To:pmuewi)

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`;

 

 

========================================
Involute Development, LLC
Consulting Engineers
Specialists in Creo Parametric

View solution in original post

2 REPLIES 2
tbraxton
22-Sapphire I
(To:pmuewi)

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`;

 

 

========================================
Involute Development, LLC
Consulting Engineers
Specialists in Creo Parametric

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 

Announcements

Top Tags