Quick OSNAPZ Alias command

Quick OSNAPZ Alias command

Anonymous
Not applicable
1,416 Views
3 Replies
Message 1 of 4

Quick OSNAPZ Alias command

Anonymous
Not applicable

Hi,

 

I need a quick guide on how to make an IF-function for my OSNAPZ command, though I'm not that used to writing scripts for AutoCAD

I'm switching between OSNAPZ=0 and OSNAPZ=1 so often that I'd like it so that I only use one quick command instead of the double command each time. Basically I want this function:

 

 

defun c:o

   if OSNAPZ=1

      OSNAPZ=0

   else

      OSNAPZ=1

 

So I can basically switch between OSNAPZ=1 and OSNAPZ=0 with just a simple "O"+Enter command.

0 Likes
Accepted solutions (1)
1,417 Views
3 Replies
Replies (3)
Message 2 of 4

ВeekeeCZ
Consultant
Consultant
Accepted solution
(defun c:O () (princ "> OSNAPZ changed to ") (setvar 'OSNAPZ (- 1 (getvar 'OSNAPZ))))

If you ever want to use that transparently, you need to type 'O. Or assign a shortcut (eg. Ctrl+O) to it.

Message 3 of 4

Anonymous
Not applicable

Thanks!

Works perfectly!

0 Likes
Message 4 of 4

scot-65
Advisor
Advisor
You may also try the following:
(setvar "MODEMACRO" "OSNAPZ= $(getvar,OSNAPZ)")

Place inside S::STARTUP (acaddoc.lsp)

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.