+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 16
  1. #1
    THE BRAT
    Guest

    Default ERROR: unable to set system variable: SNAPUNIT

    Registered forum members do not see this ad.

    This is a message I get once in awhile when I try to change my osnap settings on a dwg that is sent to me by designers. AutoCAD won't let me change the settings and then I have to right button click for endpoint, midpoint,quadrant,..etc. I can copy the dwg. to another dwg and the problem is solved...but what a pain having to unlock and relock all the layers in the dwg. Is this some sort of lock on the designers dwg that I can change, or maybe its created in an earlier version of AutoCAD? Its not life threatening and I can work around it but I feel its a waste of time!....any takers?...

  2. #2
    Flores
    Guest

    Default

    Actually you are talking about 2 different variables. SNAPUNIT sets the snap spacing for the current viewport while OSMODE sets running Object Snap modes using the following bitcodes.

    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

    Flores

  3. #3
    THE BRAT
    Guest

    Default

    ....and so how do I get around it?

  4. #4
    Flores
    Guest

    Default

    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

  5. #5
    THE BRAT
    Guest

    Default

    WOW!!...I did'nt expect such a complicated answer! I'm not really big on the lisp side of AutoCAD...YET! Is this a permanent solution to this problem or do I load this whenever I come across this problem? And does the button macro always stay in a toolbar?.....have I misunderstood this? I often toggle through many of the osnaps depending on what I'm doing. Will this make certain osnaps stay on?..or off?

  6. #6
    Super Member Mr T's Avatar
    Using
    AutoCAD 2007
    Join Date
    Nov 2002
    Location
    Loch Oich SCOTLAND...
    Posts
    1,641

    Default

    Quote Originally Posted by THE BRAT
    WOW!!...I did'nt expect such a complicated answer! I'm not really big on the lisp side of AutoCAD...YET! Is this a permanent solution to this problem or do I load this whenever I come across this problem? And does the button macro always stay in a toolbar?.....have I misunderstood this? I often toggle through many of the osnaps depending on what I'm doing. Will this make certain osnaps stay on?..or off?
    Investigate the settings within the command OPTIONS called profiles.

    Nick
    http://www.flickr.com/photos/80049703@N00/ http://mtbnick.fotopic.net/
    http://s240.photobucket.com/albums/ff241/dyNick_Scots/
    http://designgraphicsshowcase.blogspot.com/

    High School Classroom - 21 AutoCAD 2007, Inventor 11, COREL Draw & Paint 11. Very Unreliable Network.

    Home - AMD 2.1GHZ - 512Ram, 64 Video,
    Laptop Inventor 7, Autocad 2004, Corel 11

  7. #7
    Flores
    Guest

    Default

    Maybe an easier answer would be "You don't have to unlock and relock all the layers in the dwg to change the osnaps, just CTRL + LEFT CLICK to reset your preferred osnaps".

    Flores

  8. #8
    THE BRAT
    Guest

    Default

    I don't have a problem accessing or turning osnap on or off when there's no error message I've got that part down, and I only unlock the layers when I have to copy the dwg into another dwg. I'll also follow up on what Mr T suggested...I'm not discounting what you have advised Flores, I'm just not that advanced yet....but I will try the lisp today

  9. #9
    THE BRAT
    Guest

    Default

    okay, i've entered the lisp and it works great! i've also copied and changed some of the values in it and set up a few different lisp routines that will come in handy for different aspects of my work. Thanks to all who offered help, and do you know any good books about explaining and learning lisp programming.....i'm hooked!

  10. #10
    Flores
    Guest

    Default

    Registered forum members do not see this ad.

    Glad you gave it a try... LISP isn't as scary as it looks. I have a grasp of AutoLISP, but Visual LISP throws me in for a loop, but I hope to learn it soon. Before you go out and buy some books, there are several places on the internet that can help you out. Also, there are several good sites to download lisp routines.

    Tutorials:
    http://www.afralisp.com/tutor.htm
    http://home.netcom.com/~rogh/autolisp/
    http://www.geocities.com/cadgurucool/tutorial.htm

    LISP Downloads
    http://www.cadalog.com/swsubcat.php?value=ACG
    http://www.caddepot.com/dcd/Autodesk/

    There are tons of free info and routines on the net that you ought to take advantage of.

    Flores

Bookmarks

Posting Permissions

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