I'm driving the colors of solid bodies in a part with ilogic. I can select each feature, but this is tedious and combersome. If I change the part, I have to adjust the rule containing tha list of features affected. I would rather have the rule look at the solid bodies of the part. I don't know how to call out a solid body in ilogic.
A feature is, "Feature.Color("featurename"), and a component is "Component.Color("part"). This naming scheme doesn't seem to work with bodies though.
What language do I use to modify a body in ilogic?
IV 2014, Windows 7
Solved! Go to Solution.
Solved by xiaodong_liang. Go to Solution.
I can't seem to find anyway to access solids outside the context of derived parts via the API at all. You might try the Inventor Customization forum.
Hi,
you just need to use Inventor API within ilogic. The following is a code demo. For more guide about Inventor API in iLogic, please refer to this course:
doc = ThisDoc.Document oDef = doc.ComponentDefinition 'assume there are two appearances in the documents oGold_Color = doc.Assets("Gold - Metal") oStones_Color = doc.Assets("Small Uneven Rectanguler Stones - Brown") 'if change all bodies with same color ' in some cases, we need to declare the variable explictly Dim oSB As SurfaceBody For Each oSB In oDef.SurfaceBodies oSB.Appearance = oGold_Color Next ' if change specific body to specific color Dim oSB1 As SurfaceBody oSB1 = oDef.SurfaceBodies(1) oSB1.Appearance = oGold_Color Dim oSB2 As SurfaceBody oSB2 = oDef.SurfaceBodies(2) oSB2.Appearance = oStones_Color