PDA

View Full Version : Solved: AutoCAD 2004 - Finding which object snaps are on/off



malik641
06-26-2006, 08:10 AM
Hey Guys,

How do I find ...I guess... a collection of the object snap settings? I thought it was:


Dim acPref As AcadPreferencesDrafting
Set acPref = ThisDrawing.Application.Preferences.Drafting

But this is only the options from Tools --> Options --> Drafting

So how do I find the object snap settings?

TIA

lucas
06-26-2006, 08:26 AM
I use lisp to reset snaps Joseph....

Here's a nice little lisp code if you have ever had the issues of having your osnaps reset when you escape out of a lisp routine that doesn't have an error trapping routine. The only tweak that you have to make is where it says "NUM" in the lisp code. This should be a number based on your osnap mode. To find this number for you should set your osnaps the way that you would normally have them and then type in "OSMODE" at the command prompt.

(defun c:rs ()
(command "_osmode" "NUM"))


The number in the "<>" is the number that you need to insert where "NUM" is in the lisp code. For example, if the number is "<183>" then you would see this...Code:
(defun c:rs ()
(command "_osmode" "183"))

(defun c:rs ()
(command "_osmode" "4223")
(write-line "Osnaps have been reset")
(princ))

malik641
06-26-2006, 10:59 AM
Steve,

I just read the help file and now I understand the LISP code much better.

...Still want to do this through VBA though :think:

And after reading that help file, I have another idea for a KB :thumb

malik641
06-26-2006, 11:08 AM
Aha!! Found it!


ThisDrawing.SetVariable "OSMODE", 4113

To reset the object snaps to normal.

:thumb :thumb :thumb

Later tonight I'll work on another KB entry!!

lucas
06-26-2006, 11:32 AM
should be 4223 to reset to normal.....
I didn't have a direct answer in vba or the time at the moment but thought the osnap mode would give you the lead you needed..

malik641
06-26-2006, 12:05 PM
4223 huh? ...oops

Anyway yes, osmode definitely gave me the right lead :) Appreciate that, Steve.