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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Creo 2, Snap to Grid mapkey

jskraba
10-Marble

Creo 2, Snap to Grid mapkey

Dear All,


In Wildfire I had set-up mapkey to toggle Snap to Grid setting On or Off using single key. It looked as follows:



mapkey $F5 @MAPKEY_LABELEnable snap to grid setting;\
mapkey(continued) @MAPKEY_NAMEEnable snap to grid setting;~ Command `ProCmdEnvFull` ;\
mapkey(continued) ~ Activate `env_dlg` `grid_snap` 1 ;~ Activate `env_dlg` `OK_`;


When you hit F5 function key it either switched on Snap to grid or it turned it off. That way you could easily toggle this option in drawing or in sketcher.


Now, in Creo Snap to grid got other type of field code. When I tried to implement the old mapkey to perform the same function, I found out following:

- As this is UI setting, Creo always shows you pop-up for saving environment settings into UI file (unless you check "Do not show me this dialog again"). To implement mapkey to all of our users, this is rather annoying as I would have to assure that all the workstations have this setting checked.

- Snap to grid option cannot be toggled ON/OFF using single key, since it has either value of 0 or 1, thus mapkey works only one-way. That means, I should associate two function keys, one to toggle Snap to grid OFF and other to toggle it ON.

In Creo the code for both mapkeys looks like the following:


mapkey $F5 @MAPKEY_LABELGrid snap on;@MAPKEY_NAMEEnable snap to grid setting;\
mapkey(continued) ~ Command `ProCmdRibbonOptionsDlg`;\
mapkey(continued) ~ Select `ribbon_options_dialog` `PageSwitcherPageList` 1 `sketch_layouts`;\
mapkey(continued) ~ Activate `ribbon_options_dialog` `sketch_layouts.grid_snap.lay_instance` 1 \
mapkey(continued) ;~ Activate `ribbon_options_dialog` `OkPshBtn`;




mapkey $F6 @MAPKEY_LABELGrid snap off;\
mapkey(continued) @MAPKEY_NAMEDisable snap to grid setting;~ Command `ProCmdRibbonOptionsDlg`;\
mapkey(continued) ~ Select `ribbon_options_dialog` `PageSwitcherPageList` 1 `sketch_layouts`;\
mapkey(continued) ~ Activate `ribbon_options_dialog` `sketch_layouts.grid_snap.lay_instance` 0 \
mapkey(continued) ;~ Activate `ribbon_options_dialog` `OkPshBtn`;


Do you guys have any solution for how to achieve the same functionality as it was implemented in Wildfire without having to mess with suppressing dialog boxes on all of the workstations? Or, do you have any better code for that kind of mapkey?

Thanks in advance.


Jurij Škraba
Research & Developement Department for
Hydromechanical Equipment

LitostrojPower | Production of Power
Generation and Industrial Equipment | http://www.litostrojpower.eu

This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
3 REPLIES 3


Create an individual file for each operation.


Each file will define the same F5, but different operations.


At the end of each mapkey have it load the other file. It will toggle the mapkey definition from one to the other.

dgschaefer
21-Topaz II
(To:jskraba)

You should be able to remove the 1 or 0 from either mapkey and it'll turn into a toggle. Simply delete that single character.

--
--
Doug Schaefer | Experienced Mechanical Design Engineer
LinkedIn
davehaigh
12-Amethyst
(To:jskraba)

In your standard config file have this mapkey:
mapkey $F5 @MAPKEY_LABELGrid snap toggle;@MAPKEY_NAMEToggle snap to grid setting;\
~ Command `ProCmdRibbonOptionsDlg` ;\
~ Select `ribbon_options_dialog` `PageSwitcherPageList` 1 `ConfigLayout`;\
~ Activate `ribbon_options_dialog` `ConfigLayout.Open`;\
~ Update `file_open` `Inputname` `P:\\mapkey_configs\\grid_yes.pro`;\
~ Command `ProFileSelPushOpen@context_dlg_open_cmd` ;\
~ Activate `ribbon_options_dialog` `OkPshBtn`;\
~ FocusIn `UITools Msg Dialog Future` `no`;\
~ Activate `UITools Msg Dialog Future` `no`;

Make two extra config files. Each one contains the grid setting config option, and a mapkey.
These should be on your server somewhere.

The "yes" config, turns the grid snap on, and changes the mapkey to load the "off" setting file
The "no" config, turns the grid snap off, and changes the mapkey to load the "on" setting file

The keyname is the same for each mapkey, you are just changing what it does every time you run it. Thus your toggle function.

grid_yes.pro
==========
grid_snap yes
mapkey $F5 @MAPKEY_LABELGrid snap toggle;@MAPKEY_NAMEToggle snap to grid setting;\
~ Command `ProCmdRibbonOptionsDlg` ;\
~ Select `ribbon_options_dialog` `PageSwitcherPageList` 1 `ConfigLayout`;\
~ Activate `ribbon_options_dialog` `ConfigLayout.Open`;\
~ Update `file_open` `Inputname` `P:\\mapkey_configs\\grid_no.pro`;\
~ Command `ProFileSelPushOpen@context_dlg_open_cmd` ;\
~ Activate `ribbon_options_dialog` `OkPshBtn`;\
~ FocusIn `UITools Msg Dialog Future` `no`;\
~ Activate `UITools Msg Dialog Future` `no`;

grid_no.pro
==========
grid_snap no
mapkey $F5 @MAPKEY_LABELGrid snap toggle;@MAPKEY_NAMEToggle snap to grid setting;\
~ Command `ProCmdRibbonOptionsDlg` ;\
~ Select `ribbon_options_dialog` `PageSwitcherPageList` 1 `ConfigLayout`;\
~ Activate `ribbon_options_dialog` `ConfigLayout.Open`;\
~ Update `file_open` `Inputname` `P:\\mapkey_configs\\grid_yes.pro`;\
~ Command `ProFileSelPushOpen@context_dlg_open_cmd` ;\
~ Activate `ribbon_options_dialog` `OkPshBtn`;\
~ FocusIn `UITools Msg Dialog Future` `no`;\
~ Activate `UITools Msg Dialog Future` `no`;


David Haigh
Announcements
NEW Creo+ Topics: PTC Control Center and Creo+ Portal


Top Tags