VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

retrieving the layer color (ACI)

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
205 Views, 2 Replies

retrieving the layer color (ACI)

How do I retrieve a layer's ACI color? I have a drawing with some layers that use ACI colors. I tried using debug.print objLayer.truecolor.XXX but none of the properties output the color property. I get a type mismatch error on the color property. So, I need to start digging what's going on.

It looks like i will need to extract the red, green, and blue components seperately and then combine them somehow. Correct? Any suggestions for doing this?

Thanks,
Josh
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

Dim oLayer As AcadLayer
Dim oColor As AcadAcCmColor

Set oLayer = ThisDrawing.Layers("Layer1")
Set oColor = oLayer.TrueColor
If oColor.ColorMethod = acColorMethodByACI Then
Debug.Print oColor.ColorIndex
End If

wrote in message news:5517472@discussion.autodesk.com...
How do I retrieve a layer's ACI color? I have a drawing with some layers
that use ACI colors. I tried using debug.print objLayer.truecolor.XXX but
none of the properties output the color property. I get a type mismatch
error on the color property. So, I need to start digging what's going on.

It looks like i will need to extract the red, green, and blue components
seperately and then combine them somehow. Correct? Any suggestions for
doing this?

Thanks,
Josh
Message 3 of 3
Anonymous
in reply to: Anonymous

Thanks, Jeff.

At one point, I was using the correct property. I tried to concatentate a string and long and that mistake was giving me the type mismatch error.

debug.print olayer.name + " - " + ocolor.colorindex

Thanks,
Josh

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost