Nacho
Automation & Design Engineer
Inventor Programmer (C#, VB.Net / iLogic)
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Hi,
In the Inventor API Help file (C:\Program Files\Autodesk\Inventor 2014\Local Help\admapi_18_0.chm) did you go through the section "Inventor API's User Manual >> Customizing the User Interface >> Interacting with the User"?
Did you try "oSelectEvents.AddSelectionFilter kAssemblyOccurrenceFilter"?
Cheers,
Not quite sure what problem you encountered,can you explain more about what you want to do?
Hi
Thanks for the reply. what iam actually trying to do is -
1. Let user select parts in assembly that need treatment. These parts will all be highlighted and added to a collection
2. Let user select a part and once clicked, all occurences are added to a collection (Doesnt need to visually highlight, just be a collection)
3. i have a routine that deals with 2 parts -
Dim oOccurrence1 As ComponentOccurrence
Dim oOccurrence2 As ComponentOccurrence
i need to loop through the 1st collection and pass each object to oOccurrence1. for every object, loop through the 2nd collection
Does that make any sense? basically, for each object in the first collection, loop through all objects in the second selection
Thanks
Nigel
Nacho
Automation & Design Engineer
Inventor Programmer (C#, VB.Net / iLogic)
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Understand now, you can refer to the "Inventor API's User Manual >> Customizing the User Interface >> Interacting with the User" in API help as Adam pointed. For you workflow you need to monitor the selection event, and the manual can tell you how to do that. Hope this helps.
Nacho
Automation & Design Engineer
Inventor Programmer (C#, VB.Net / iLogic)
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
"I cannot work out how to loop through my collection and pass each object to my routine using ComponentOccurrence."
What object type you are using for collecting objects? Inventor's ObjectCollection class created through TransientObjects.CreateObjectCollection()?
Most collections support For Each loop that gets back each object and then you can call your other function by passing in that object as a parameter.
Sub MyFunction(BaseOcc As ComponentOccurrence)
' Do something with BaseOcc
End Sub
Sub Main
Dim coll As ObjectCollection
Set coll = ThisApplication.TransientObjects.CreateObjectCollection
' Fill the collection with various component occurrences ...
Dim o As Object
For Each o In coll
Call MyFunction(o)
Next
End Sub
Hi Nigel, if this is still part of the selection process you were doing before you need to loop through your collections together. This will assume you have two ObjectCollections named objSelectSet1 and objSelectSet2, and that all the objects in the collections are ComponentOccurrences
The declarations are not needed as they will be in your looping construct.
Remove: Dim oOccurrence1 As ComponentOccurrence
Remove: Dim oOccurrence2 As ComponentOccurrence
You will need nested loops.
For Each oOcurrence1 As ComponentOccurrence In objSelectSet1
For Each oOcurrence2 As ComponentOccurrence In objSelectSet2
'Do what you need to do here
Next
Next
Can't find what you're looking for? Ask the community or share your knowledge.