I am using a lisp routine to toggle some system variables that I change fairly often. My lisp works just fine...for me. However, my general users are interested in seeing an acknowledgment of the switch printed to the command line after the command has been executed. Here is the code I am using:
(defun c:rnm ()
(if (= (getvar "osmode") 1791)
(setvar "osmode" 1088) ;Sets object snap mode to insertion point only
(setvar "osmode" 1791) ;Sets object snap mode to "normal" osmode
)
(princ)
)
Basically, I would like to use (princ "\nOsmode Insertion point set.") or whatever when my little routine runs. So when it sees 1791 is active it changes it to 1088, then prints a confirmation to the command line, and vice versa.
I have a feeling this is simple, but for some reason the solution elludes me.
Thanks for your help!
Solved! Go to Solution.
Solved by Randy_Culp. Go to Solution.
Solved by Randy_Culp. Go to Solution.
Try this:
(defun c:rnm ()
(if (= (getvar "osmode") 1791)
;;;;;;;;;
(progn
(setvar "osmode" 1088) ;Sets object snap mode to insertion point only
(princ "\nOSNAP set to Insertion Point")
) ;; end progn
;;;;;;;;;
(progn
(setvar "osmode" 1791) ;Sets object snap mode to "normal" osmode
(princ "\nOSNAP set to NORMAL")
) ;; end progn
;;;;;;;;;
) ;; end if
(princ)
)
Hi Randy,
Thanks for the code, it does exactly what I was looking to do!
Would you happen to know what to use if I wanted to add a third variable?
Thanks!
Instead if using IF use COND. Look it up in developer help. The guys over in the customization forum will be glad to get specific.
or
If you really want to get into lisp and custom programming check out:
Thanks, you are right, I should continue this over in customization (if I need to that is).
I have been on the swamp since your last reply, and it is a fantastic resource! Thanks for your help.