Author Topic: How to get plot style names from STB file?  (Read 13896 times)

0 Members and 1 Guest are viewing this topic.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: How to get plot style names from STB file?
« Reply #15 on: May 30, 2014, 03:14:33 AM »
Actually for true colors the mode_color value represents the print color. I don't understand the color value in this case. It is not the ACI 'equivalent' of the true color.

Code: [Select]
Style property Color: RGB:91,46,209:
  color=-1012575662       (ColorInteger_To_ByteList -1012575662) => (195 165 82 82) => ???
  mode_color=-1034211631  (ColorInteger_To_ByteList -1034211631) => (194 91 46 209) => Print color
 
Style property Color: RGB:91,46,230:
  color=-1006698433       (ColorInteger_To_ByteList -1006698433) => (195 255 0 63)  => ???
  mode_color=-1034211610  (ColorInteger_To_ByteList -1034211610) => (194 91 46 230) => Print color

Lupo76

  • Bull Frog
  • Posts: 343
Re: How to get plot style names from STB file?
« Reply #16 on: June 13, 2014, 12:12:36 PM »
Actually for true colors the mode_color value represents the print color. I don't understand the color value in this case. It is not the ACI 'equivalent' of the true color.

Code: [Select]
Style property Color: RGB:91,46,209:
  color=-1012575662       (ColorInteger_To_ByteList -1012575662) => (195 165 82 82) => ???
  mode_color=-1034211631  (ColorInteger_To_ByteList -1034211631) => (194 91 46 209) => Print color
 
Style property Color: RGB:91,46,230:
  color=-1006698433       (ColorInteger_To_ByteList -1006698433) => (195 255 0 63)  => ???
  mode_color=-1034211610  (ColorInteger_To_ByteList -1034211610) => (194 91 46 230) => Print color

Hello Roy,
sorry for the delay in my response, but unfortunately lately I've been very busy with other projects.

Thank you very much for your help, I can finally see some light in this project management CTB.

I found the following function, which converts the RGB color ACI:

Code: [Select]
(defun rgbtoaci (rgbcodes / colorobj)
  (vl-load-com)
  (setq colorobj (vla-getinterfaceobject (vlax-get-acad-object) "AutoCAD.AcCmColor.18"))
  (vla-setrgb colorobj (car rgbcodes) (cadr rgbcodes) (caddr rgbcodes))
  (vla-get-colorindex colorobj)
)

Unfortunately it does not work correctly with some colors.
For example.

(rgbtoaci '(221 0 0))) => 12 it's ok!
(rgbtoaci '(184 0 0))) => 12 it's no correct! the correct value is 14

Can you explain to me why this problem?
Do you have any advice?

thanks

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: How to get plot style names from STB file?
« Reply #17 on: June 14, 2014, 05:18:26 AM »
(rgbtoaci '(184 0 0))) => 12 it's no correct! the correct value is 14
I get the same result in BricsCAD. But why do you say this is wrong?

The ACI color dialog has these RGB values for index 12 and 14:
ACI=12: R=204, G=0, B=0.
ACI=14: R=153, G=0, B=0.

Since 184 is closer to 204 than to 153 the return value of rgbtoaci seems to be correct.
But I do not fully understand the rgb to aci conversion.

Lupo76

  • Bull Frog
  • Posts: 343
Re: How to get plot style names from STB file?
« Reply #18 on: June 14, 2014, 05:52:54 AM »
I say it's wrong because I set the CTB in the following way:

Color 12 -> Print Color = 12
Color 14 -> Print Color = 14

I subsequently exported to a txt file all settings of the CTB and found
Color 12 -> mode_color = -1008926720 = (221 0 0)
Color 14 -> mode_color = -1011351552 = (184 0 0)

Then I converted the RGB color in ACI and unfortunately I found out that:

(221 0 0) = 12, OK
(184 0 0) = 12, NO OK

I need to get the same colors ACI set in CTB!
I think that the only solution is to prepare a file mapping of the RGB -> ACI, but I hope in some of your advice to avoid doing this.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: How to get plot style names from STB file?
« Reply #19 on: June 14, 2014, 05:27:56 PM »
The situation is more complex than I previously thought.

The 194/195 logic (as used in VP layer color overrides) does not fully apply. And very strange is the fact that the 'color' values for Color_12 and Color_14 are the same. But in BricsCAD the 'mode_color' value always seems to contain the correct RGB values. So I don't understand why AutoCAD is giving different values.

In the end creating a mapping table may indeed be the best option.

Code: [Select]
Color_1
  color      (ColorInteger_To_ByteList -1006698496) => (195 255   0   0)
  mode_color (ColorInteger_To_ByteList -1006698496) => (195 255   0   0)
Color_2
  color      (ColorInteger_To_ByteList -1006633216) => (195 255 255   0)
  mode_color (ColorInteger_To_ByteList -1006633216) => (195 255 255   0)
Color_3
  color      (ColorInteger_To_ByteList -1023344896) => (195   0 255   0)
  mode_color (ColorInteger_To_ByteList -1023344896) => (195   0 255   0)

Color_11
  color      (ColorInteger_To_ByteList -1006665857) => (195 255 127 127)
  mode_color (ColorInteger_To_ByteList -1006665857) => (195 255 127 127)
Color_12
  color      (ColorInteger_To_ByteList -1023410011) => (195   0   0 165)
  mode_color (ColorInteger_To_ByteList -1026818048) => (194 204   0   0)
Color_13
  color      (ColorInteger_To_ByteList -1018009691) => (195  82 103 165)
  mode_color (ColorInteger_To_ByteList -1026791834) => (194 204 102 102)
Color_14
  color      (ColorInteger_To_ByteList -1023410011) => (195   0   0 165)
  mode_color (ColorInteger_To_ByteList -1030160384) => (194 153   0   0)
Color_15
  color      (ColorInteger_To_ByteList -1018015067) => (195  82  82 165)
  mode_color (ColorInteger_To_ByteList -1030140852) => (194 153  76  76)

Lupo76

  • Bull Frog
  • Posts: 343
Re: How to get plot style names from STB file?
« Reply #20 on: June 16, 2014, 03:32:27 AM »
In the end creating a mapping table may indeed be the best option.
]

I decided
I will create a mapping table

Thanks for all the help!