(defun Model_col-layer_col (layer_obj / COLOROBJ OLECOL A1 A2)
;; By ElpanovEvgeniy
;; 12-10-2005
;; Function Model_col-layer_col
;; calculates colour of the screen in model space
;; also appoints to its colour transferred as argument
;; layer_obj - vla the index on a layer
;; it is necessary for them to appoint colour of the screen
;; функция Model_col-layer_col
;; вычисляет цвет экрана в пространстве модели
;; и назначает его цвету переданному как аргумент
;; layer_obj - вла указатель на слой
;; которому необходимо назначить цвет экрана
(setq OleCol (vlax-variant-value
(vlax-variant-change-type
(vla-get-GraphicsWinModelBackgrndColor
(setq a2 (vla-get-display
(setq a1 (vla-get-preferences adoc))
)
)
)
'3
)
)
)
(vla-setRGB
(setq
ColorObj (vla-GetInterfaceObject
adoc
(if (WCMATCH (ver) "* 2007*,* 2008*,* 2009*")
"AutoCAD.AcCmColor.17"
"AutoCAD.AcCmColor.16"
)
)
)
(lsh (lsh OleCol 24) -24)
(lsh (lsh OleCol 16) -24)
(lsh OleCol -16)
)
(vla-put-TrueColor layer_obj ColorObj)
(vlax-release-object ColorObj)
(vlax-release-object a1)
(vlax-release-object a2)
)
(defun test (/ ADOC TMP_LRS)
;; Example of creation of the layer having colour, as at Backgrnd.
(setq adoc (vlax-get-acad-object)
tmp_lrs (vla-add
(vla-get-layers
(vla-get-modelspace (vla-get-activedocument adoc))
)
"tmp_hatch"
)
)
(Model_col-layer_col tmp_lrs)
)