API: Set text style color to bylayer?

API: Set text style color to bylayer?

Anonymous
Not applicable
1,331 Views
1 Reply
Message 1 of 2

API: Set text style color to bylayer?

Anonymous
Not applicable
Is it possible to set the text style color to "bylayer" via the API? If so, how?

Thanks!
0 Likes
1,332 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
This capability is new to the API in Inventor 2010. See sample below.

Sanjay-


Sub ColorToByLayer()

Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument

Dim oTS As TextStyle
Set oTS = oDoc.StylesManager.TextStyles("Label Text (ANSI)")

' Create color with any rgb values and set source as layer
Dim oColor As Color
Set oColor = ThisApplication.TransientObjects.CreateColor(0, 0, 0)
oColor.ColorSourceType = kLayerColorSource

oTS.Color = oColor

End Sub
0 Likes