Change color of layer IV2008 SP2

Change color of layer IV2008 SP2

Anonymous
Not applicable
313 Views
2 Replies
Message 1 of 3

Change color of layer IV2008 SP2

Anonymous
Not applicable
i want to change the color of a existing layer with this code
***********************
Public Sub change_layer_color()
Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.ActiveDocument
Dim oNewLayer As Layer
Set oNewLayer = oDrawDoc.StylesManager.Layers.Item("PDM_STAMP")
oNewLayer.Color.SetColor 255, 0, 0
End Sub
***********************
But nothing happens.
Here is the content of the Local VBA Window.
////////////////////////////////////
- : oNewLayer : : Layer/IRxLayer
: [_Name] : "PDM_STAMP" : String
- : Color : : Color/IRxColor
: Blue : 160 : Byte
: Green : 0 : Byte
: Red : 0 : Byte

******************************

thank's for your help
0 Likes
314 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
One of those API items that you think should work the way it is documented,
but doesn't.

Replace:
oNewLayer.Color.SetColor 255, 0, 0

With:
oNewLayer.Color = ThisApplication.TransientObjects.CreateColor(255, 0,
0)

(watch for word wrap)

Neil


"Frank Schalla" wrote in message
news:5796499@discussion.autodesk.com...
i want to change the color of a existing layer with this code
***********************
Public Sub change_layer_color()
Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.ActiveDocument
Dim oNewLayer As Layer
Set oNewLayer = oDrawDoc.StylesManager.Layers.Item("PDM_STAMP")
oNewLayer.Color.SetColor 255, 0, 0
End Sub
***********************
0 Likes
Message 3 of 3

frank_schalla
Advocate
Advocate
Hallo Neil

thank's for your answer.
It works.
But by the way, that is one of the reasons why i "LOVE" the documentation of the Inventor
API ("A"pes "P"rogrammers "I"diot's.
0 Likes