[Search tip detail and code files using keywords, tip number, author name, etc ]
 
An Easier Way to Change the Snap Value
Tip# 4362 By Sylvain Coupal On 15-Sep-2014
3
Rated By 1 users
Categories : Units, Other
Software type : AutoCAD 2015
Rename File To : No Files to download.
Here are some helpful little LISP routines for changing the snap value in AutoCAD.

I’ve seen a lot of comments about people using — or not using — the Snap function in AutoCAD. I use the Snap function most of the time and cannot work without it. I must admit that it's not very user-friendly to always open the snap settings to change the snap value. This is why I wrote two simple LISP lines to change the snap value, in a snap!

I prefer to have access to those LISP lines using two buttons within the menu. I include them in the Utilities panel in the AutoCAD ribbon. One of these buttons simply doubles the snap base, while the other divides it in half. So you can easily change the snap from 1/8" to 1/4" to 1/2", and so on, or reduce it the same way. You can also change the snap from 0.025 mm to 0.050 mm to 0.100 mm as well, depending on your snap unit value. And what is great is that you can call them transparently while editing.

I have used those routines for nearly 20 years now and copied them to every AutoCAD version I’ve had.

Here are the two LISP routines for the ribbon menu:

Name: Double Snap
Command Name: Double Snap Base
Description: Doubles snap base
Macro:

     'snap (*(cadr(getvar"snapunit"))2)

Name: Half Snap
Command Name: Half Snap Base
Description: Reduces snap base by half
Macro:

     'snap (/(cadr(getvar"snapunit"))2)

As an extra, I use a modemacro line to permanently display the snap value. I include it within the acaddoc.lsp file.

     (setvar "modemacro"
     (strcat "Snap: ""$(rtos,$(index,1,$(getvar,snapunit)))")
     )

I hope this will help people using the snap function more often!

Notes from Cadalyst tip reviewer R.K. McSwain: If you frequently use the Snap feature (not to be confused with Object Snap!), these macros can be very useful. Feel free to adjust the values to your specific needs. If you do not use the Snap feature, you may be able to use the same concept for a different feature that you do use often. Note the last bit of code sets the modemacro, a visual clue that Sylvain uses to keep track of the Snap value.

 

Average Rating:
3


User comments


Log In