584,802 active members*
4,675 visitors online*
Register for free
Login
IndustryArena Forum > MetalWorking Machines > Haas Machines > Haas Mills > Trying to cut o-ring grooves using a subprogram.
Page 1 of 2 12
Results 1 to 20 of 24
  1. #1
    Join Date
    Oct 2017
    Posts
    9

    Trying to cut o-ring grooves using a subprogram.

    Making O-ring groves in different part locations G54-G59 and trying to loop that cut to get to my desired depths. So I thought that I could write a sub program to accomplish that and just give it a new part location every time I ran a new o-ring groove. The program will loop a full circle to the start point then give an invalid I,J or K in G02 or G03. Can someone take a look at this and give me some hints? I have a HAAS TM2P.

    T15 M06
    G90 G154 P17 G00 X-10.32 Y0.
    S3000 M03
    G43 H15 Z1.0 M08
    G01 Z0. F1000.
    M97 P23456 L8
    G00 Z1.0
    G28 G49 Z0.
    G54X0 Y0
    M30

    N23456
    G91 Z-.170 F100.
    G90
    G02 X-10.32 Y0. I0. J0. F125.
    M99

  2. #2
    Join Date
    Mar 2008
    Posts
    638

    Re: Trying to cut o-ring grooves using a subprogram.

    You're specifying an Absolute X dim in the G2 line. Are all the O-ring groves in line? If not, change it to incremental is my guess.

  3. #3
    Join Date
    Oct 2017
    Posts
    9

    Re: Trying to cut o-ring grooves using a subprogram.

    So I'm using a different part location for each of the 6 parts using say....G54 for one and G52 for the next G53 ....and so on. So if I can get it to run without an error in the first location I should be good for the others just by changing the part location. Right?

  4. #4
    Join Date
    Mar 2008
    Posts
    638

    Re: Trying to cut o-ring grooves using a subprogram.

    A few thing weird to me. I'd dump the
    "G28 G49 Z0.
    G54X0 Y0"

    Go with G53 Y0 Z0

    Not sure why you were going back to G54...

    As far as the locations, if they are equally spaced keep it in Incremental. If not, then specify the locations and call up the Sub after each location is my recommendation

  5. #5
    Join Date
    Apr 2008
    Posts
    24

    Re: Trying to cut o-ring grooves using a subprogram.

    The easiest way is to run your G02 as relative coordinate as well. Actually, for what you want to do, the ENTIRE sub should be written in G91. See below example.

    N23456
    G91
    Z-.170 F100.
    G02 X0 Y0 I10.32 F125.
    G90
    M99

    G02 in this case will draw a full circle, and come back where it started. However the center of the circle will be 10.32(mm?) to the right of where the tool started moving.



    Wallace

  6. #6
    Join Date
    Jan 2005
    Posts
    15362

    Re: Trying to cut o-ring grooves using a subprogram.

    Quote Originally Posted by Geo55 View Post
    So I'm using a different part location for each of the 6 parts using say....G54 for one and G52 for the next G53 ....and so on. So if I can get it to run without an error in the first location I should be good for the others just by changing the part location. Right?
    Just use the same program with an X--- Y---- move to each location, why make it complicated for no reason, looks like a crash the way it is programed, a G91 has no place in a program like this, what's the G154 and the P17 for G49 should not be there also

    Give me the dimensions, and the tool size, and the spacing and I will do you a quick program
    Mactec54

  7. #7
    Join Date
    Apr 2008
    Posts
    24

    Re: Trying to cut o-ring grooves using a subprogram.

    Quote Originally Posted by extanker59 View Post
    You're specifying an Absolute X dim in the G2 line. Are all the O-ring groves in line? If not, change it to incremental is my guess.
    I second this!!

    Also, we usually ramp into the part instead of plunge, so if I were to write this, the sub will look like this:


    N23456
    G02 X0 Y0 I10.32 Z-0.170 F125
    M99

    and then I would add 2 lines after each time the sub is called to finish and ramp-out the groove:

    G00 X1 Y2 (Move tool to starting point)

    G00 Z0.1 (Move tool to just above part)
    G91 (specify increment mode)
    M97 P23456 L8 (loop program 8 times)
    G02 X0 Y0 I10.32 F125 (run another circle without changing Z, so it bottom of the groove is flat)
    G02 X0 Y0 I10.32 Z1.46 (run yet another circle to ramp out of the groove - optional but it eliminates any chance the cutting tool make a tiny verticle slot in the groove due to tool deflection)
    G90 (go back to absolute mode)

    Copy-past the above (and only change the first X/Y value) for each groove. Also, I am not familiar with HASS, but if it can do nested program, you can put all the above in another sub so the copy-paste will only be two lines:

    ##################################################

    G00 X10 Y20 (Move tool to 1st groove starting point)
    M97 P34567 L1

    G00 X2 Y20 (Move tool to 2nd groove starting point)
    M97 P34567 L1

    G00 X30 Y20 (Move tool to 3rd groove starting point)
    M97 P34567 L1

    G00 X40 Y20 (Move tool to 4th groove starting point)
    M97 P34567 L1

    (Repeat as needed)

    M30



    N34567 (Sub #1 for the clean-up moves on each groove)
    G00 Z0.1 (Move tool to just above part)
    G91 (specify increment mode)
    M97 P23456 L8 (Call the 2nd sub to loop program 8 times)
    G02 X0 Y0 I10.32 F125 (run another circle without changing Z, so it bottom of the groove is flat)
    G02 X0 Y0 I10.32 Z1.46 (run yet another circle to ramp out of the groove - optional but it eliminates any chance the cutting tool make a tiny verticle slot in the groove due to tool deflection)
    G90 (go back to absolute mode)
    G00 Z1 (Move tool to safe Z)
    M99



    N23456
    G02 X0 Y0 I10.32 Z-0.170 F125
    M99

    Obviously keep your initial setup lines, tool change, coolant, etc. in there.




    Wallace

  8. #8
    Join Date
    Oct 2017
    Posts
    9

    Re: Trying to cut o-ring grooves using a subprogram.

    Thanks guys, I'm rather new to this (Newbie) and not trying to get to confused. I agree to the ramping of the part instead of the plunge. I am using a 2.38 mm ball nose and the radius of the groove is the 10.32. and I need the total depth to be 1.38. The parts are 30 mm apart in the x axis. I will have to digest the program that you posted Wallace. Little confusing at this stage. However I did use the exact same thing when cutting the 6, 22mm hex shapes it looped several times dropping each time. the moving to the next "G" location and repeating.

  9. #9
    Join Date
    Oct 2017
    Posts
    9

    Re: Trying to cut o-ring grooves using a subprogram.

    Sorry, when I say the exact same thing I mean My original Program.

  10. #10
    Join Date
    Oct 2017
    Posts
    9

    Re: Trying to cut o-ring grooves using a subprogram.

    The G154 P17 is a part location. It is one of the 100 or so additional part locations that Haas uses. G154 P17, G154 P18, G154 P19, G154 P20, G154 P21, G154 P22 and so on.

  11. #11
    Join Date
    Jan 2005
    Posts
    15362

    Re: Trying to cut o-ring grooves using a subprogram.

    Quote Originally Posted by Geo55 View Post
    The G154 P17 is a part location. It is one of the 100 or so additional part locations that Haas uses. G154 P17, G154 P18, G154 P19, G154 P20, G154 P21, G154 P22 and so on.
    I new what they where for, I have a few Haas machines, just did not know why you needed them when you only had 6 positions G54 to G59 is all that is needed, or a single G54 with X and Y moves as I said in the first post
    Mactec54

  12. #12
    Join Date
    Apr 2008
    Posts
    24

    Re: Trying to cut o-ring grooves using a subprogram.

    Quote Originally Posted by Geo55 View Post
    Thanks guys, I'm rather new to this (Newbie) and not trying to get to confused. I agree to the ramping of the part instead of the plunge. I am using a 2.38 mm ball nose and the radius of the groove is the 10.32. and I need the total depth to be 1.38. The parts are 30 mm apart in the x axis. I will have to digest the program that you posted Wallace. Little confusing at this stage. However I did use the exact same thing when cutting the 6, 22mm hex shapes it looped several times dropping each time. the moving to the next "G" location and repeating.
    I am a total newbie as well, but I have done a lot of computer programming in the past so G-code (and sub-routine) is cake.

    Given the simplicity of the task, I don't think you need to worry about G54 parts-location. In fact, if the o-ring distance is the same, you can even save more time by this:

    ##################################################

    (Setup Steps)
    G90 Absolute coordinate mode
    T15 M06 (Tool change to Tool#15)
    G00 Z10 (Move to safe Z)
    M08 (coolant on)
    S3000 M03 (spindle start 3000 rpm)

    (Setup your position to start the 6 grooves)
    G00 X123 Y456 (Move to first groove. Replace 123/456 with the ACTUAL coordinate of the TOP of your left-most groove)

    (Cut those 6 grooves)
    M97 P20000 L6 (call Sub routine 20000 and repeat 6 times)

    M30 (program ends - should stop spindle and coolant automatically, if not specify M-code prior)

    ==================================================

    N20000 (Main routine)
    G00 Z1 (Move tool close to part)
    G01 Z0.02 F50 (Move tool to just above part - if your measurement/machine is dead accurate, you can G00/rapid to it)
    G91 (specify incremental mode)

    (This part is the actual chip making)
    M97 P21000 L7 (Call the 2nd sub to loop program 7 times. i.e. Circular interpolate from Z0.02, 0.2mm each time, and repeat 7 times - which should give you final Z height being -1.38 (0.02-(0.2*7)=-1.38). Note, This is assuming the surface of your part is Z0.)
    G02 X0 Y0 J-10.32 F125 (run another circle without changing Z, so it bottom of the groove is flat)
    G02 X0 Y0 J-10.32 Z1.38 F125 (run yet another circle to ramp out of the groove - optional but it eliminates any chance the cutting tool make a tiny vertical slot in the groove due to tool deflection)

    G00 Z10 (Move tool to safe Z)
    G00 X30 (Move 30mm to the next groove)
    G90 (Go back to absolute mode)
    M99

    ==================================================

    N21000 (2nd routine)
    G02 X0 Y0 J-10.32 Z-0.2 F125 (circular interpolation, where end-point is the SAME as start point (hence both X/Y = 0 as you are in G91). Center of circle, J, is -10.32 from the starting point. Also Z will ramp down 0.2mm each time.)
    M99

    ##################################################

    The only catch with this, is that your tool will move 30mm again after the last groove is cut. If it will ramp into other stuff, or reach your travel limit (I doubt it), then you can't use it this way. Also I am assuming the surface of the part is Z=0, if not obviously make adjustments. Hope this helps!



    Wallace

  13. #13
    Join Date
    Jan 2005
    Posts
    15362

    Re: Trying to cut o-ring grooves using a subprogram.

    Quote Originally Posted by Geo55 View Post
    Thanks guys, I'm rather new to this (Newbie) and not trying to get to confused. I agree to the ramping of the part instead of the plunge. I am using a 2.38 mm ball nose and the radius of the groove is the 10.32. and I need the total depth to be 1.38. The parts are 30 mm apart in the x axis. I will have to digest the program that you posted Wallace. Little confusing at this stage. However I did use the exact same thing when cutting the 6, 22mm hex shapes it looped several times dropping each time. the moving to the next "G" location and repeating.
    So is the cutter Tool 2.38, 3/32 on the inside of the radius, outside of the radius, or on the center line of the radius
    Mactec54

  14. #14
    Join Date
    Jan 2005
    Posts
    15362

    Re: Trying to cut o-ring grooves using a subprogram.

    Quote Originally Posted by WallaceLau View Post
    I am a total newbie as well, but I have done a lot of computer programming in the past so G-code (and sub-routine) is cake.

    Given the simplicity of the task, I don't think you need to worry about G54 parts-location. In fact, if the o-ring distance is the same, you can even save more time by this:

    ##################################################

    (Setup Steps)
    G90 Absolute coordinate mode
    T15 M06 (Tool change to Tool#15)
    G00 Z10 (Move to safe Z)
    M08 (coolant on)
    S3000 M03 (spindle start 3000 rpm)

    (Setup your position to start the 6 grooves)
    G00 X123 Y456 (Move to first groove. Replace 123/456 with the ACTUAL coordinate of the TOP of your left-most groove)

    (Cut those 6 grooves)
    M97 P20000 L6 (call Sub routine 20000 and repeat 6 times)

    M30 (program ends - should stop spindle and coolant automatically, if not specify M-code prior)

    ==================================================

    N20000 (Main routine)
    G00 Z1 (Move tool close to part)
    G01 Z0.02 F50 (Move tool to just above part - if your measurement/machine is dead accurate, you can G00/rapid to it)
    G91 (specify incremental mode)

    (This part is the actual chip making)
    M97 P21000 L7 (Call the 2nd sub to loop program 7 times. i.e. Circular interpolate from Z0.02, 0.2mm each time, and repeat 7 times - which should give you final Z height being -1.38 (0.02-(0.2*7)=-1.38). Note, This is assuming the surface of your part is Z0.)
    G02 X0 Y0 J-10.32 F125 (run another circle without changing Z, so it bottom of the groove is flat)
    G02 X0 Y0 J-10.32 Z1.38 F125 (run yet another circle to ramp out of the groove - optional but it eliminates any chance the cutting tool make a tiny vertical slot in the groove due to tool deflection)

    G00 Z10 (Move tool to safe Z)
    G00 X30 (Move 30mm to the next groove)
    G90 (Go back to absolute mode)
    M99

    ==================================================

    N21000 (2nd routine)
    G02 X0 Y0 J-10.32 Z-0.2 F125 (circular interpolation, where end-point is the SAME as start point (hence both X/Y = 0 as you are in G91). Center of circle, J, is -10.32 from the starting point. Also Z will ramp down 0.2mm each time.)
    M99

    ##################################################

    The only catch with this, is that your tool will move 30mm again after the last groove is cut. If it will ramp into other stuff, or reach your travel limit (I doubt it), then you can't use it this way. Also I am assuming the surface of the part is Z=0, if not obviously make adjustments. Hope this helps!



    Wallace
    Nobody that knows how to program uses G91 anymore, it happens for caned cycles and some threading cycles, but should not be used for normal programing, even cam software companies that used to give users an option to use it, have now removed it from there software
    Mactec54

  15. #15
    Join Date
    Apr 2005
    Posts
    713

    Re: Trying to cut o-ring grooves using a subprogram.

    You are making this way more complicated than it needs to be.

    G54 M97 P10
    G55 M97 P10
    G56 M97 P10
    (etc.)

    N10 M6 T1
    G43 H1
    (machine groove)
    M99

  16. #16
    Join Date
    Apr 2008
    Posts
    24

    Re: Trying to cut o-ring grooves using a subprogram.

    Quote Originally Posted by mactec54 View Post
    Nobody that knows how to program uses G91 anymore, it happens for caned cycles and some threading cycles, but should not be used for normal programing, even cam software companies that used to give users an option to use it, have now removed it from there software
    I assume there are inherent risks of using G91? Not trying to hijack the threat, as I have much to learn myself and I do want to do things the "right way". Perhaps it is wrong for me to offer a solution that I am not qualify for, and for that I apologize.



    Wallace

  17. #17
    Join Date
    Jan 2005
    Posts
    15362

    Re: Trying to cut o-ring grooves using a subprogram.

    Quote Originally Posted by WallaceLau View Post
    I assume there are inherent risks of using G91? Not trying to hijack the threat, as I have much to learn myself and I do want to do things the "right way". Perhaps it is wrong for me to offer a solution that I am not qualify for, and for that I apologize.



    Wallace
    Nothing to apologize for, anyone can use what they feel comfortable with, there are a lot of people that still use G91, mostly when hand writing short programs, and what they are used to using, the main risks are when it is not canceled before an absolute move, which can really make for a bad day
    Mactec54

  18. #18
    Join Date
    Mar 2008
    Posts
    638

    Re: Trying to cut o-ring grooves using a subprogram.

    Quote Originally Posted by mactec54 View Post
    there are a lot of people that still use G91, mostly when hand writing short programs, and what they are used to using, the main risks are when it is not canceled before an absolute move, which can really make for a bad day
    That's right. I programmed by hand for 12 years and would use it as a "canned cycle" all the time to reduce the code length. Using CAM now so I almost never see it unless I want to do something that I can't figure out how to get the CAM to do it.

    And mactec54 is right about the risk. Cancel G91 and go back to G90 after you're done!

    matt@RFR is right too about the complexity but I'm not a fan of going home after each groove. It would simplify everything though.

  19. #19
    Join Date
    Jan 2005
    Posts
    15362

    Re: Trying to cut o-ring grooves using a subprogram.

    Geo55

    Here is a program for you to try, this will cut the same as what you have, but is in inch, my metric post needs some work

    X0. Y0. is the center of the first Oring, set you Tool 2.38 Ball Endmill to the top of your work and you will cut 6 Orings Groves at 30mm centers

    Don't be surprised if you don't see the whole program in the control, half will stay in the program page this is normal, but will show up once you start cutting, or you can select it and look at it, so you will see main 3434 and sub 3435 in the program page

    This ramps all the way to the bottom of the Grove with 3 passes, each pass being around .030"

    %
    O3434( 6 Oring Groves at 30mm Centers)
    N1G20G17G40G80
    T15M6 (2.38 Ball End Mill)
    M8
    G54
    S3000M3
    G90G0X-.2997Y.3399
    G43Z.1H15
    M98P3435L6
    G92X5.6211
    G0Z3.
    M9
    M5
    G53X-8.Y0.
    M30
    O3435
    G90G0X-.2997Y.3399
    G1Z0.F20.
    G2Z-.0181I.2997J-.3399F4.
    Z-.0362I.2997J-.3399
    Z-.0543I.2997J-.3399
    I.2997J-.3399
    X-.2844Y.3528I.2997J-.3399
    G0Z.1
    G92X-1.4655
    M99
    %
    Mactec54

  20. #20
    Join Date
    Mar 2010
    Posts
    84

    Re: Trying to cut o-ring grooves using a subprogram.

    I cut o-ring grooves in some parts just yesterday. I use a macro routine to ramp in to depth. For what you are doing, how I would program it would be something like this:


    T15m6
    g90g54g0x-10.32y0.
    s3000m3
    m8
    g43h15z1.

    m97p123

    g55
    m97p123

    g56
    m97p123

    g57
    m97p123

    g58
    m97p123

    g59
    m97p123

    g0z1.m9

    g90g53y0.z0.m5
    m30

    n123
    g0z.5
    g1z0.f100.

    #1=0.(Starting depth)
    #2=.17(Z cut per lap)
    #3=-1.38(Final depth)
    while[#1gt#3]do1
    #1=[#1-#2]
    if[#1le#3]then #1=#3

    g2x-10.32i10.32z#1f125.
    end1

    g2x-10.32i10.32(To make bottom of groove flat)

    g0z1.
    m99

    By using a macro, if you want to change the depth of cut per lap, you simply change one variable value. Since you are a newbie, this method may be more complicated than you want to tackle at this point. If you learn macros at some point, you will find that they can make jobs like you are doing much simpler.

Page 1 of 2 12

Similar Threads

  1. Specifying V-Grooves
    By elfrench in forum Uncategorised CAD Discussion
    Replies: 3
    Last Post: 08-10-2013, 09:45 AM
  2. V Grooves!
    By granth3 in forum CNC Tooling
    Replies: 1
    Last Post: 10-18-2011, 10:19 PM
  3. What are Z grooves?
    By rezcar in forum Benchtop Machines
    Replies: 8
    Last Post: 12-12-2009, 08:13 AM
  4. Oil Grooves
    By gmilosevic in forum Want To Buy...Need help!
    Replies: 4
    Last Post: 02-24-2008, 12:03 PM
  5. Grooves MCX
    By jorgehrr in forum Mastercam
    Replies: 2
    Last Post: 04-18-2007, 09:58 PM

Tags for this Thread

Posting Permissions

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