Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Find componentoccurence from selected edge or face

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
GVDB
510 Views, 3 Replies

Find componentoccurence from selected edge or face

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

3 REPLIES 3
Message 2 of 4
GVDB
in reply to: GVDB

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

Message 3 of 4
xiaodong_liang
in reply to: GVDB

Hi,

 

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

 

 

Message 4 of 4
GVDB
in reply to: xiaodong_liang

Hi,

I overlooked this one!

Thanks,

Geert

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report