585,981 active members*
4,208 visitors online*
Register for free
Login
IndustryArena Forum > Machine Controllers Software and Solutions > G-Code Programing > Macro variable example I programmed today.
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2005
    Posts
    219

    Macro variable example I programmed today.

    I am still in the learning stages of this. I am interested in your opinions and suggestions.

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

    It is for a 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.

    Let me know what you guys think of it and suggestions please.

    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


    --------------------------------------------------------------------------------

  2. #2
    Join Date
    Mar 2005
    Posts
    1498
    070307-2120 EST USA

    theemudracer:

    I have only glanced at your code, but I might do this:

    Program 1

    #510 = 3.125 (length)
    #505 = 0.0085 (X OFFSET FOR DRILL)

    M98 P9900

    M30


    Program 2

    #510 = 2.500
    #505 = 0.010 (X OFFSET FOR DRILL)

    M98 P9900

    M30


    Program 3

    #510 = 2.630
    #505 = 0.016 (X OFFSET FOR DRILL)

    M98 P9900

    M30



    O9900
    O0026(602-80026 PART EJECTTER)
    (JT 2/23/07)
    (ZINC PLATE)
    #500=[#510+.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]]
    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


    This makes the main calling programs simpler, and easier to see what the real variables are.

    Then you may also be able to use

    G65 P9900 Z3.125 X0.0085
    or
    G65 P9900 Z2.500 X0.0100
    or
    G65 P6600 Z2.630 X0.0160

    instead of the #-variables. Where Z value is length and X is drill offset. Other address letters can be used. See HAAS manual under MACROS.

    .

Similar Threads

  1. Programmed RS-232 output
    By ghyman in forum G-Code Programing
    Replies: 17
    Last Post: 01-24-2020, 09:40 AM
  2. Macro variable for current tool diam ?
    By Shizzlemah in forum Fadal
    Replies: 3
    Last Post: 10-30-2006, 03:47 PM
  3. need help today
    By thesaent14 in forum DIY CNC Router Table Machines
    Replies: 11
    Last Post: 07-01-2006, 04:32 PM
  4. Need PIC programmed
    By randyf1965 in forum CNC Wood Router Project Log
    Replies: 0
    Last Post: 03-27-2005, 12:56 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
  •