585,927 active members*
4,117 visitors online*
Register for free
Login

Thread: sub routines

Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2007
    Posts
    6

    sub routines

    can somebody give me a sub routine program or and example for a fanuc 6mb?
    [email protected]

  2. #2
    Join Date
    Nov 2005
    Posts
    219
    I am still in the learning stages of this.

    let me explain a little before you look my prg's over.

    It is for a 18-i Lathe with a subspindle. There are 3 different part prg's below that use the same sub program O9983.

    The parts are 1.25 o.d. with a .750 I.D. hole (that I drill from solid stock) with varying lenghts and tolerance on the I.D. .

    I am using a parts ejecter inside the subspindle that has a limited stroke of .875 . That is the reason that I had to set the G55 Z value depending on the part length Using the #500 variable.



    thanks
    Jon




    O0026(602-80026 PART EJECTTER)
    (JT 2/23/07)
    (ZINC PLATE)
    #500=[3.125+.145] (part length plus part off blade width(.125) + .02 for clean up on sub spindle)
    #501=1.25 (O.D. of part)
    #502=[501+.1]
    #503=-[23.4684-#500+.875]
    #504=-[23.4684+[#503-.155]]
    #505=.0085(X OFFSET FOR DRILL)
    G10L2P01X0.Z-23.4684
    G10L2P02X0.Z#504
    G10P10011X3.0038Z2.3897R.0156Q2
    G10P10021X3.3968Z-8.905R.0156Q1
    G11
    /2M00(RELOAD NEW BAR)

    M98P9983(SUBCALL 4 80026 & LIKE PARTS)
    M99

    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    O3031(082-63031 PARTS EJECTER)
    (JT 2/23/07)
    (ZINC PLATE)
    #500=[2.5+.145]
    #501=1.25
    #502=[501+.1]
    #503=-[23.4684-#500+.875]
    #504=-[23.4684+[#503-.155]]
    #505=.01(X OFFSET FOR DRILL)
    G10L2P01X0.Z-23.4684
    G10L2P02X0.Z#504
    G10P10011X3.0038Z2.3897R.0156Q2
    G10P10021X3.3968Z-8.905R.0156Q1
    G11
    /2M00(RELOAD NEW BAR)

    M98P9983(SUBCALL 4 80026& LIKE PARTS)
    M99

    __________________________________________________ __________________________________________


    O1086(704-21086 PARTS EJECTER)
    (JT 2/26/07)
    (ZINC PLATE)
    #500=[2.63+.145]
    #501=1.25
    #502=[501+.1]
    #503=-[23.4684-#500+.875]
    #504=-[23.4684+[#503-.155]]
    #505=.016(X OFFSET FOR DRILL)
    G10L2P01X0.Z-23.4684
    G10L2P02X0.Z#504
    G10P10011X3.0038Z2.3897R.0156Q2
    G10P10021X3.3968Z-8.905R.0156Q1
    G11
    /2M00(RELOAD NEW BAR)

    M98P9983(SUBCALL 4 80026& LIKE PARTS)
    M99

    __________________________________________________ ____________________________________



    O9983(SUBCALL 4 80026 & LIKE PARTS)
    (JT 2/26/07)
    N10(CNMG 432)
    M32
    M118
    G28U0
    G28B0
    G99
    G40
    G54M54

    (CHAMFER)
    G50S2500
    T1010
    G0G96S1000M3
    Z-.1M8
    X1.35
    G41G1X1.25Z-.0625F.01
    G2X1.125Z.0R.0625
    G1X-.04
    G0W.05
    G28U0
    G97M01


    G54G98
    T0199(.750 CORO DRILL)
    M3S2595
    G0Z.1M8
    X#505M8
    G1Z-#500F12.975
    M05
    G0X.0
    Z2.
    M09
    M05
    M01
    G28U0


    T1111
    G40
    G99
    G96M3S1000
    G54G0Z.1
    G0X.74
    G1Z-.07F.01
    G42G01X.75F.004
    G03X.875Z.0R.0625
    G1Z.1F.01
    G0Z.5
    G40
    G28U0
    M05
    M9


    (Feed out)
    T1213
    M5
    G54G0G98Z.05X0
    M69(MAIN CHUCK UNCLAMP)
    G1Z#500F500.
    M68(MAIN CHUCK CLAMP)
    G4P0500
    G99
    G0W.1
    G28U0
    N40

    M01
    (TRANSFER)
    (SUB FORWARD)
    T1299(.125 PART OFF)
    G54
    M118(SUB CLAMP)
    G50S1000
    G0G97S500M113(SUB SPINDLE ON)
    G0G97S500M3 (MAIN SPINDLE ON)
    M160(SPINDLE SYNC ON)
    M119(SUB SPINDLE UNCLAMP)
    G0B#503
    M118(SUB CHUCK CLAMP)
    G04P0500
    G50S3500
    G99G54G96S395
    G0Z.02M8
    X1.35
    G1X.7F.006
    M09
    G0G28B0
    G0W.25
    G0G28U0.M9
    M5
    M161(SPINDLE SYNC OFF)
    M01
    G99
    G97

    T1020(CHAMFER)
    G50S2500
    G96S800M113
    G55M55G0Z.1X1.35
    G42G1X1.25Z.0625F.01M8
    G3X1.125Z.0R.0625
    G1X.65
    G0G40Z-.25
    G28U0
    G97


    T1121 (RADIUS ON I.D. ON SUBSPINDLE)
    M55
    G99
    G40
    G55
    G96M113S1000
    G0Z-.1
    X.74
    G1Z.07F.01
    G41G1X.75F.004
    G2X.875Z.0R.0625
    G1Z-.1F.01
    G0Z-.5
    G40
    G28U0.
    M115

    M09
    G30B0.
    M73
    M119
    M74
    M01
    M05
    M12
    M99

  3. #3
    Join Date
    Mar 2003
    Posts
    2932
    Earl,

    Let's say you have to spot, drill, and tap a 4-hole pattern in a part. Instead of putting the XY hole locations in the program 3 times just put them in a sub program once, and call the sub for each tool.

    %
    O1000 (MAIN PROGRAM)
    N1 G0 G40 G49 G80 G90 Z0
    T01 M06 (1/2 SPOT DRILL)
    G54 X0 Y6.0 S2000 M03
    G43 Z0.1 H01 M08
    G82 Z-0.2 R0.1 F10.0 L0 (INITIALIZE SPOT CYCLE)
    M98 P1001 (CALL HOLE PATTERN SUB)
    G80 Z5.0 M09
    M01

    N2 G0 G40 G49 G80 G90 Z0
    T02 M06 (5/16 DRILL)
    G54 X0 Y6.0 S2000 M03
    G43 Z0.1 H02 M08
    G83 Z-0.85 R0.1 Q1000 F10.0 L0 (INITIALIZE PECK CYCLE)
    M98 P1001 (CALL HOLE PATTERN SUB)
    G80 Z5.0 M09
    M01

    N3 G0 G40 G49 G80 G90 Z0
    T03 M06 (3/8-16 TAP)
    X0 Y6.0 S1000 M03
    G43 Z0.1 H03 M08
    G84 Z-0.6 R0.1 F62.5 L0 (INITIALIZE TAP CYCLE)
    M98 P1001 (CALL HOLE PATTERN SUB)
    G80 Z5.0 M09
    M01

    G0 G40 G49 G80 G90 Z0
    G91 G28 Y0
    G90 M30
    %

    %
    O1001 (HOLE PATTERN SUB)
    X0 Y6.
    X6.0 Y0
    X0 Y -6.0
    X-6.0 Y0
    M99
    %

    Just one example.

    Dave

Similar Threads

  1. Help Making Sub Routines
    By PROTOTRAKFAN in forum Parametric Programing
    Replies: 7
    Last Post: 07-15-2008, 12:09 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
  •