Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Custom Keyboard shortcut to toggle snap AND Osnap

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
PaulTelco
4980 Views, 3 Replies

Custom Keyboard shortcut to toggle snap AND Osnap

Well I'm embarrassed to have to ask this after using autocad for at least 15 years but I still really have trouble getting CUI  to do what I want.

 

Could a kind person help me to set up a keyboard shortcut that toggles both snap and osnap at the same time?

 

I receive a lot of drawings in the office that are poorly aligned to grid and spend ages sorting out snap problems before I can get on with the work itself.

 

So I spend hours with my left hand stretched between F3 and F9 to alternately toggle them. And I'm getting RSI!

 

The combination I need is 'snap on' 'osnap off' and vice versa. Maybe F5 would be good as I don't use Isoplane.

 

(Yes I know I could move the functions so they are closer on the keyboard but this seems the wrong answer.)

 

Many thanks in advance for your help.

 

Paul

3 REPLIES 3
Message 2 of 4
pendean
in reply to: PaulTelco

Left or right-handed typist? Do you only use a 2-3 button mouse too?

F-keys are just all wrongly placed on a stock keybaord, you need to think out of the box:
1: click on the icon at the bottom of the AUtoCAD program screen.
2. get a mouse with more than 2-butons and really POWER UP your abilities.
3. Set up a shortcut key combo like CTRL+LETTER for both (in CUI command).
4. Reprogram F-key: read this oldie but goodie, second post http://forums.autodesk.com/t5/autocad-2004-2005-2006/cui-osnap-on-function-keys/m-p/1477497
Message 3 of 4
Kent1Cooper
in reply to: PaulTelco

On the Osnap modes issue, see this thread.  Toggling Snap on/off is easier, since it's just a 1 or 0 choice -- subtract the current value from 1 to get the other value.  Wherever you put it [command name, Ctrl+something key combination, remapped F key, toolbar, whatever], this code should do it:

 

(setvar 'osmode (boole 6 (getvar 'osmode) 16384))

(setvar 'snapmode (- 1 (getvar 'snapmode)))

 

But note that the above will toggle each of them independently of the state of the other, so if you do it when Osnap is on and Snap is off, it will change to Osnap off and Snap on [or vice versa].  If you want both on or both off, even if you're starting with one of each, that's a different problem.  You would probably need one that turns both off, one that turns both on, and the above to toggle both once you get them synced with each other.  Or just use the usual methods to change one of them to be in agreement with the other, then use the above to toggle.

Kent Cooper, AIA
Message 4 of 4
PaulTelco
in reply to: Kent1Cooper

Hi Kent,

 

I pasted your lines of code into the 'macro' line for a shortcut and remapped it to F5. It works nicely. I do take your point about toggling from the initial state of the keys though. I can live with that. Actually it may be more useful that way as I can use it for other things.

 

What I have  ended up with is a re-purposing of the 'UCS3Point' option. Because that was the command I clicked before I customised it to the new function. So this is a bit untidy having the bottom line saying 'Element ID ID_Ucs3point'.

 

How would I create the same thing from scratch without choosing an existing command and editing it? Or alternatively how could I change the Element ID which is permanently greyed out here?

 

A bit off topic now but many thanks indeed for your help.

 

Paul

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost