Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am working in a part file where I would like to change two faces to a specific color based on criteria. Below is a simplified version of the code and where it is failing. Both faces already have a color assigned and the code does find those two faces. However, when trying to call SetRenderStyle, the code errors and no faces are actually updated.
I am in Inventor 2018.
Dim oPartDoc As PartDocument oPartDoc = ThisApplication.ActiveDocument ' Get all of the faces that have the "FaceColor" attribute. Dim oFaces As ObjectCollection oFaces = oPartDoc.AttributeManager.FindObjects( "com.autodesk.inventor.FaceAttributes", "FaceColor") ' Iterate through all faces that have colors and change. Dim oFace As Face Dim oStyle As RenderStyle For Each oFace In oFaces oStyle = oPartDoc.RenderStyles.Item("Beige") Call oFace.SetRenderStyle(kOverrideAppearance, oStyle) Next
Solved! Go to Solution.