3 things:
Copy and paste the lisp routine.
Put the location of the .lsp in the ACAD support path.
Copy and paste the tool button macro into a new user-defined button.
TogOsnap.lsp
Code:
;| TogOsnap.lsp
Enter tos at command line to toggle
Osnap on and off
Good example of toggling a variable
|;
(defun C:tos ()
(if (= (getvar "osmode") 0)
(progn
(setvar "osmode" 133)
(prompt "\nEnd, Cen, and Perp Osnaps on")
) ;progn
(progn
(setvar "osmode" 0)
(prompt "\nOsnaps off.")
) ;progn
) ;if
(princ)
) ;defun
(prompt "To use, enter tos at the command line.")
(princ)
;| Here are the bitcodes
just add up your favorites
Example: End + Cen + Perp is 1 + 4 + 128 = 133
Thus (setvar "osmode" 133)
0 NONe
1 ENDpoint
2 MIDpoint
4 CENter
8 NODe
16 QUAdrant
32 INTersection
64 INSertion
128 PERpendicular
256 TANgent
512 NEArest
1024 QUIck
2048 APParent Intersection
4096 EXTension
8192 PARallel
|;
Add location to support path:
Tools > Options > Files tab > Support Path Search Path (add > browse)
Toolbutton macro:
Code:
^C^C(if c:tos (princ)(load "togosnap")) tos
You will need to change the osmode variable to your preferred settings, then change the prompt to display your preferred osnaps. Example:
(prompt "\nEnd, Mid, and Quad Osnaps on")
Flores
Bookmarks