Author Topic: Hatch background color (...the cameback)  (Read 2074 times)

0 Members and 1 Guest are viewing this topic.

Vandyck

  • Newt
  • Posts: 24
Hatch background color (...the cameback)
« on: September 29, 2016, 01:15:26 PM »
does anyone know how to turn off the Hatch background color ?

this code set color to black.... but it is not the same as turn off the background color !
Code - Auto/Visual Lisp: [Select]
  1.         (setq obj2(vlax-ename->vla-object hatchename))
  2.         (setq oCol(vlax-get-property obj2 'TrueColor))
  3.         (vlax-invoke-method oCol 'SetRGB 0 0 0)
  4.         (vlax-put-property obj2 'Backgroundcolor oCol)
  5.  
removing xdata don't have any effect
Code - Auto/Visual Lisp: [Select]
  1. (-3 ("GradientColor1ACI" (1070 . 5)) ("GradientColor2ACI" (1070 . 2)) ("ACAD" (1010 0.0 0.0 0.0)) ("HATCHBACKGROUNDCOLOR" (1071 . -1023410170) (1000 . "") (1000 . "")))

I have also tried with others ActiveX methods:
vla-put-ColorMethod, vla-put-EntityColor
but a "none color" index is not documented anywhere like, for example, 0 to "BYblock" 256 to "Bylayer"

thanks

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Hatch background color (...the cameback)
« Reply #1 on: September 29, 2016, 02:08:53 PM »
Reverse engineering gave me this:
Code - Auto/Visual Lisp: [Select]
  1. (defun c:test ( / col ent obj )
  2.     (if
  3.         (and
  4.             (setq ent (car (entsel "\nSelect hatch: ")))
  5.             (= "HATCH" (cdr (assoc 0 (entget ent))))
  6.         )
  7.         (progn
  8.             (setq obj (vlax-ename->vla-object ent)
  9.                   col (vla-get-backgroundcolor obj)
  10.             )
  11.             (vla-put-entitycolor col -939524096)
  12.             (vla-put-backgroundcolor obj col)
  13.         )
  14.     )
  15.     (princ)
  16. )

Vandyck

  • Newt
  • Posts: 24
Re: Hatch background color (...the cameback)
« Reply #2 on: September 30, 2016, 05:07:55 AM »
Thanks Lee, you're ingenious. :-)

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: Hatch background color (...the cameback)
« Reply #3 on: September 30, 2016, 07:49:19 AM »
 :-)