Getting an occurrence without traversing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey
im doing a lot of assembly work and more than 50% of the operation time is consumed by traversing the assembly for documents. Is there a good to get an occurrence or document definition without needing to to the loop if i had say, a filepath, display name or partial name?
I have tried the ComponentEnumerator but that seems to the take the same amount of time as a loop. I thought i could use ItemByName but that requires the Application documents not the assembly document and the file needs to be open.
I was hoping that the enumerator would be more of a lookup and be faster unless im using it wrong..
Dim Doc as string = "C;\MyFile.ipt"
Dim oAssyDoc As AssemblyDocument = Form1.G._Invapp.ActiveDocument
Dim oCompOccEnum As ComponentOccurrencesEnumerator = oAssyDoc.ComponentDefinition.Occurrences.AllReferencedOccurrences(oDoc.ComponentDefinition)
For Each oCompOcc As ComponentOccurrence In oCompOccEnum
If oCompOcc.Definition.Document.FullFileName = Doc Then
oC2 = oCompOcc
Exit For
End If
Next
Looking for the most efficient way to enumerate an assembly to find a component without it needing to be open.
thanks
Nacho
Automation & Design Engineer
Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC
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.