Author Topic: Color Index Handling Function for Layer Creation using Visual LISP  (Read 1293 times)

0 Members and 1 Guest are viewing this topic.

Rustabout

  • Newt
  • Posts: 135
I started a routine using Visual LISP and Layers. Discovered that it's a bit of a pain dealing with colors, color indexes, etc...

I can create a sub-routine but it will involve taking this: https://gohtx.com/acadcolors.php and using it to determine whether the object's color is a 'true color' or simply an index color (assuming the user wants an index color if the color's RGB indexes matches an index color). Not 'hard' to program but a bit time intensive.

Does anyone have any better ideas? If I create such a sub routine would anyone else find it useful? Does something better already exist?

I'm a tad hesitant to switch to an entity list approach, but might have to as my next challenge will be dealing with transparency, which isn't the easiest with Visual LISP functions.

Thanks!!

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Color Index Handling Function for Layer Creation using Visual LISP
« Reply #1 on: May 30, 2021, 03:22:19 AM »
The color table in the link is incorrect.

danAllen

  • Newt
  • Posts: 133

Rustabout

  • Newt
  • Posts: 135
Re: Color Index Handling Function for Layer Creation using Visual LISP
« Reply #3 on: May 30, 2021, 04:00:53 PM »
Hi Roy, I checked and you're right. Colors 8 and 9 are definitely different. Only checked up to there and a few random colors (color 30 is correct at least). Good eye!

danAllen: The link will be ultra-helpful. I now need to figure out a 'test' to see if the layer is in fact set to a 'true color' or an index color.

As far as Visual vs Vanilla LISP, I think I will literally have to write a function in both to get what I need out of this deal. It's not so bad once it's done I guess.


Rustabout

  • Newt
  • Posts: 135
Re: Color Index Handling Function for Layer Creation using Visual LISP
« Reply #4 on: May 30, 2021, 05:19:02 PM »
My solution to True Color is the Layer's TrueColor property: if it's ColorMethod is set to 194, it's a true color; 195 and it's an index color. I'm only needed to copy properties not necessarily generate new ones (makes things a bit easier).

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Color Index Handling Function for Layer Creation using Visual LISP
« Reply #5 on: May 31, 2021, 06:33:27 PM »
I started a routine using Visual LISP and Layers. Discovered that it's a bit of a pain dealing with colors, color indexes, etc...

What specifically are you trying to do?

Rustabout

  • Newt
  • Posts: 135
Re: Color Index Handling Function for Layer Creation using Visual LISP
« Reply #6 on: June 05, 2021, 10:39:30 PM »
Hi Lee,

I was just making a program that copies a grouping of layers. I've since found a function but it doesn't solve the transparency issue (see my other post).