Discussion:
Setting RAL colors
(too old to reply)
Patrick EMIN
2005-04-01 08:12:59 UTC
Permalink
Hi,

There is an example in AutoCAD help for assigning color book colors to
objects:

Sub Example_SetNames()
'This example draws a circle and
'returns the color name and color book name of the color.

Dim col As New AcadAcCmColor
Call col.SetRGB(125, 175, 235)
Call col.SetNames("MyColor", "MyColorBook")

Dim cir As AcadCircle
Dim pt(0 To 2) As Double
Set cir = ThisDrawing.ModelSpace.AddCircle(pt, 2)
cir.TrueColor = col
ZoomAll

Dim retCol As AcadAcCmColor
Set retCol = cir.TrueColor
MsgBox "BookName=" & col.BookName
MsgBox "ColorName=" & col.ColorName
End Sub


Why is there two lines:

Call col.SetRGB(125, 175, 235)
Call col.SetNames("MyColor", "MyColorBook")

I need to set a RAL color to an object, do I need to use the RGB syntax,
is the second line of code not enough to give an object a particular color?

Thanks.
--
/////
(o)-(o)
-----ooO---(_)---Ooo--------------------------
Patrick EMIN www.CADxp.com
Le portail francophone CAO et Nouvelles Technologies
Ravi Pothineni
2005-04-04 18:15:41 UTC
Permalink
The second line of code is enough
Sub test()
Dim col As New AutoCAD.AcadAcCmColor
col.SetColorBookColor "RAL CLASSIC", "RAL 1002"
End Sub
Post by Patrick EMIN
Hi,
There is an example in AutoCAD help for assigning color book colors to
Sub Example_SetNames()
'This example draws a circle and
'returns the color name and color book name of the color.
Dim col As New AcadAcCmColor
Call col.SetRGB(125, 175, 235)
Call col.SetNames("MyColor", "MyColorBook")
Dim cir As AcadCircle
Dim pt(0 To 2) As Double
Set cir = ThisDrawing.ModelSpace.AddCircle(pt, 2)
cir.TrueColor = col
ZoomAll
Dim retCol As AcadAcCmColor
Set retCol = cir.TrueColor
MsgBox "BookName=" & col.BookName
MsgBox "ColorName=" & col.ColorName
End Sub
Call col.SetRGB(125, 175, 235)
Call col.SetNames("MyColor", "MyColorBook")
I need to set a RAL color to an object, do I need to use the RGB syntax,
is the second line of code not enough to give an object a particular color?
Thanks.
--
/////
(o)-(o)
-----ooO---(_)---Ooo--------------------------
Patrick EMIN www.CADxp.com
Le portail francophone CAO et Nouvelles Technologies
Patrick EMIN
2005-04-06 20:03:19 UTC
Permalink
Post by Ravi Pothineni
The second line of code is enough
Sub test()
Dim col As New AutoCAD.AcadAcCmColor
col.SetColorBookColor "RAL CLASSIC", "RAL 1002"
End Sub
Thanks, I'll try that out.
--
/////
(o)-(o)
-----ooO---(_)---Ooo--------------------------
Patrick EMIN www.CADxp.com
Le portail francophone CAO et Nouvelles Technologies
Patrick EMIN
2005-04-07 19:53:54 UTC
Permalink
Post by Patrick EMIN
Post by Ravi Pothineni
The second line of code is enough
Sub test()
Dim col As New AutoCAD.AcadAcCmColor
col.SetColorBookColor "RAL CLASSIC", "RAL 1002"
End Sub
Thanks, I'll try that out.
It works but it's very, very slow... I guess it's reading the color book
from the hard disk XML file?
I resolved to build a table with the RAL colde and the RGB values instead.
--
/////
(o)-(o)
-----ooO---(_)---Ooo--------------------------
Patrick EMIN www.CADxp.com
Le portail francophone CAO et Nouvelles Technologies
Ravi Pothineni
2005-04-08 22:31:19 UTC
Permalink
It should be slow only the first time the color book is accessed (i.e. the
XML file is loaded from disk). Any subsequent access to the colorbook in
that session of AutoCAD should be instantanous.
Post by Patrick EMIN
Post by Ravi Pothineni
The second line of code is enough
Sub test()
Dim col As New AutoCAD.AcadAcCmColor
col.SetColorBookColor "RAL CLASSIC", "RAL 1002"
End Sub
Thanks, I'll try that out.
It works but it's very, very slow... I guess it's reading the color book
from the hard disk XML file?
I resolved to build a table with the RAL colde and the RGB values instead.
--
/////
(o)-(o)
-----ooO---(_)---Ooo--------------------------
Patrick EMIN www.CADxp.com
Le portail francophone CAO et Nouvelles Technologies
Loading...