585,951 active members*
3,824 visitors online*
Register for free
Login
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2014
    Posts
    19

    G32 grooving macro

    Hi all,

    I have written a macro to put an oil groove on a part using the G32 cycle. It works OK, but I am having a slight issue. The macro is as follows:

    (OIL GROOVE MACRO)
    (SET USER INPUTS BELOW)
    (REQUIRES PROVE)

    (USER INPUTS)
    #100=1.(ABSOLUTE Z START POSITION)
    #101=-26.(ABSOLUTE Z END POSITION)
    #102=25.(SPINDLE SPEED)
    #103=48.0(START DIA)
    #104=49.25(END DIA)
    #105=0.025(DEPTH OF CUT - ON RADIUS)

    (CALCULATIONS)
    #105=ABS[#105]*2(DEPTH OF CUT ALWAYS POSITIVE AND ON DIA)
    #106=ABS[#100]+ABS[#101](TOTAL CUT LENGTH PER PASS)
    #107=#106*4(CALCULATE FEED/REV)
    #108=ABS[#103-#104](CALULATE AMOUNT TO CUT)


    T0707M08(CALL TOOL AND OFFSET)
    G00G97G99S#102M03(R/MIN - FEED/REV - SET SPINDLE SPD C/W)
    X#103Z[#100+20.](RAPID TO INITIAL POSITION)
    Z#100
    WHILE[#108GT#105]DO1(SET LOOP)
    G0U#105(FIRST DEPTH OF CUT)
    G32Z#101F#107(Z PASS 1 - IN)
    Z#100(Z PASS 2 - OUT)
    Z#101(Z PASS 3 - IN)
    Z#100(Z PASS 4 - OUT)
    #108=#108-ABS[#105](UPDATE COUNTER)
    END1

    (REMAINDER)
    N1111G0U#108(LAST PASS)
    G32Z#101F#107(Z PASS 1 - IN)
    Z#100(Z PASS 2 - OUT)
    Z#101(Z PASS 3 - IN)
    Z#100(Z PASS 4 - OUT)
    G0Z20.
    X250.Z200.(SAFE POS)
    T0700(CANCEL TOOL OFFSETS)
    M05
    M01

    So basically for every revolution of the spindle, the tool moves in and out twice. The problem i'm having is on the final pass (the REMAINDER section of my macro). I don't know if it is a control issue (Fanuc series O-T), but when #108 becomes equal to #105, it should skip to the REMAINDER section of my macro (as #108 is not greater than #105). However, it does one more loop of the WHILE loop, then goes to the remainder. (It may be worth adding that after this 'extra' pass on the WHILE loop, when the counter is updated, the value returned on the control is '*********', not zero??).

    I hope this is explained well enough as this is incredibly difficult to put into words!

    Thanks in advance,

    Alex.

  2. #2
    Join Date
    Feb 2006
    Posts
    1792

    Re: G32 grooving macro

    Such things may happen due to floating point errors in calculations.
    Replace #105 by [#105+0.001] in the WHILE loop, and check if it helps.

  3. #3
    Join Date
    Jul 2010
    Posts
    118

    Re: G32 grooving macro

    Hi,
    the system counts in binary, so you always have a chance to have a 0.000000001 discrepancy either way.

    1. it is better to use GE, not GT, there is always a chance the can be equal.
    2. resolve your rounding issues with #108, INCLUDE #108=[RND[#108*1000]/1000] after the calculation.
    3. #108 duty is only useful in the while loop
    4. in the (remainder), to be sure it is better to use N1111 G0X#104 as the final pass.

    have fun

Similar Threads

  1. Replies: 2
    Last Post: 12-19-2012, 01:28 PM
  2. Replies: 3
    Last Post: 02-13-2012, 07:20 PM
  3. Replies: 2
    Last Post: 03-27-2009, 09:15 PM
  4. face grooving macro
    By turnguy in forum Community Club House
    Replies: 1
    Last Post: 10-08-2008, 03:44 PM
  5. Convert Fanuc Macro to Fadal Macro
    By bfoster59 in forum Fadal
    Replies: 1
    Last Post: 11-09-2007, 06:41 AM

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
  •