CAD PANACEA HAS MOVED TO http://cadpanacea.com
25 September 2007
Toggle AutoCAD Background Part 2          
Samuli commented on the Toggle AutoCAD Background post from February, asking for a way to toggle the layout background color also (the original function only toggled the model space background color...)

Here it is. This will toggle the background color from white to black to white in whatever space you are in. (no effect on the block editor though...)


(vl-load-com)
(defun c:TBC (/ pref col tm)
(setq tm (getvar "tilemode"))
(setq pref (vla-get-display
(vla-get-Preferences
(vlax-get-acad-object)
)
)
)
(if (zerop tm)
(setq cur (vla-get-graphicswinlayoutbackgrndcolor pref))
(setq cur (vla-get-graphicswinmodelbackgrndcolor pref))
)
(setq col (vlax-variant-value
(vlax-variant-change-type
cur
vlax-vblong
)
)
)
(if (not (or (eq col 0) (eq col 16777215)))
(setq col 0)
)
(cond ((zerop tm)
(vla-put-graphicswinlayoutbackgrndcolor
pref
(vlax-make-variant (abs (- col 16777215)) vlax-vblong)
)
(vla-put-layoutcrosshaircolor
pref
(vlax-make-variant col vlax-vblong)
)
)
(t
(vla-put-graphicswinmodelbackgrndcolor
pref
(vlax-make-variant (abs (- col 16777215)) vlax-vblong)
)
(vla-put-modelcrosshaircolor
pref
(vlax-make-variant col vlax-vblong)
)
)
)
(vlax-release-object pref)
(princ)
)

Labels: ,


PermaLink       Posted 9/25/2007 12:16:00 PM     
0 COMMENTS!

Post a comment