[Search tip detail and code files using keywords, tip number, author name, etc ]
Toggle Snap Settings in Hatch Patterns
Tip# 3481 By Shawn Evjen On 29-Aug-2010
Rated By 1 users
Categories : Drawing Properties
Software type : AutoCAD 2011
Rename File To : No Files to download.
Change the OSOptions command to ignore linework in hatches, negative Z values, or both.

Do you need to snap to linework in a hatch? Shawn Evjen shares a tip for controlling your snap settings in hatches.

"We were working on some older drawings, and needed to snap to lines in a hatch pattern. In our case, this linework was a reflected ceiling grid, and we needed to place the light fixtures appropriately. Where to turn? The OSOptions command allows you to ignore linework in hatches, ignore negative Z values (also handy), or to snap to anything in a hatch exactly where it is. The command works by adding the values: 1 ignores snapping to linework; 2 ignores negative Z coordinates; and the default, being 3, ignores both. For our project, we changed it to 2, and off we went. If you would rather not snap to hatch linework in concrete and sand patterns, just remember to change it back!"

Notes from Cadalyst Tip Patrol: The OSOptions system variable automatically suppresses object snaps on hatch objects and geometry with negative Z values. Turn it off (by setting it to zero), and you will be able to snap to these types of objects. OSOptions is a bitcode value; that means it uses bits to turn certain functions on and off. Zero is off; a value of 1 ignores hatch objects; and a value of 2 ignores negative Z values. Add them up (you get the value of 3) to get both functions. There are several settings in AutoCAD that function this way.



Average Rating:

User comments
Comment by Shank, Brent
Posted on 2010-08-30 13:33:16
For even faster switching, add 2 buttons to a toolbar and/or a ribbon panel...one with the macro code setvar "osoptions" 0 to turn it off and the other with setvar "osoptions" 3 to turn it on. Much faster than navigating through options.
Comment by Krushert,Ted
Posted on 2010-09-01 15:03:11
If you want to focus on just the snapping to the hatch and not the negative Z Coords. You can use the "OSNAPHATCH" variable instead. A quick and dirty lisp to toggle the variable could be. ;;; OSH Toggles OSNAPHATCH variable (defun c:OSH () (command "undo" "m") (setq OSHV (getvar "OSNAPHATCH")) (if (= OSHV 0) (progn ;then (setvar "OSNAPHATCH" 1) ; Sets Variable to 1 (Object snaps ignore hatch objects) ) (progn ;else (setvar "OSNAPHATCH" 0) ; Sets Variable to 0 (Object snaps treat hatch objects the same as other objects) ) ) )

Log In