Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SNAP MODE SETTINGS

2 REPLIES 2
Reply
Message 1 of 3
wbrustle
1064 Views, 2 Replies

SNAP MODE SETTINGS

I was wondering if there is a setting somewhere that could hold my snapmode settings after I use a lisp routine. I found a lisp routine to rotate text and have noticed that everytime I use that lisp command I lose my osnap settings....any help would be appreciated.

2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: wbrustle

at beginning of routine

(setq osm (getvar "osmode")
      echo (getvar "cmdecho")
      snp (rtos (car (getvar 'snapunit)))
      snpm (getvar 'SNAPMODE))
(setvar "cmdecho" 0)

 

 

 

at end of routine

(command "snap" snp)
(setvar "snapmode" snpm)
(setvar "osmode" osm) 
(setvar "cmdecho" echo)

 

 

you can add this to help as well near the top of your routine after the first defun line

 

 (defun *error* ( msg )      

(if osm (setvar 'OSMODE osm))      

(if snpm (setvar 'SNAPMODE snpm))     

  (if snp (command "snap" snp))      

(if echo (setvar 'CMDECHO echo))

    (if (not (member msg '("Function cancelled" "quit / exit abort")))        

(princ (strcat "\nError: " msg))    

)   

  (princ)   

)

Message 3 of 3
Anonymous
in reply to: Anonymous

You can place those snippets into the routine that is causing your snaps to go away and it should fix that issue for you, as it records snap (and a few other commonly used system variables) and places them into a variable then after the rotate lisp program portions run it'll reset whatever it changed back to the values recorded at the beginning .

The error handler does the same thing but in case of a user pressing the escape button midroutine

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

Post to forums  

Forma Design Contest


Autodesk Design & Make Report