TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Rustabout on May 29, 2021, 11:03:13 PM

Title: Color Index Handling Function for Layer Creation using Visual LISP
Post by: Rustabout on May 29, 2021, 11:03:13 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...

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!!
Title: Re: Color Index Handling Function for Layer Creation using Visual LISP
Post by: roy_043 on May 30, 2021, 03:22:19 AM
The color table in the link is incorrect.
Title: Re: Color Index Handling Function for Layer Creation using Visual LISP
Post by: danAllen on May 30, 2021, 01:30:09 PM
have you looked at: http://www.lee-mac.com/colourconversion.html#rgbaci ?
Title: Re: Color Index Handling Function for Layer Creation using Visual LISP
Post by: Rustabout 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.

Title: Re: Color Index Handling Function for Layer Creation using Visual LISP
Post by: Rustabout 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).
Title: Re: Color Index Handling Function for Layer Creation using Visual LISP
Post by: Lee Mac 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?
Title: Re: Color Index Handling Function for Layer Creation using Visual LISP
Post by: Rustabout 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).