Consulting

Results 1 to 6 of 6

Thread: Solved: AutoCAD 2004 - Finding which object snaps are on/off

  1. #1
    Administrator
    2nd VP-Knowledge Base
    VBAX Master malik641's Avatar
    Joined
    Jul 2005
    Location
    Florida baby!
    Posts
    1,533
    Location

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

    Hey Guys,

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

    [VBA]
    Dim acPref As AcadPreferencesDrafting
    Set acPref = ThisDrawing.Application.Preferences.Drafting
    [/VBA]
    But this is only the options from Tools --> Options --> Drafting

    So how do I find the object snap settings?

    TIA




    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

  2. #2
    VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    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"))
    [vba]
    (defun c:rs ()
    (command "_osmode" "4223")
    (write-line "Osnaps have been reset")
    (princ))
    [/vba]
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    Administrator
    2nd VP-Knowledge Base VBAX Master malik641's Avatar
    Joined
    Jul 2005
    Location
    Florida baby!
    Posts
    1,533
    Location
    Steve,

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

    ...Still want to do this through VBA though

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




    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

  4. #4
    Administrator
    2nd VP-Knowledge Base VBAX Master malik641's Avatar
    Joined
    Jul 2005
    Location
    Florida baby!
    Posts
    1,533
    Location
    Aha!! Found it!

    [VBA]
    ThisDrawing.SetVariable "OSMODE", 4113
    [/VBA]
    To reset the object snaps to normal.



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




    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

  5. #5
    VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    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..
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  6. #6
    Administrator
    2nd VP-Knowledge Base VBAX Master malik641's Avatar
    Joined
    Jul 2005
    Location
    Florida baby!
    Posts
    1,533
    Location
    4223 huh? ...oops

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




    New to the forum? Check out our Introductions section to get to know some of the members here. Feel free to tell us a little about yourself as well.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •