Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic and assembly components

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
OkieWolf
2105 Views, 6 Replies

iLogic and assembly components

Inventor 2011.

OS = Windows 7.

 

I need to be able to write an iLogic rule that will read all components from the browser, select specific components, then return the full browser name of each one.

 

Example :

If I have an assembly containing several components. I want to loop through all components in the browser, pick out only 150# flanges, then return their full browser name.

 

maybe something such as a simple loop like :

compo = "-"
Do While compo <> nil And compo <> ""
compo = Component.InventorComponent()
MessageBox.show(compo,"test",MessageBoxButtons.OK)
Loop

 

Which doesn't work because in the line "compo = Component.InventorComponent()", the () are empty and iLogic doesn't know what to do. But, neither do I Smiley Surprised

 

Any ideas?

6 REPLIES 6
Message 2 of 7
OkieWolf
in reply to: OkieWolf

Never mind. I figured it out.

Message 3 of 7
mags262
in reply to: OkieWolf

Hello,

 

I'm actually interested in doing something pretty similar..would you mind sharing your solution?

 

Thanks.

Message 4 of 7
OkieWolf
in reply to: mags262

No, I don't mind but it's pretty involved at this point. What are you trying to do?

Message 5 of 7
mags262
in reply to: OkieWolf

My application is simpler than yours sounds, but I want to push an iProperty update down to all components of an assembly based on a list selection.  The problem is, I won't know the names of the components, so I was hoping for a way to change a property of all sub-components without identifying them by name. 

 

Not really the same thing you were doing, but I'm hoping your solution to your problem lends itself to mine as well.

Message 6 of 7
OkieWolf
in reply to: mags262

This is a very cut down version but....

 

Dim app As Inventor.Application = ThisApplication

Dim oDoc As Inventor.AssemblyDocument = app.ActiveDocument

Dim oCompDef As Inventor.ComponentDefinition = oDoc.ComponentDefinition

Dim oCompOcc As Inventor.ComponentOccurrence

 

For Each oCompOcc In oCompDef.Occurrences

      Dim compDef as Inventor.ComponentDefinition = oCompOcc.Definition

      Dim compDoc as Inventor.Document = compDef.Document

      Dim PartName As String = System.IO.Path.GetFileNameWithoutExtension(compDoc.FullFileName)

      .....do something to PartName....

Next

 

So, basically, PartName will be the next component each time it cycles through. Within the loop you can then do whatever you need to do to that particular PartName.

Message 7 of 7
mags262
in reply to: OkieWolf

This does exactly what I was looking for.  Thanks for your help!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report