Author Topic: background colors  (Read 3392 times)

0 Members and 1 Guest are viewing this topic.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
background colors
« on: November 06, 2003, 11:09:06 PM »
I had this on my clipboard from responding elsewhere so ..
This is for playing with  ... to change background colors
Regards
kwb
Code: [Select]

(vl-load-com)
(setq acadPrefDisplay
       (vla-get-display
         (vla-get-preferences (vlax-get-acad-object))
       )
)
;;==>> #<VLA-OBJECT IAcadPreferencesDisplay 087e6aac>

(vla-get-graphicsWinModelBackgrndColor acadPrefDisplay )
;;==>>  #<variant 19 0>

(vla-get-modelCrosshairColor acadPrefDisplay)
;;==>> #<variant 19 12582656>

(vla-get-graphicsWinLayoutBackgrndColor acadPrefDisplay)
;;==>> #<variant 19 8339200>

(setq tmp (vla-get-layoutCrosshairColor acadPrefDisplay ))
;;==>> #<variant 19 16777215>

(vlax-variant-value (vlax-variant-change-type tmp vlax-vbLong))
;;==>> 16777215

;; The Value returned is an OLE Color based on RGB values derived from
;; red+(256*green)+(65536*blue), where red, green and blue can be 0 (off) to 255.
;;


;; So ...
;; set the modelspace background black with light green cursor
  (vla-put-graphicswinmodelbackgrndcolor acadPrefDisplay 0)
  (vla-put-modelcrosshaircolor acadPrefDisplay  12582656)

;; set the modelspace background white with gray cursor
  (vla-put-graphicswinmodelbackgrndcolor acadPrefDisplay 16777215)
  (vla-put-modelcrosshaircolor acadPrefDisplay  5592405)


;; Paperspace is similar using :-
(vla-put-graphicswinlayoutbackgrndcolor acadPrefDisplay < color > )
(vla-put-layoutcrosshaircolor acadPrefDisplay < color > )
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Paul Munford

  • Guest
Re: background colors
« Reply #1 on: February 03, 2009, 09:25:23 AM »
Thanks Kerry. I found this information really helpfull.

Together with the guys from Augi...

http://forums.augi.com/showthread.php?p=937593#post937593

... I managed to hack out this routine...

JohnK

  • Administrator
  • Seagull
  • Posts: 10657
Re: background colors
« Reply #2 on: February 03, 2009, 11:31:35 AM »
Here is the ``vl method'' for regenerating.

(vla-regen (vla-get-activedocument (vlax-get-acad-object)) 1)

TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: background colors
« Reply #3 on: February 03, 2009, 03:00:10 PM »
Code: [Select]
(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)
)