Setting modelspace background color

Discussion in 'AutoCAD' started by Cliff Middleton, Jul 22, 2003.

  1. I have set the modelspace background color to 9 and then using the following
    find the integer value used by preferences.

    (setq
    prefDisplay (vla-get-Display (vla-get-Preferences (vlax-get-acad-object)))
    color (vlax-variant-value (vlax-variant-change-type
    (vla-get-GraphicsWinModelBackgrndColor prefDisplay) vlax-vbLong))
    )

    The color value is 46186688. When I attempt to put this value in the
    preferences I get the following error.

    :ERROR-BREAK.42 "Automation Error. Error setting preference property"
    [6.39] (intelligent-invoke #<VLA-OBJECT IAcadPreferencesDisplay 07f8c85c>
    "GraphicsWinModelBackgrndColor" 4 #<variant 3 46186688>)

    How can I set this value?
     
    Cliff Middleton, Jul 22, 2003
    #1
  2. Cliff, what version of AutoCAD?

    I used TuFer, and got a long value of 12632256. Our toggle code then works
    with that:

    (defun ax:ToggleMSBackground (/ prefDisplay)
    (vl-load-com)
    (setq prefDisplay (vla-get-Display (vla-get-Preferences
    (vlax-get-acad-object)))
    color (vlax-variant-value
    (vlax-variant-change-type
    (vla-get-GraphicsWinModelBackgrndColor prefDisplay)
    vlax-vbLong)))
    (vla-put-GraphicsWinModelBackgrndColor
    prefDisplay
    (vlax-make-variant
    (if (= color 0)
    12632256
    0)
    vlax-vbLong))
    (princ))


    --
    R. Robert Bell, MCSE
    www.AcadX.com


    | I have set the modelspace background color to 9 and then using the
    following
    | find the integer value used by preferences.
    |
    | (setq
    | prefDisplay (vla-get-Display (vla-get-Preferences
    (vlax-get-acad-object)))
    | color (vlax-variant-value (vlax-variant-change-type
    | (vla-get-GraphicsWinModelBackgrndColor prefDisplay) vlax-vbLong))
    | )
    |
    | The color value is 46186688. When I attempt to put this value in the
    | preferences I get the following error.
    |
    | :ERROR-BREAK.42 "Automation Error. Error setting preference property"
    | [6.39] (intelligent-invoke #<VLA-OBJECT IAcadPreferencesDisplay 07f8c85c>
    | "GraphicsWinModelBackgrndColor" 4 #<variant 3 46186688>)
    |
    | How can I set this value?
    |
    | --
    | Cliff
    |
    |
     
    R. Robert Bell, Jul 22, 2003
    #2
  3. A2K. I notice in 2004 that color 9 is not an option. Interesting. 253 or
    so will work in A2K. Close enough. Thanks for the mind jog, RRB.
     
    Cliff Middleton, Jul 22, 2003
    #3
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.