FindUsingPoint in Sub Assembly

FindUsingPoint in Sub Assembly

C-Hoppen
Advocate Advocate
1,581 Views
2 Replies
Message 1 of 3

FindUsingPoint in Sub Assembly

C-Hoppen
Advocate
Advocate

Hello!

 

I'm using FindUsingPoint to find Assembly Occurencces

 

Inventor.SelectionFilterEnum[] filter;
filter = new Inventor.SelectionFilterEnum[1] { Inventor.SelectionFilterEnum.kAssemblyOccurrenceFilter };

Inventor.AssemblyDocument activeEditAsmDoc;
activeEditAsmDoc = (Inventor.AssemblyDocument)inventorapp.ActiveEditDocument;
Inventor.AssemblyComponentDefinition oAsmDef; oAsmDef = activeEditAsmDoc.ComponentDefinition; Inventor.ObjectsEnumerator istDaWas; istDaWas = oAsmDef.FindUsingPoint(oBias2, ref filter, suchRadius, false);

Works fine within a top level Assembly (ActiveDocument == ActiveEditDocument).

 

While in-place editing a sub assembly calling this code FindUsingPoint throws an "ArgumentException".

 

(oBias2 and suchRadius are tested)

 

Are there any known issues?

 

Thanks,

Christoph

 

 

Accepted solutions (1)
1,582 Views
2 Replies
Replies (2)
Message 2 of 3

ekinsb
Alumni
Alumni
Accepted solution

Hi Christoph,

 

There are some limitations to the FindUsingPoint and also FindUsingVector too.  Both of these use the same underlying selection functionality that Inventor uses when doing selections interactively.  This relies on the graphics being available because the initial selection is made to the graphics and then maps back to the associated entity, in this case the occurrence.  Using the graphics is much faster than using the B-Rep geometry.

 

Since you're performing the selection (FindUsingPoint) in the context of the subassembly, Inventor is checking to see if that document has a visible window and fails if it doesn't.  If you open the sub assembly document (not just in-place activate it) and then go back to the assembly and run you're program again, you'll see that the FindUsingPoint now succeeds.

 

The FindUsingRay method will work in all cases since it uses the B-Rep geometry and doesn't rely on graphics.

 


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 3 of 3

C-Hoppen
Advocate
Advocate
Thank you!

Christoph
0 Likes