586,103 active members*
2,717 visitors online*
Register for free
Login
Results 1 to 11 of 11
  1. #1
    Join Date
    Jul 2007
    Posts
    25

    macro programing

    I need to program an ellispe Iwas wondering if any one knew the formula based macro for doing this?
    thanks

  2. #2
    Join Date
    Sep 2005
    Posts
    767
    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?

  3. #3
    Join Date
    Jul 2007
    Posts
    25
    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.

  4. #4
    Join Date
    Sep 2004
    Posts
    209
    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

  5. #5
    Join Date
    Feb 2007
    Posts
    314
    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?

  6. #6
    Join Date
    May 2006
    Posts
    13
    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

  7. #7
    Join Date
    Jul 2007
    Posts
    25
    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[....]

  8. #8
    Join Date
    Jul 2007
    Posts
    25
    Andyt
    I,ll try this but it looks kinda hoaky

  9. #9
    Join Date
    Feb 2007
    Posts
    314
    Quote Originally Posted by ikneb View Post
    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?
    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?

  10. #10
    Join Date
    Jul 2007
    Posts
    25
    Thanks Samu I,ll wait for you to test it unless it will be a few days
    Ikneb

  11. #11
    Join Date
    Feb 2007
    Posts
    314

    it works

    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

Similar Threads

  1. SL-30 programing ?
    By travis1 in forum Haas Lathes
    Replies: 3
    Last Post: 07-09-2008, 03:06 PM
  2. macro programing
    By 9axis in forum G-Code Programing
    Replies: 2
    Last Post: 03-19-2008, 11:52 AM
  3. 0-M programing help please
    By venomgrrrl in forum Fanuc
    Replies: 22
    Last Post: 12-08-2007, 06:51 AM
  4. Convert Fanuc Macro to Fadal Macro
    By bfoster59 in forum Fadal
    Replies: 1
    Last Post: 11-09-2007, 06:41 AM
  5. CAM programing
    By kenlambert in forum G-Code Programing
    Replies: 1
    Last Post: 02-03-2006, 07:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •