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: 

Performing inspection (distance measurement) with API

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
kent.vandervelden
930 Views, 3 Replies

Performing inspection (distance measurement) with API

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

3 REPLIES 3
Message 2 of 4
ekinsb
in reply to: kent.vandervelden

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
in reply to: ekinsb

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
Jellej
in reply to: wh6Q9NU

That helps, thank you!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report