Jump to content

Toggle BricsCAD background color quickly


CAD Panacea

Recommended Posts

If you do any presentation with or screen captures from your CAD application, you may have the need to quickly change background colors for various reasons. This post from about 9 years ago, includes some lisp code to do this in AutoCAD. Today’s post includes the lisp code to do the same thing in BricsCAD. Note that this version does not change the crosshair color(s), but in our testing BricsCAD will automatically set the opposite color for the crosshairs (white on black and black on white).

The function is named TBC. After you load this lisp file, you can type in TBC and this will toggle the background color from Black to White and so on. See animated GIF at the bottom of this post.

(vl-load-com)
(defun c:TBC (/ pref col cur 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)
  )  
 )
 (t
  (vla-put-graphicswinmodelbackgrndcolor
      pref
      (vlax-make-variant (abs (- col 16777215)) vlax-vblong)
  )
 )
  )
  (vlax-release-object pref)
  (princ)
)

Toggle Background Color

View the full article

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...