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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

How do I create a single mapkey to toggle an option on and off in Creo2?

ptc-2053410
1-Newbie

How do I create a single mapkey to toggle an option on and off in Creo2?

Many of my existing mapkeys automatically seem to do what I want , like my plane mapkey toggles on and off with the same map key...

What is the process to create a new mapkey that toggles an option on or off in Creo2 (many of my existing ones have broken and I want to add some more to enable me to spend less time in the ribbon). I don't want to have to create two mapkeys,one for "on", one for "off". I am guessing I need to manually alter something within the mapkey string of the configuration editor? If so, does anyone have an example they care to share?

11 REPLIES 11

I tried to create a mapkey for hiding planes and it automatically toggles the status like you want to do. This works for point, axis and ucs too.

For other things, like layers status on/off I used another method:

1. I created two mapkeys: "On" and "Off".

2. I saved the first mapkey ("On") on the Config.pro, and this mapkey end´s loading a mapkey with the same name but doing the opposite("OFF").

Another option that works sometimes is editing the mapkey code and search for "0" and "1" status, example:


...`ModDsply_ChkB_ShadedEdges`1;\

if you delete "1" like this:

...`ModDsply_ChkB_ShadedEdges`;\


Creo will toglle the display.

You can find more info in Proesite.com.

Yeah, I do that work around by creating two keys aswell but there must be a toggle option or an easier way.

I think the example from Proesite.com is quite explanatory:

Toggling Mapkeys

You can create toggle mapkeys by letting the mapkey read in a small config.pro file in which the mapkey itself is redefined:

Suppose you want the F6 button to toggle the explode, then you only need to create the two following config.pro files:

put this in explode.pro:

mapkey $F6 ~ Activate `main_dlg_cur` `View.psh_view_explode`;\

~ Activate `main_dlg_cur` `psh_util_load_config`;\

~ Activate `file_open` `Inputname` \

`[full path]/unexplode.pro`

put this in unexplode.pro:

mapkey $F6 ~ Activate `main_dlg_cur` `View.psh_view_unexplode`;\

~ Activate `main_dlg_cur` `psh_util_load_config`;\

~ Activate `file_open` `Inputname` \

`[full path]/explode.pro`

In your startup config.pro add the first mapkey as well, assuming you want to explode your assy's the first time you run F6.

One drawback, If you manually explode or unexplode between running F6 it will not work the next time you run F6, you will have to press F6 again.

mheath
5-Regular Member
(To:Jose_Costa)

As much as I've tried this procedure it does not work in Creo 2.0. I followed this just as stated and it just won't work. Any other suggestions on how we can toggle displays on and off.

dgschaefer
21-Topaz II
(To:mheath)

What are you trying to toggle? The first reply by Jose above has almost always worked for me, but I'm not sure I've created one in Creo2 yet. Let me know what you want toggled and I'll see what I can do.

--
Doug Schaefer | Experienced Mechanical Design Engineer
LinkedIn
mheath
5-Regular Member
(To:dgschaefer)

I had a user request a mapkey that will turn off/on all datums by typing a certain keyboard commands, for instance "nn". The issue I have is if some of the datums are on and others are off it will switch the visibility of the datums, but won't turn them all off or all on.

dgschaefer
21-Topaz II
(To:mheath)

I don't see how a toggle mapkey can solve that, there's no way to know if some are on and some are off what the user wants. Frankly, there's no way to know the state of the datums period.

I would assume that you would need 3 mapkeys:

  • Set all on
  • Set all off
  • Toggle all

The user could first select all on or all off and then use the toggle.

--
Doug Schaefer | Experienced Mechanical Design Engineer
LinkedIn
mheath
5-Regular Member
(To:dgschaefer)

I was hoping to find a way to turn them all off or on and then run the mapkey to toggle the display with just the one keyboard command.

dgschaefer
21-Topaz II
(To:mheath)

OK, I was able to create a mapkey to toggle the planes, axis, points and CS, but I don't think it's going to be what you want. I used the method posted by Jose in the first reply above of removing the 1 or 0.

First, it's a pretty simple thing to do in the UI. In the floating toolbar there's a toggle all command:

Untitled.jpg

That's what I used to make my mapkey. It's two clicks to get to it, a mapkey isn't helping much.

The second problem is that the mapkey is recorded differently depending on the context - part, assy, sheet metal, etc. So a single mapkey won't work for all modes.

Here are the mapkeys I created for part, assy and sheet metal. As you can see there's some gibberish code in there that changes per mode. I'm sure that other modes (piping, drawing, etc) will create different code. Using the "select all" button is likely easier.

If there is a mixed display state, the first run of the mapkey turns everything on, then everything toggles after that.

mapkey part ~ Activate `main_dlg_cur` \

mapkey(continued) `igToolbar_AncestorIGT_IGT_GRP_inh396938342.proe_win|.mcs29658718_mp|select_\

mapkey(continued) all_check`;

mapkey assy ~ Activate `main_dlg_cur` \

mapkey(continued) `igToolbar_AncestorIGT_IGT_GRP_inh397369119.proe_win|.mcs29658718_mp|select_\

mapkey(continued) all_check`;

mapkey sheetmetal ~ Activate `main_dlg_cur` \

mapkey(continued) `igToolbar_AncestorIGT_IGT_GRP_inh407984315.proe_win|.mcs29658718_mp|select_\

mapkey(continued) all_check`;

Good luck.

--
Doug Schaefer | Experienced Mechanical Design Engineer
LinkedIn

Doug has already solved your problem but I want to add one more tip:

You can join the mapkeys in only one. Since you are calling commands that don´t exist in the active context of Creo they will ignored.

So joining the three mapkeys that Doug created you will have:

mapkey nn ~ Activate `main_dlg_cur` \

`igToolbar_AncestorIGT_IGT_GRP_inh396938342.proe_win|.mcs29658718_mp|select_\

all_check`;\

~ Activate `main_dlg_cur` \

`igToolbar_AncestorIGT_IGT_GRP_inh397369119.proe_win|.mcs29658718_mp|select_\

all_check`;\

~ Activate `main_dlg_cur` \

`igToolbar_AncestorIGT_IGT_GRP_inh407984315.proe_win|.mcs29658718_mp|select_\

all_check`;

In this particular case, you have to enable the "Datum display filters" in the "fly" bar (I don´t know the name of that bar) and save the customization or the mapkey may not work.

sheesh, why does PTC make things so complicated! i know something sound easy but programatically it's not, but this seems elementary.

Announcements
Business Continuity with Creo: Learn more about it here.

Top Tags