Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Does anyone know the formula (s) used for making a PEllipse?

50 REPLIES 50
SOLVED
Reply
Message 1 of 51
norm77
3010 Views, 50 Replies

Does anyone know the formula (s) used for making a PEllipse?

Hello,

  I write programs for large CNC routers, and I'm trying to make a parametric program that uses an ellipse in it.  I need to know the formula or formulas used to produce the arcs that make up a pellipse so that I can get the radii, and end points of each arc.  Any help would be greatly appreciated, Thanks.

 

-Norm

50 REPLIES 50
Message 21 of 51
hayalexj
in reply to: norm77

Given three points on any arc you can easily calculate the radius and centre point of that arc; this could be done in an Excel cell without any trouble; so more detail and various options here: https://nrich.maths.org/discus/messages/67613/68169.html?1137605065

 

That aside; what leads you to think that you can draw anything close to and ellipse using 16 arcs? Just try drawing four arcs over an elliptical arc quadrant in cad and see how far off they are!

Message 22 of 51
johnds
in reply to: norm77

Wow, that seems like a lot of work! So you cant even send the cnc machine a file with basic geometry to do it's work.

 

So to mimic an ellipse you either have to break it down into your 16 arc version, or use lots of lines which 'approximate' the elliptical curve, or nothin at all.

 

Hayalexj is right, trying to rebuild an ellipse using just arcs does not actually give you the same elliptical curve, but maybe for your purposes that is close enough?

 

The only other option, which would guarantee the 'best' fit would be to spilt the ellipse into many 'facets', and the more factes, the closer you will get to the elliptical curve. But then you have to sit there in front of the cnc machine punching in millions of numbers, which will be very error prone.

 

Tough one.

 

J.

Message 23 of 51
hayalexj
in reply to: norm77

That's the other thing that makes no sense to me; I have exported many tool paths from cad geometry to gcode and never once did it cross my mind to punch it in manually!

If you were to put enough coordinates in to exceed the resolution of your cutting machine axis then it would produce the best ellipse that your machine could do.

If you draw straight lines on a grid starting at say 10 on the y axis and 0 on x, then 9 to 2, 8 to 4 and so on the lines will form what looks like an ellipses but it's actually "fatter" than an ellipse of the same dims would be. I'm not sure what that shape called but it's not an elliptical curve.
Message 24 of 51
norm77
in reply to: hayalexj

"That's the other thing that makes no sense to me; I have exported many tool paths from cad geometry to gcode and never once did it cross my mind to punch it in manually!

 

If you were to put enough coordinates in to exceed the resolution of your cutting machine axis then it would produce the best ellipse that your machine could do.

 

If you draw straight lines on a grid starting at say 10 on the y axis and 0 on x, then 9 to 2, 8 to 4 and so on the lines will form what looks like an ellipses but it's actually "fatter" than an ellipse of the same dims would be. I'm not sure what that shape called but it's not an elliptical curve."

 

Once again...I'm looking for formulas so that I can make a Parametric program.  I could use my CADCAM if I wanted to draw it up and export a program every time...

 

"That aside; what leads you to think that you can draw anything close to and ellipse using 16 arcs? Just try drawing four arcs over an elliptical arc quadrant in cad and see how far off they are!"

 

Having a true ellipse is not my requirement.  I'm trying to find formulas to replicate a Pellipse!!!  A Pellipse has 4 arcs per quadrant, and isn't that far off from a true ellipse (I measured just over a millimeter maximum difference on a 500x300 ellipse), and it won't cause someone to look at a Pellipse and exclame "OH NO! THAT'S NOT A TRUE ELLIPSE!".

 

All the arcs in a Pellipse flow into one another smoothly (which is what I want!), and using a Spline or series of small lines is unacceptable for a parametric program.

Message 25 of 51
hayalexj
in reply to: norm77

If you're writing a "Parametric program" then you can just use the formula for coordinates on the ellipse; and if you're doing it manually then you don't need a formula. How is it that you have all the problems associated with both methods?

Message 26 of 51
norm77
in reply to: norm77

Round and round we go.....

 

1.  I write parametric programs manually.  Yes manually.

 

