I need to program an ellispe Iwas wondering if any one knew the formula based macro for doing this?
thanks
I need to program an ellispe Iwas wondering if any one knew the formula based macro for doing this?
thanks
An ellipse is defined as the intersection of a cone with a plane. The "tilt" of the plane is a factor, as is the angle of the cone, since they affect how much the ellipse deviates from a true circle.
Do you have any real numbers to work with? Also, do you need to cut the entire ellipse, or just a segment of it?
Are you trying to turn an ellipse on a lathe, or mill an elliptical shape in X-Y?
Im trying to mill it as part of a profile of a part.I would like to do it as a macro, so I dont have to program it again just fill in the vairables.I have a formula based ones for a sine curve and a helix.I just cant figure out the formula for an ellispe.As far as real numbers I dont have the print in front of me.
The equation for an ellipse is: (x-h)² / a² + (y-k)² / b² = 1, where
a = the radius along the x axis
b = the radius along the y axis
h = the x coordinate of the center
k = the y coordinate of the center
You'll have to isolate x or y to get the exact equation for the macro.
Chris Kirchen
I'll be happy to help you, wath i suggest, is to work with the parametric formula for an ellipse : X= a cos t
Y= b sin t
a is radius on x
b is radius on y
t is angle (think excacly like if it was a circle)
but, to keep tolerance approximatively the same all along the profile, you can't use a constant increment. I tought to use an angular increment inversely proportional to the distance from center to where you are on ellipse.
If anybody understand wath i mean, i wait for your comments and suggestions
Also, wath is your control, can you write IF[.....] then [.....] in your macro?
Try:
; Program to mill ellipse
;
; Modify the following variables as needed:
;
#101 = 0.75 ; length along X axis
#102 = 0.35 ; length along Y axis
#103 = 10.0 ; plunge feedrate
#104 = 20.0 ; cutting feedrate
#105 = 0.1 ; Z clearance height
#106 = -0.2 ; Z cut depth
#107 = 5.0 ; angle increment
#108 = -1.0 ; the X center position
#109 = 1.0 ; the Y center position
G41 D1 ; start up cutter compensation (change D number as needed)
;=================================
O9100
G1 X[#101 * cos[#110] / 2.0 + #108] Y[#102 * sin[#110] / 2.0 + #109]
#110 = #110 + #107
M99
G0 X[#101/2.0+#108] Y#109 Z#105
G1 F#103 Z#106
F#104
#110 = #107
M98 P9100 L[360.0/#107]
G0 Z#105
G40
but, to keep tolerance approximatively the same all along the profile, you can't use a constant increment. I tought to use an angular increment inversely proportional to the distance from center to where you are on ellipse.
If anybody understand wath i mean, i wait for your comments and suggestions
Also, wath is your control, can you write IF[.....] then [.....] in your macro?[/QUOTE]
Samu this seams like a good idea but I dont understand how you would get the control to not use a constant increment.
Alos I have FANUC OiMB and OiMC so I can use IF[....]THEN[....]
Andyt
I,ll try this but it looks kinda hoaky
Samu this seams like a good idea but I dont understand how you would get the control to not use a constant increment.
Alos I have FANUC OiMB and OiMC so I can use IF[....]THEN[....][/QUOTE]
here is the way to use a non-constant increment:
INC= [INC max * small radius] / sqrt [(a*cos t)^2 + (b*sin t)^2]
INC= actual increment
INC max= preset value for maximum increment
small radius= half of short axis
a= half of x axis
b=half of y axis
t=angular position on the ellipse
I wrote a macro using this formula yesterday but i don't test it. I'll post it once it will be tested, or maybe you want the prototype?
Thanks Samu I,ll wait for you to test it unless it will be a few days
Ikneb
I test my macro today and it works. But it is only for a CCW ellipse.
G65 P9014 A(a) B(b) I(i) J(j) F(f) Q(q) R(r) X(x) Y(y) W(w)
a:half X axis
b:half Y axis
i :X coordinate of center
j: Y coordinate of center
f:cutting feed
q: Maximum angular increment
r: ellipse lenght in degree
x:X coordinate of start point
y:Y coordinate of start point
w:minimum displacement
you must be on start point before calling macro
i just test it in G40
on my old O-md controller it takes a while to calculate so it results in jerky motion. I hope your controller can do better
here is the macro, if you have any question, it will be a pleasure for me to help you
%
:O9014 (ELLIPSE)
#101=#24 (x start)
#102=#25 (y start)
#103=ATAN[[#102-#5]/#2]/[[#101-#4]/#1] (angle at start)
#104=#103 (curent angle)
N5 IF [#2GT#1] GOTO 10 (determine wich axis is the long axis)
#105=[#17*#2]/SQRT[#1*#1*COS[#104]*COS[#104]+#2*#2*SIN[#104]*SIN[#104]] (calculate increment)
GOTO 15
N10 #105=[#17*#1]/SQRT[#1*#1*COS[#104]*COS[#104]+#2*#2*SIN[#104]*SIN[#104]]
N15#104=#104+#105 (refresh curent angle)
IF[#104 GE [#103+#18]] GOTO 20 (if it is the last move)
#106=COS[#104]*#1+#4 (calculate x move)
#107=SIN[#104]*#2+#5 (calculate y move)
IF[SQRT[[#106-#101]*[#106-#101]+[#107-#102]*[#107-#102]] LT #23] GOTO 5 (if move is less than minimum displacement)
G01 X#106 Y#107 F#9 (execute move)
#101=#106 (refresh curent x position)
#102=#107 (refresh curent y position)
GOTO 5
N20 #104=#103+#18 (set angle for last move)
G01 X[COS[#104]*#1+#4] Y[SIN[#104]*#2+#5] F#9 (last move)
M99