586,471 active members*
3,736 visitors online*
Register for free
Login
IndustryArena Forum > Machine Controllers Software and Solutions > Fanuc > Helical mill and threading sub program
Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2007
    Posts
    14

    Post Helical mill and threading sub program

    Hello!
    I'm having trouble with my helical mill and thread mill macro.

    For counter clockwise (climb) milling, D has to be positive, and it is used for hole milling.
    For clockwise (conventional) milling, D has to be negative, and it is used for thread milling.

    If Q is positive, tool makes one final cicrular pass at constant Z to level the botom of the hole.
    If Q is negative, tool stops at final depth, and moves to center of hole.

    Controller is FANUC 18i-MB and I'm calling this function using G13.
    ie. G13 X50 Y25 Z-40 R2 Q1,5 D30 F300
    or it it is thread
    G13 X50 Y25 Z-40 R2 Q-1,5 D-30 F300

    Here is the code:

    %
    ( HELIX MACRO)
    ( #24 - X - X CENTER OF BORE )
    ( #25 - Y - Y CENTER OF BORE )
    ( #7 - D - DIAMETER )
    ( #18 - R - STARTING DEPTH - RETRACT )
    ( #26 - Z - FINAL DEPTH )
    ( #17 - Q - STEP PER TURN )
    ( #9 - F - FEED )
    #14 = #7 / 2 ( RADIUS )
    #15 = #24 - #14 (X OFFSET)
    #2 = 0
    IF [#17 LT 0] THEN #2 = 1 ( IS IT THREAD )
    #17 = ABS[#17]
    #21 = ABS[#26]
    #21 = #21 + #18 ( U - TOTAL DEPTH )
    ( 20 = T - TEMP )
    #20 = #21 / #17 ( NUMBER OF FULL CIRCLE PASSES )
    #20 = FIX[#20]

    #6 = #20 * #17 ( K - DEPTH OF FINAL NON FULL CIRCLE PASS )
    #6 = #21 - #6

    #1 = #6 / #17
    #1 = 360 * #1 ( A - ALPHA - REST OF ANGLE )
    #1 = #1 + 180
    IF [#3 GT 360] THEN #1 = #1 - 360
    IF [#7 LT 0] THEN #1 = 360 - #1

    #22 = #24 + [#14 * COS[#1]] (V - FINAL X)
    #22 = FIX[#22 * 1000] /1000
    #19 = #25 + [#14 * SIN[#1]] (S - FINAL Y)
    #19 = FIX[#19 * 1000] /1000

    #10 = 3 ( USED FOR G3 )
    IF [#7 LT 0] THEN #10 = 2 ( IF Q IS LESS THEN 0 THEN G2)
    #12 = 44 - #10 ( G41 OR G42 )
    #23 = #18 - #17 ( FIRST DEPTH )

    G0 G90 X#24 Y#25 ( MOVE TO CENTER POSITION )
    Z#18 ( MOVE TO STARTING DEPTH, R )

    G1 G#12 X#15 D#1035 F#9 ( MAKE TOOL OFFSET COMPENSATION, D#1035 IS TOOL NUMBER LOCATED IN SPINDLE ) <---- HERE IS THE PROBLEM
    N1 G#10 X#15 Y#25 Z#23 I#14 J0 ( FULL CIRCLE )
    #23 = #23 - #17 ( LOWER Z ONE STEP )
    IF [#23LT#26] GOTO998 ( IF DEPTH IS LESS THAN FINAL DEPTH, GO TO 998 )
    GOTO1 ( RETURN TO N1 IF DEPTH ISN'T LESS THEN FINAL DEPTH )
    N998 IF [#2 EQ 0] GOTO999 ( IF IT IS NOT A THREAD, GO TO 999 )
    G#10 X#22 Y#19 Z#26 I#14 ( MAKE FINAL RADIUS IF IT IS THREAD )
    GOTO1000 ( SKIP LEVELING )
    N999 G#10 Z#26 I#14
    G#10 I#14 J0 ( MAKE ONE FINAL PASS TO LEVEL THE BOTTOM )
    N1000 G1 G40 X#24 Y#25 ( RETURN TO CENTER )
    Z#18 ( RETURN TO STARTING POSITION )
    M99
    %

    My problem is that when machine is making tool radius compensation, it moves in both X and Y axis, and not only in X.
    I know there is a "PROGRAMMER STUPIDITY ERROR" but I just can't put my finger on what am I doing wrong.
    Help???

  2. #2
    Join Date
    Aug 2011
    Posts
    2517

    Re: Helical mill and threading sub program

    the next movement after that line is a circle and the tool needs to move in both X and Y to position the cutter correctly for the G3.
    Before the G3 line use a G1 to feed to a point and it will move in only one axis.
    Another way to do it is not use G41/G42 and calc the positions (plus or minus the tool radius) using the macro.

  3. #3
    Join Date
    Sep 2010
    Posts
    1230

    Re: Helical mill and threading sub program

    Quote Originally Posted by fordav11 View Post
    the next movement after that line is a circle and the tool needs to move in both X and Y to position the cutter correctly for the G3.
    Before the G3 line use a G1 to feed to a point and it will move in only one axis.
    Another way to do it is not use G41/G42 and calc the positions (plus or minus the tool radius) using the macro.
    Hello Ford,

    I agree that calculating the Tool Radius Comp in the Macro is another and probably better method within a Macro Program, but I don't think the G03 Block following the Tool Radius Comp Start block is the issue. Following is the OP's positioning and first helical move translated into numerical values.

    Using positive D and Q arguments as in the next Block
    G13 X50 Y25 Z-40 R2 Q1,5 D30 F300

    the values of the variables will be as follows shown in Blue
    G0 G90 X#24 Y#25 ( MOVE TO CENTER POSITION )
    G0 G90 X50.0 Y25.0
    Z2.0 ( MOVE TO STARTING DEPTH, R )
    G1 G#12 X#15 D#1035 F#9 ( MAKE TOOL OFFSET COMPENSATION, D#1035 IS TOOL NUMBER LOCATED IN SPINDLE ) <---- HERE IS THE PROBLEM
    G1 G41 X35.0 D#1035 F300 (Y would be Modal at 25.0)
    N1 G#10 X#15 Y#25 Z#23 I#14 J0 ( FULL CIRCLE )
    N1 G3 X35.0 Y25.0 Z0.5 I15.0 J0 ( FULL CIRCLE )

    In the above,
    1. the tool is positioning at X50.0 Y25.0
    2. the tool is moving to X35.0 Y25.0 to apply Left Tool Radius Compenstaion (along one axis to be tangent with the circle on the inside)
    3. helical interpolates from X35.0 Y25.0 to X35.0 Y25.0 (Full Circle)

    Starting Tool Radius comp from the centre of the circle along one axis shouldn't result in a two axis move if the next move is a circular move. However, I've seen it once before occur as the OP describes, on a Fadal machining centre with a Fanuc 18i control when using a 90deg arc to ramp onto the surface of a feature. In this case the Tool Radius Comp was started on a G01 Block immediately before the circular move to ramp onto the workpiece surface, a very common method used so as not to leave a noticeable mark at the Entry/Exit point when starting and finishing at the same point. My opinion on the day was that it was a parameter setting, but as time was of the essence, I never investigated further to find out why.

    Regards,

    Bill

  4. #4
    Join Date
    Aug 2011
    Posts
    2517

    Re: Helical mill and threading sub program

    the whole thing seems over-complicated anyway. Like #10 is fixed at 3 but then he uses G#10. this is always going to be G3. yes I realise if #10=2 then it will be G2 and G42 but it's not saving much time to change a couple of G3's to G2 and G41 to G42 if he wanted to reverse the direction (but with thread milling that is not possible anyway). it just makes it harder to read than it needs to be.
    I agree it's probably a parameter thing.
    anyway there is a free program supplied by one of the thread mill tool manufacturers that will write a proper thread milling program using helical interpolation taking into consideration the tool radius and he should probably just use that since it's proven to work and will save time in the long run.

  5. #5
    Join Date
    Jan 2007
    Posts
    14

    Re: Helical mill and threading sub program

    Whole point of this is to simplify thread and helical milling for the operator. It is called from program similar as drill cycle.
    But main function of this is if you need to make correction in depth while milling thread, this sub program will follow same path no matter what final Z is defined as long as you don't change R.
    And helical milling... If I already have helical interpolation, why not use it for helical milling.

  6. #6
    Join Date
    Jan 2007
    Posts
    14

    Re: Helical mill and threading sub program

    First of all, Happy New Year!

    I have found the problem in my program. And yes, it was "programmer stupidity error".
    As I was testing program, I haven't finish cycle in machine. So it did not turn off tool radius compensation. And that was result of moving in both axis instead of one.
    I've just added G40 before first X Y movement.

Similar Threads

  1. Helical interpolation/threading
    By Wyrks Tool in forum Fanuc
    Replies: 1
    Last Post: 01-25-2013, 05:31 PM
  2. parametric program for spiral helical interpolation
    By Bastida in forum Parametric Programing
    Replies: 25
    Last Post: 12-31-2011, 02:59 AM
  3. Replies: 1
    Last Post: 02-19-2010, 08:29 PM
  4. Replies: 6
    Last Post: 08-22-2006, 02:47 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
  •