Inventor General

Reply
Distinguished Contributor
eveylynne
Posts: 114
Registered: ‎12-16-2011
Message 1 of 3 (233 Views)
Accepted Solution

Solid Bodies in ilogic

233 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*
mrattray
Posts: 2,450
Registered: ‎09-13-2011
Message 2 of 3 (227 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
xiaodong.liang
Posts: 1,233
Registered: ‎06-12-2011
Message 3 of 3 (182 Views)

Re: Solid Bodies in ilogic

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

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:

http://au.autodesk.com/au-online/classes-on-demand/class-catalog/2011/autocad-inventor-suites/autode...

 

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
 

 



Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
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 to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube