TurboCAD Forums

The Ultimate Resource for TurboCAD Knowledge

When replying to a specific statement be sure to quote the previous post.

Read 3458 times
* March 28, 2010, 04:48:40 AM
Many thanks to you Kevan for the new SDK-Helpfile.

Index-Color : Is there a way to change the color e.g. RGB green to Index 3-green?
I listed all the properties from a line, but havenīt found the difference between a line
With Pencolor RGB-green = 65280  and a line with the INDEX-Color 3Green  Pencolor = 65280

When I change this via Macrorecorder the following is recorded:

For Each gxChild in Selection
   gxURec.AddGraphicForModify gxChild
   gxChild.Properties("PenColor") = -16777213   

that works.
But the next time I list all the Properties the Pencolor = 65280

Where store TC the information whether the indexcolor-palette or the Truecolor – palette is used with this item?

Best regards


* March 29, 2010, 10:20:21 AM
Hi Bernd,

I haven't had a chance to look at this in depth, but when I check the Hex value of -16777213 in my Windows calculator, it looks like FFFFFFFFFF000003. So at least the high "nibble" of the color value is being set to F. Try adding 4026531840 (0xF0000000) to your index value and see if that works.



* March 30, 2010, 08:05:56 AM
Hi Kevan

I tried your recommended way, but it donīt work
Properties("PenColor") .value 16711680  =   blue
Properties("PenColor") .value -16777211 =   blue index
Properties("PenColor") .value 65280 =   green
Properties("PenColor") .value -16777213 =   green index

there is no constant value to add or subtract.

further help is appreciated.


* March 31, 2010, 10:26:09 AM
Hi Bernd,

To force an indexed color on a graphic, you set its PenColor property to (colorindex - 16777216).  I am attaching a VBscript sample to draw circles in the first 16 indexed colors (note that color indices start at 1, not zero).

Note that once you read the PenColor, even though you specified in indexed color, you are getting back the straight RGB color value, with no indication that it is an indexed color.

I am still investigating to see how we can detect when an indexed color is in use.


« Last Edit: March 31, 2010, 02:24:58 PM by kchapman »


* April 01, 2010, 03:17:41 AM
Hi Kevan
thanks for the script.
I found out, that the tools\database\report still recognize the right pencolor.value
Object type   Line Color
Circle   -16777215
Circle   -16777214
Circle   -16777213
Circle   -16777212
Circle   -16777211
Circle   -16777210
Circle   -16777209
Circle   -16777208
Circle   -16777207
Circle   -16777206
Circle   -16777205
Circle   -16777204
Circle   -16777203
Circle   -16777202
Circle   -16777201
Circle   -16777200

but vb or vb-script gives out the RGB-Color-number.