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.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Approximate Ellipse from Sketch Lines

Message 1 of 3
199 Views, 2 Replies

Approximate Ellipse from Sketch Lines

Hi! I've been using a script to create a series of sketch lines that represent an ellipse-like cross section of a body. Just wondering if there is any easy(ish) way to create an ellipse approximation from a series of lines (or points) like this? The lines all lie on a 2D plane. I've tried writing a basic approximation algorithm myself but it's very rudimentary and inaccurate... I've looked online as well, but the mathematical methods I've found are a bit beyond me. Any help would be appreciated!

Message 2 of 3
in reply to: cailanstm

There's nothing in the API that would help with this.  What you're already doing with calculating the ellipse on your own is the only solution I'm aware of.  I haven't done anything like you're doing but just thinking about it now I think the approach I would take is:


  1. Get the end points of the lines.
  2. Find the two points that are the furthest away from each other and use those at the major axis.
  3. Find a point on each side of the major axis line that is the furthest from the axis and use those to define the minor axis.

It will depend on what your input data looks like as to how successful this is.  If there are any points that deviate outside of the desired ellipse by much they would mess up this approach. 

Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 3 of 3
in reply to: ekinsb

Thanks for the reply! Funnily enough, the process you described is almost exactly what I currently have implemented 🙂 I guess I'll just have to keep refining it based on the type of data I am using as input... Thanks for the help!

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