Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for
Show  only  | Search instead for
Did you mean:

How to find the coordinate for a point of intersection with a mesh object

2 REPLIES 2
SOLVED
Message 1 of 3
138 Views, 2 Replies

How to find the coordinate for a point of intersection with a mesh object

Hello,

I am still fairly new to fusion 360 workflows and the API, so thank you in advance for any help or general advice you may provide.

Essentially I have designed a prototype helmet for use in fNIRS research experiments. In my script I created circle sketches perpendicular to the surface of the helmet and extruded them to create holes where fiber optic cables are going to be inserted to sit on the scalp. I have center points for those sketches and construction axes running perpendicular to the surface of the helmet.

The goal is to take a 3d scan of the person and project the points I have on the helmet down to the scalp to get the coordinates of where the fibers will be sitting on their head.

I can't find any method that will give me a point of intersection with a mesh object for use with the head scan.

Another method I tried is down sampling the mesh object and converting it to a BRep object to then project the center point along the construction axis vector to the nearest face on the converted mesh (pictured below). But for this, the problem then becomes figuring out which of the many hundreds/thousands of triangular faces to select in the code to automate the creation of the intersection point. I don't have the faintest idea of how to do that.

Is there a better way to do this? I am open to any ideas.

Thanks again!

Labels (4)
2 REPLIES 2
Message 2 of 3

I'm unaware of anything in the API that will do that. I think you will need to write the code yourself to intersect a line with a mesh. It would be a challenge, but it is possible. The real challenge would be making it performant, but I'm guessing that probably isn't that important for your case initially.

Here are a couple of things I found after a quick search.

https://stackoverflow.com/questions/42740765/intersection-between-line-and-triangle-in-3d

https://courses.cs.washington.edu/courses/cse457/09au/lectures/triangle_intersection.pdf

https://en.wikipedia.org/wiki/M%C3%B6ller%E2%80%93Trumbore_intersection_algorithm

http://www.lighthouse3d.com/tutorials/maths/ray-triangle-intersection/

Good luck 😁

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 3 of 3