Setting modelspace background color

Cliff Middleton

Usenet Archive
Joined
Jan 4, 2000
Messages
17
Reaction score
0
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, 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 | |
 
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.
 
Back
Top