- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Code to re-select edge?
I can use
oEdge = oApp.CommandManager.Pick(Inventor.SelectionFilterEnum.kPartEdgeCircularFilter, "Select an edge.") to grab an edge.
From 'oEdge' I can get the occurence of the owning part ( Occurrence = oEdge.Parent.Parent )
I can get the unique identifier from 'oEdge' using oEdge.TransientKey (?) which will then allow me to iterate another occurence of the same part and find the equivalent edge
How do I then select the 'new' edge programmatically but with the same outcome/properties as oApp.CommandManager.Pick (ie I need to get the occurence name from the newly selected edge via Occurrence = oNewEdge.Parent.Parent)
Cheers
MattH
MattH
Product Design Collection 2025
Vault Pro 2025
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Can you loop through all of the edges in the second part comparing if oEdgeNew.TransientKey equals oEdge.TransientKey?
Best of Luck
---------------------------------------------------------------------------------------------------------------------------------
If you find this reply helpful or insightful, please use the 'Accept as Solution' or 'Kudos' button below.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
As it happens, that is exactly what I am already doing.
Using the oApp.CommandManager.Pick method I can get the occurence owner of the edge by Occurrence = oEdge.Parent.Parent because there is a value to the effect of oEdge.Parent.Parent.occurence = "Part1:1"
When I iterate the second occurence's edges, find the matching TransientKey, then drill down there is no oEdge2.Parent.Parent.occurence entry, therefore the code I subsiquently use, which relies on both the oEdge2 reference and its resulting oEdge2.Parent.Parent.occurence = "Part1:2" does not work because I am failing to get the oEdge2.Parent.Parent.occurence = "Part1:2" element.
cheers
Matt
MattH
Product Design Collection 2025
Vault Pro 2025
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I do not know how your workflow is, i normally search for identic edges like this:
Sub Select_Same_Edges()
Dim oApp As Inventor.Application
Set oApp = ThisApplication
Dim oAsmDoc As AssemblyDocument
Set oAsmDoc = oApp.ActiveDocument
Dim oAsmCompDef As AssemblyComponentDefinition
Set oAsmCompDef = oAsmDoc.ComponentDefinition
Dim oSelectedEdge As EdgeProxy
Set oSelectedEdge = ThisApplication.CommandManager.Pick(kPartEdgeCircularFilter, "Celect circular edge")
'Occurrence ermitteln
Dim oSelectedOcc As Inventor.ComponentOccurrence
Set oSelectedOcc = oSelectedEdge.Parent.Parent
'Loop through all occs of the assembly, if want all oOccs (inc. child-occs) you have to write a recursive function
Dim oOcc As ComponentOccurrence
For Each oOcc In oAsmCompDef.Occurrences
Dim oEdge As Edge
If TypeOf oOcc.Definition.Document Is PartDocument Then
For Each oEdge In oOcc.Definition.SurfaceBodies.Item(1).Edges
If oEdge Is oSelectedEdge.NativeObject Then
Dim oEdgeProxy As EdgeProxy
Call oOcc.CreateGeometryProxy(oEdge, oEdgeProxy)
Call oAsmDoc.SelectSet.Select(oEdgeProxy)
End If
Next
End If
Next
End Sub