Performing inspection (distance measurement) with API

Performing inspection (distance measurement) with API

Anonymous
Not applicable
1,324 Views
3 Replies
Message 1 of 4

Performing inspection (distance measurement) with API

Anonymous
Not applicable

Hi, in the Python API for Fusion 360, is there a way to perform inspections such as measuring the minimal distance between two components? I didn't see "measure" or "inspect" in the API reference. I've been working my way through the methods on the objects and the best I've been able to do is compare bounding boxes and center of mass. I thought maybe I could do something with the bRep and meshes of the component, e.g., compare all pairs of vertices, but those lists are empty, at least for the components I'm using for testing. Thank you

0 Likes
Accepted solutions (1)
1,325 Views
3 Replies
Replies (3)
Message 2 of 4

ekinsb
Alumni
Alumni
Accepted solution

Some general measurement type of functions are currently missing from the API and is something we plan on adding but I don't have a time frame about when they might be available.  It would be difficult to do this on your own.  You suggested getting the mesh of the part and then finding the two vertices that are the closest together and use that as the minimum distance.  I don't know why you were having trouble getting the mesh representation of a body but that should be working and I'm not aware of problems. However, even if you get a mesh of the bodies you want to measure between, the results will not necessarily be correct.  

 

Below are two examples that illustrate why this won't work.  On the left are two boxes represented by a triangle mesh.  The closest point between the two boxes is a vertex on the top box but center of the face on the lower box. On the right is a cylinder and sphere both represented by a triangle mesh.  The closest point will be on the middle of the cylinder, where there isn't a vertex.  Essentially, that approach relies on their being a vertex on both bodies at the closest point, which isn't always true.

measure2.png

 

 The API exposes the functionality that Fusion has but in a way you can incorporate that into a program rather then rely on using the UI.  I found that Fusion doesn't currently support doing any measurements with mesh bodies so providing that capability in the API may be difficult.

 

 


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

wh6Q9NU
Advocate
Advocate

Since there is a Measure Example for the API but it doesn't show up in a forum search for keyword "measure" I post this link as a reference:

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-4b13c86c-7aa0-4555-b3e3-02f7d1b01d10

Message 4 of 4

Anonymous
Not applicable

That helps, thank you!

0 Likes