2.  The parametric programs are made with variables (#100=, #101=, #102= etc).  Then the gcode uses these variables;  G1X#100Y#102,  G2X#105Y#106R#110 etc.

 

3.  I use lines and arcs not ellipses or splines, (If I could; I wouldn't be here looking how to make a pellipse).

 

4.  In order to program an arc (parametric or otherwise); I need to know the start and end coordinates as well as either the center of the arc or the radius.  The mid-point unless used in a formula to find the radius or center, is useless as I cannot program start, mid, and end points to make an arc.

 

 

Message 27 of 51
hayalexj
in reply to: norm77

Fine, to do it the hard way for no good reason you calculate the eccentricity and use that to calculate the first angle, JBJC.

Message 28 of 51
thepworth
in reply to: norm77
Message 29 of 51
johnds
in reply to: thepworth

thepworth,

thats great! Good old fashioned methods. How much we rely on computers, I had completely forgotten the 4-centre ellipse taught in high school technical drawing.

 

However, it still does not, in my opinion, give away HOW autocad does the pellipse trick. I guess thats what norm wants, he doesnt want to use autocad to do it, he just wants to know how autocad does it.

 

Not sure if I missed something in the first locus example, is that the true elliptical version?

Message 30 of 51
norm77
in reply to: johnds

Johnds is correct,

 

The 4 center arc is equal to 2 arcs for each quadrant, which I wouldn't use (although it is simple),and the 5 centered arch is ok but I was hoping for 4 arcs per quadrant or the same/similar to a pellipse (looks a bit smoother).

 

-Norm

Message 31 of 51
thepworth
in reply to: norm77

My other tactic that I'm  trying (no success yet):  make an ellipse in CAD.  PLot to DWF.  Since a DWF is an ascii file (of some form, I think), and I've seen postings somewhere for DWF readers to see the background text of the file, open the DWF in such a viewer to see what exactly is stored for the ellipse in the DWF.  But, opening a DWF from notepad is just junk & my web searches for "DWF to TXT" conversion weren't successful last night.  Maybe this approach would work...

Message 32 of 51
M_Hensley
in reply to: thepworth

DXF is the ascii version of a drawing file. Use saveas command and select DXF in the file type box.

Message 33 of 51
norm77
in reply to: M_Hensley


@M_Hensley wrote:

DXF is the ascii version of a drawing file. Use saveas command and select DXF in the file type box.


 

How can I get a formula out of a dxf?

Message 34 of 51
M_Hensley
in reply to: norm77

You cant. I was replying to thepworth who wanted to study a drawing in ascii.

Message 35 of 51
thepworth
in reply to: M_Hensley

Thanks!

 

Looking at line by line in the ASCII, I don't see enough to extract the parametrics 😞

Message 36 of 51
norm77
in reply to: hayalexj


@hayalexj wrote:

Fine, to do it the hard way for no good reason you calculate the eccentricity and use that to calculate the first angle, JBJC.


I'm not trying to do anything the hard way (believe me!).  I can't program 3 point arcs (start, mid, end).  Can you show me how to calculate the radius for an arc using the start, mid, and end points?  Because, yes the trammel of archimedes can get those points (really nicely in fact), but I can't see how to get a radius (or center point) out of that information.

 

The only thing that I can think of is ((arc cord / 2) x (arc cord / 2) + (arc height x arc height)) / (arc height x 2), but the problem is that all of these calculations are on angles to start with, which then means very very complex....help!

 

In regards to the JBJC angle - the trammel of archimedes can't give that information because as shown in my picture that I posted the center is outside of the pellipse.  So I don't know how you meant for me to be able to calculate that amount, but I'm all ears.  Cat Happy

 

-Norm

Message 37 of 51
corey.downum
in reply to: norm77

I've been in the process of writing a vba program and I needed to be able to programmatically draw the arcs to approximate the ellipse the same way that autoCAD does.  I searched and searched and couldn't find anything that says how autoCAD comes up with the approximation that it does.  I found this post in my search.

 

After a lot of messing with the problem I finally figured out how autoCAD does it.  So if anyone is still interested in this I've attached a drawing file (it's a 2007 version) that shows the math and geometry behind autoCAD's pellipse =1 ellipse approximation. 

 

Hope this helps someone besides me.

Let me know if you have any questions.

 

Message 38 of 51
norm77
in reply to: corey.downum

I have tried this (just to confirm), and it works! HA!  Well done!  I now see the next step that I couldn't figure out before (circles used for P-2 and P-4).  The P-2 point can also be found from the mid point of a line created from P-7 at half the angle P-3, P-7, P-1 and extended to line P-3, P-1 (but using a 3point circle is a bit quicker).  Thanks!!

 

-Norm

Message 39 of 51
corey.downum
in reply to: thepworth

Glad I could help.

Message 40 of 51
Ry91
in reply to: corey.downum

Corey, did you ever have any luck with the VBA program?

I'm trying to produce one myself and it is proving to be very troublesome!

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

Post to forums  

Autodesk Design & Make Report

”Boost