Does FindUsingRay not work at detecting work points?

Does FindUsingRay not work at detecting work points?

C_Haines_ENG
Collaborator Collaborator
231 Views
2 Replies
Message 1 of 3

Does FindUsingRay not work at detecting work points?

C_Haines_ENG
Collaborator
Collaborator

I'm trying to use FindByRay because apparently FindByPoint only works if you are graphically rendering the part (why inventor gods have you forsaken me), so I wanted to switch to using FindByRay, but it doesnt seem to pickup anything at the start point, which may make sense, but otherwise its my only save here beyond iterating through a lot.

 

Does anyone know how to find workpoints using a point location that doesnt require you to graphically render the part youre working with?

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

Michael.Navara
Advisor
Advisor
Accepted solution

Hi @C_Haines_ENG 

Methods FindByRay and FindByPoint doesn't exist in API. I assume you mean FindUsingRay and FindUsingPoint methods. I'm afraid this methods require graphical representation. Also FindUsingRay has performance issues on large assemblies.

I don't know if you want to look for work point in part or assembly and in assembly if you want to look for work points defined at assembly level only or part work points in assembly context (WorkPointProxy).

 

When the collection of work points is stable, you can scan the document and all sub-documents and store the collection of work points in your own collection ordered by work point coordinates. Later on you can look into this collection and get appropriate work point or its proxy.

 

The collection and usage may looks like this

'Definition
Dim workPoints As Dictionary(Of Point, List(Of WorkPoint))

'Usage
Dim position As Point
Dim workPointsAtPosition = workPoints(position)

Dictionary is very fast collection for searching. In this case the Point is used as key for searching and List(Of WorkPoint) is used as value. It is because you can have more than one work point at the same position and you can't put multiple values with the same key to Dictionary. You need to decide which work point at the given position is relevant for you. 

0 Likes
Message 3 of 3

C_Haines_ENG
Collaborator
Collaborator

This would be a good solution, I instead opted for FindUsingPoint in the Assembly level, I thought the part file itself had to be open, but I can reference it from the assembly file by transforming the coordinates. 

0 Likes