View Full Version : ERROR: unable to set system variable: SNAPUNIT
THE BRAT
9th Dec 2003, 04:12 pm
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?...
Flores
9th Dec 2003, 04:46 pm
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
THE BRAT
9th Dec 2003, 07:57 pm
....and so how do I get around it?
Flores
9th Dec 2003, 08:46 pm
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
;| 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:
^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
THE BRAT
9th Dec 2003, 09:18 pm
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?
Mr T
9th Dec 2003, 11:19 pm
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
Flores
9th Dec 2003, 11:35 pm
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
THE BRAT
10th Dec 2003, 02:04 pm
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
THE BRAT
10th Dec 2003, 03:33 pm
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!
Flores
10th Dec 2003, 05:25 pm
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
hendie
10th Dec 2003, 05:34 pm
and also, check out the "swamp" in my signature line
THE BRAT
10th Dec 2003, 06:09 pm
Thanks I'll check them out!
Arizona
11th Dec 2003, 06:44 pm
All you had to do is set your "snap" spacing to a positive number. This error happens when the snap unit is set to ZERO in both the x & y direction. The far left tab (snap & grid) of the drafting settings dialog box (what you enter when you attempt to change the osnap mode) is the place to change these settings.
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?...
Powered by vBulletin™ Version 4.1.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.