06-08-2020
03:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
06-08-2020
03:57 AM
I just realized you don't have to send the proxy up through each occurrence of the occurrencepath.
This will do.
'Get a nativeobject for an edge. Dim oEdge As Edge = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartEdgeFilter, "Pick edge.").NativeObject 'Get the part document the edge belongs to. Dim oPart As PartDocument = oEdge.Parent.ComponentDefinition.Document 'Get the top level assembly Dim oAsm As AssemblyDocument = ThisDoc.Document 'Get the Assemblys select set. Dim oSelSet As SelectSet = oAsm.SelectSet 'Create an ObjectCollection to add all edge proxies to. Dim oEdgeCol As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection 'Loop through all occurrences of the part. For Each oOcc As ComponentOccurrence In oAsm.ComponentDefinition.Occurrences.AllReferencedOccurrences(oPart) 'Create a proxy for the edge Dim oEdgeProx As EdgeProxy oOcc.CreateGeometryProxy(oEdge, oEdgeProx) 'Add proxy to the object collection oEdgeCol.Add(oEdgeProx) Next 'Select everything in the object collection oSelSet.SelectMultiple(oEdgeCol)
Jhoel Forshav
Download my free Inventor Addin - Hole Projector
LinkedIn | Ideas | Contributions | Blog posts | Website