Changing the Background Colour

Discussion in 'AutoCAD' started by Frankie Golaub, Apr 16, 2004.

  1. Hi,

    Is there a command for changing the background colour rather than using the
    Options-Display dialog box.
    I want to create a macro button for changing the background colour from
    Black to White and vice versa as needed.
    I think there use to be a command for doing this in earlier versions,
    something like "ddlcolor" but I can't find anything like it anymore.
    If there is no command, can it be done through a lisp routine.

    Thanks

    Frankie Golaub.
     
    Frankie Golaub, Apr 16, 2004
    #1
  2. Frankie Golaub

    devitg Guest

    this feature is a window one
    it is saved on *.arg file on the autocad2002 folder .
     
    devitg, Apr 16, 2004
    #2
  3. Frankie Golaub

    Jeff Mishler Guest

    I have a lisp that will allow you to change the background color to
    whatever you want.....I just can't seem to find it. I'm not on my normal
    workstation, so that isn't surprising, but I will try to post it over
    the weekend when I can get back to where I know it's at.

    Come to think of it, I'm pretty sure I posted it to this group 6-8
    months ago. Try a search and see what you find.

    Jeff
     
    Jeff Mishler, Apr 16, 2004
    #3
  4. Thanks Jeff,

    I did a search using your name, but came up with nothing relating to the
    question that I asked.
    I will wait for your posting over the weekend.

    Cheers,

    Frankie Golaub.
     
    Frankie Golaub, Apr 16, 2004
    #4
  5. Here ya go, modify to taste.

    (defun c:bbg (/ white black green)
    ; Description: Reset the screen to show a black background color scheme
    ; with green text in command line
    (prompt "\nSet UI colors to Black color scheme.")
    (setq white (m:rgb->ole 255 255 255))
    (setq green (m:rgb->ole 0 255 0))
    (setq black (m:rgb->ole 0 0 0))
    (m:AcadUIColors black black white green black)
    (princ)
    )

    (defun c:wbg (/ white black)
    ; Description: Reset the screen to show a white background scheme
    (prompt "\nSet UI colors to White color scheme.")
    (setq white (m:rgb->ole 255 255 255))
    (setq black (m:rgb->ole 0 0 0))
    (m:AcadUIColors white white black black white)
    (princ)
    )

    (defun m:rgb->ole (r g b)
    ; Description:
    ; Support function to convert RGB values to OLE colors
    ; for AutoCAD window props
    ; Parameters:
    ; r - 0-255 color number
    ; g - 0-255 color number
    ; b - 0-255 color number
    ; Return Value:
    ; Color in OLE format for VLAX functions.
    (+ (* b 65536) (* g 256) r)
    )

    (defun m:AcadUIColors (BGMColor BGLColor CHColor TColor TBColor / DisplayObj)
    ; Description: Support function to set the AutoCAD UI colors.
    ; Parameters:
    ; BGMColor - OLE color number of Model Space background color
    ; BGLColor - OLE color number of Layout background color
    ; CHColor - OLE color number of Crosshairs color
    ; TColor - OLE color number of Text color in the command line
    ; TBColor - OLE color number of Text Background color
    (vl-load-com)
    (setq DisplayObj
    (vla-get-Display
    (vla-get-Preferences
    (vlax-get-acad-object)
    )
    )
    )
    ;; set text color
    (vla-put-TextWinTextColor DisplayObj TColor)
    ;; set Model Space background color
    (vla-put-GraphicsWinModelBackgrndColor DisplayObj BGMColor)
    ;; Set model crosshairs
    (vla-put-ModelCrosshairColor DisplayObj CHColor)
    ;; set text background color
    (vla-put-TextWinBackgrndColor DisplayObj TBColor)
    ;; Set layout background
    (vla-put-GraphicsWinLayoutBackgrndColor DisplayObj BGLColor)
    (princ)
    )

    Matt

     
    Matt Stachoni, Apr 16, 2004
    #5
  6. thanks Guys,

    Both examples work great, I especially liked Matt's solution since that can
    also change the command line text. I never thought of using green text on a
    black background for my command line.
    Just wondering though, where do the numbers come from i.e. ( * b 65536) (* g
    256) in one example and (16777215) in the other.

    Cheers,

    Frankie Golaub
     
    Frankie Golaub, Apr 16, 2004
    #6
  7. Frankie Golaub

    Mike Weaver Guest

    Frankie,
    In addition to the other suggestions you've I have found that some of my
    users do not want plotstyles displayed - they prefer to see the layer color.
    I created the following for them:

    (defun c:tpsd()(TogglePlotStyleDisplay))
    (defun TogglePlotStyleDisplay( / objActiveLayout)
    (if acd:acadobject nil (setq acd:acadobject (vlax-get-acad-object)))
    (setq objActiveLayout (vla-get-activelayout (vla-get-activedocument
    acd:acadobject)))
    (if (= :vlax-false (vla-get-showplotstyles objActiveLayout))
    (vla-put-showplotstyles objActiveLayout :vlax-true)
    (vla-put-showplotstyles objActiveLayout :vlax-false)
    )
    (command "._regenall")
    )


    Mike
     
    Mike Weaver, Apr 19, 2004
    #7
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.