Find componentoccurence from selected edge or face

Find componentoccurence from selected edge or face

Anonymous
Not applicable
631 Views
3 Replies
Message 1 of 4

Find componentoccurence from selected edge or face

Anonymous
Not applicable

Hi,

 

I'm trying to find the ComponentOccurrence in an assembly from a selected edge or face of a Part

 

Snipset of the code:

 

Dim oPartCompDef As Inventor.PartComponentDefinition = oFace.Parent.ComponentDefinition

                                                                                        'or oEdge.Parent.ComponentDefinition
Dim oDoc As Inventor.Document = oPartCompDef.Document
Dim oOcc As Inventor.ComponentOccurrence = ..........?

 

Geert

0 Likes
Accepted solutions (1)
632 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

I could find it by query the ComponentOccurrences of the assembly by:

 

Dim oOcc As Inventor.ComponentOccurrence = Nothing
For Each oOcc In oAsmCompDef.Occurrences
     If oOcc.Definition Is oPartCompDef Then Exit For
Next

 

Is there a direct solution without Quering?

 

Geert

0 Likes
Message 3 of 4

xiaodong_liang
Autodesk Support
Autodesk Support
Accepted solution

Hi,

 

The selected edge in assembly context is proxy edge.   EdgeProxy.ContainingOccurrence  returns the ComponentOccurrence that the native object is being referenced through

 

 

0 Likes
Message 4 of 4

Anonymous
Not applicable

Hi,

I overlooked this one!

Thanks,

Geert

0 Likes