Inventor General Discussion

Inventor General Discussion

Distinguished Contributor
Posts: 116
Registered: ‎12-16-2011
Message 1 of 3 (291 Views)
Accepted Solution

Solid Bodies in ilogic

291 Views, 2 Replies
02-12-2014 10:39 AM

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

*Expert Elite*
Posts: 2,473
Registered: ‎09-13-2011
Message 2 of 3 (285 Views)

Re: Solid Bodies in ilogic

02-12-2014 10:56 AM in reply to: eveylynne

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.

Mike (not Matt) Rattray

ADN Support Specialist
Posts: 1,271
Registered: ‎06-12-2011
Message 3 of 3 (240 Views)

Re: Solid Bodies in ilogic

02-16-2014 09:42 PM in reply to: eveylynne



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

' 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


Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.