How to check if a body overlap/touch another body ?

How to check if a body overlap/touch another body ?

Le_Bear
Collaborator Collaborator
1,228 Views
2 Replies
Message 1 of 3

How to check if a body overlap/touch another body ?

Le_Bear
Collaborator
Collaborator

I posted a couple of weeks ago a script that does not work reliably: Traverse Bodies for Join Feature. Inconsistent results. - Autodesk Community - Fusion 360
Took me a while to understand the reason: the order in which the bodies are collected into the list may lead to combining them in a way where some are not touching the body I combine them with.

So, the question becomes: how do I test if a body touches/overlap another one, in order to avoid creating errors when they don't? 

Bernard Grosperrin

Autodesk Certified Instructor

FaceBook Group | Forum | YouTube

Group Network Leader
 
0 Likes
Accepted solutions (1)
1,229 Views
2 Replies
Replies (2)
Message 2 of 3

BrianEkins
Mentor
Mentor
Accepted solution

You can use the TemporaryBRep capabilities to try and do a Boolean operation between the two bodies.  I would try unioning them and then check to see if the result has 1 or 2 lumps.  If there are two, then they didn't intersect.  Before doing a Boolean operation, you can do a quick check to see if their bounding boxes overlap.  If they don't, then you know the bodies don't overlap.  If they do, then you can do the Boolean operation to see if they overlap.

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

Le_Bear
Collaborator
Collaborator

Thank you, sounds like it should work. Will try very soon.

 

Bernard Grosperrin

Autodesk Certified Instructor

FaceBook Group | Forum | YouTube

Group Network Leader
 
0 Likes