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
Any ideas?
Solved! Go to Solution.
Solved by OkieWolf. Go to Solution.
Hello,
I'm actually interested in doing something pretty similar..would you mind sharing your solution?
Thanks.
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.
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.