Toggle AutoCAD Background
This bit of lisp code 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)
)
All content is copyright © CAD Panacea 2008-2010 unless otherwise noted.
All content of CAD Panacea is solely my own personal thoughts and opinions and do not represent my employer or any others.
All comments posted to this blog are the sole responsibility of the person making the comment.
Google, as a third party vendor, uses cookies to serve ads on this site. Google's use of their cookies enables it to serve ads to users based on their visit to your sites and other sites on the Internet. You may opt out of the use of these cookies by visiting the Google ad and content network privacy policy.




Recent comments
3 hours 3 min ago
4 hours 43 min ago
6 hours 52 min ago
12 hours 43 min ago
15 hours 24 min ago
1 day 1 hour ago
1 day 19 hours ago
1 day 19 hours ago
1 day 23 hours ago
1 day 23 hours ago