Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

Mapkey toggle button?

m-d-e

New member
How do I make a mapkey button show whether it's on or off? For example, when the spin center is showing the button stays pressed (turns white) in the toolbar. When you press it again it returns to its normal colour. I want that function for buttons controlling toggleable mapkeys like preselection highlighting, show/hide suppressed features etc. Is it possible? It would be very helpful.

/m-d-e


Edited by: m-d-e
 
Looks like this should be moved to the Wish List...
smiley19.gif
 
Record the mapkey twice, one for on and one for off. Open your config file in a text editor and compare the mapkeys. They will be identical except for one lone digit. The 'on' mapkey will have a '1' and the off mapkey will have a '0'. Delete that digit (the '1' or the '0') from one or the other and the mapkey becomes a toggle.


Here's one for WF3 Pre-selection highlighting:
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">


mapkey vph @MAPKEY_LABELPrehighlighting;\
mapkey(continued) ~ Select `main_dlg_cur` `MenuBar1`1 `Edit`;\
mapkey(continued) ~ Select `main_dlg_cur` `Edit.cbSelect`;~ Close `main_dlg_cur` `MenuBar1`;\
mapkey(continued) ~ Close `main_dlg_cur` `Edit.cbSelect`;\
mapkey(continued) ~ Activate `main_dlg_cur` `psh_sel_filter`;\
mapkey(continued) ~ Activate `selprefs` `PrehButton` ;~ Activate `selprefs` `Ok`;</BLOCKQUOTE>
 
If you read the original post, m-d-e wants the ICON image to toggle. I have no idea how to do this, I don't think you can copy the existing Pro/E icons.
 
I've seen a solution to this before that involves a bit of flim flam. In essence what you do is have two config.win files where one mapkey icon would replace the current one. This may require two differingmapkeys similar to what's noted above and they also would reverse. I will look and see if I can find the solution I've seen before.


Peter Woerner


Sr. Mechanical Engineer


Gleason Works
 
I have a weird toggle problem with one specific mapkey to toggle preselection highlight in the model tree (config option prehighlight_tree yes/no)

This is the mapkey to switch it on:
mapkey pt @MAPKEY_NAMEToggle preselection highlight in model tree;\
mapkey(continued) @MAPKEY_LABELToggle preselect highlight tree;\
mapkey(continued) ~ Command `ProCmdMdlTreePreHighlight` 1;\
mapkey(continued) ~ Close `main_dlg_cur` `PHTLeft.ShowCB`;

Replacing the 1 with a 0 will turn it off, but removing it will NOT make it a toggle?
This method does work for other commands.
What's wrong? Is it the mapkey or a bug?
smiley5.gif



Edited by: Zestje
 
The removing the 1/0 thing was sort of a hack, I'm not sure why it wouldn't work in this case. I'd experiment with removing the space before the 1 as well, but it just may not work here.

The mapkey seems truncated to me. What is the command sequence to get to the command? There's only the Command `ProCmdMdlTreePreHighlight`in your mapkey, usually there are a couple other commands to get you there. Did you record it by clicking a toolbar button or by clicking through the menus? If it was by button, try going the long way, through the menus and see if that helps.

Might not make a difference, but you never really know with this stuff.
 
I already tried with/wthout the space, but it didn't work.

The mapkey was recorded by clicking 'view' and then 'preselection highligt' (directly above the model tree). I didn't remove any lines and was also suprised it was that short...

Is there a way to toggle a yes/no config.pro setting with 1 mapkey? That would solve my problem in this case by changing the config.pro option on the fly...
 
Success!!

I mucked around with it myself in both WF3 and WF4 (the option doesn't exist in WF2) and couldn't get it to work, initially. Then I tried disabling the config option 'cmdmgr_trail_output yes', which is supposed to produce cleaner, simpler and more robust mapkeys. In WF4 it didn't make a difference, but in WF3 the mapkey got a lot longer and was formatted differently:

<div style="margin-left: 40px;">mapkey q1 ~ Select `main_dlg_cur` `PHTLeft.ShowCB`;\
mapkey(continued) ~ Close `main_dlg_cur` `PHTLeft.ShowCB`;\
mapkey(continued) ~ Activate `main_dlg_cur` `PreHighlightChkBtn`1;

mapkey q2 ~ Select `main_dlg_cur` `PHTLeft.ShowCB`;\
mapkey(continued) ~ Close `main_dlg_cur` `PHTLeft.ShowCB`;\
mapkey(continued) ~ Activate `main_dlg_cur` `PreHighlightChkBtn`0;

</div>Q1 turns it on, Q2 turns it off. I took the 1/0 off and got this:
<div style="margin-left: 40px;">
mapkey q3 ~ Select `main_dlg_cur` `PHTLeft.ShowCB`;\
mapkey(continued) ~ Close `main_dlg_cur` `PHTLeft.ShowCB`;\
mapkey(continued) ~ Activate `main_dlg_cur` `PreHighlightChkBtn`;
</div>
That worked great in WF3, so I copied and pasted it into my WF4 config.pro and it worked there too. If I add your key sequence and name and label, I get this:

<div style="margin-left: 40px;">mapkey pt @MAPKEY_NAMEToggle preselection highlight in model tree;\
mapkey(continued) @MAPKEY_LABELToggle preselect highlight tree;\
mapkey(continued) ~ Select `main_dlg_cur` `PHTLeft.ShowCB`;\

mapkey(continued) ~ Close `main_dlg_cur` `PHTLeft.ShowCB`;\

mapkey(continued) ~ Activate `main_dlg_cur` `PreHighlightChkBtn`;
</div>
I think that should work for you.
 
Thank you! It works now!
smiley32.gif


So, it's because of WF4's backward compatibility with the WF3 mapkey that this works, because it doesn't work with the WF4 mapkey. Weird 'feature'...

Again thank you for putting so much work into solving my problem!
smiley32.gif
 
Old mapkeys tend to work for a while, sometimes for a long while. They can suddenly quit working, and then you're hosed.

I like these kind of challenges and I hate kludgey work arounds, so I wasn't going to give up easily.
smiley36.gif
 

Sponsor

Articles From 3DCAD World

Back
Top