Results 1 to 8 of 8

Thread: THREAD MILLING MACRO

  1. #1
    cmo
    cmo is offline
    Registered
    Join Date
    Aug 2009
    Location
    US
    Posts
    21
    Downloads
    0
    Uploads
    0

    THREAD MILLING MACRO

    %
    G65 P9012 X10. Y10. Z0. D.5 T10. A54. B1. C1. E2. F1. H1. I14. J6.
    %
    %
    O09012 (THREAD MILLING MACRO REV.4)
    (INPUT TESTING)
    IF [ [ #24 GE - 25. ] AND [ #24 LE 25. ] ] GOTO100
    #3000= 1 (X INPUT MISSING OR OUT OF RANGE)
    N100 IF [ [ #25 GE - 12. ] AND [ #25 LE 12. ] ] GOTO110
    #3000= 2 (Y INPUT MISSING OR OUT OF RANGE)
    N110 IF [ [ #26 NE - 16. ] AND [ #26 LE 16. ] ] GOTO120
    #3000= 3 (TOP OF THREAD MISSING OR OUT OF RANGE)
    N120 IF [ [ #9 GT 0.5 ] AND [ #9 LT 4. ] ] GOTO130
    #3000= 4 (THREAD OD MISSING OR OUT OF RANGE)
    N130 IF [ #8 EQ 1. ] GOTO150
    N140 IF [ #7 LE #9 * 0.8 ] GOTO150
    #3000= 5 (TOOL SIZE OUT OF RANGE)
    N150 IF [ #20 EQ FIX[ #20 ] ] GOTO160
    #3000= 6 (TOOL NUMBER MUST BE A WHOLE NUMBER)
    N160 IF [ #11 GT 0 ] GOTO1000
    #3000= 7 (VALUE IS OUT OF RANGE)
    N1000 (CALCULATIONS)
    IF [ #2 EQ 1. ] THEN #2= 400. (STEEL)
    IF [ #2 EQ 2. ] THEN #2= 600. (ALUMINUM)
    #100= [ #2 * 3.82 ] / #7 (RPM)
    #101= [ #100 * 0.004 ] (FEED RATE)
    #102= -1. * [ #11 ]
    #103= 0.1 (CUTTER COMP)
    #104= -0.1 (CUTTER COMP)
    #105= [ #9 - #7 ] + #24 (CUT DIA)
    #107= -1. * #105 (CUT RAD)
    #106= [ [ #9 / #7 ] / 2 ] (RAMP RAD)
    #108= #106 + #106
    #109= 0.25 * [ 1 / #4 ]
    #110= -1. * [ #109 ]
    #111= [ 1 / #114 ]
    #112= [ 90 / 360 ] * #111
    #113= -1. * [ #112 ]
    #114= 0.1 (CUTTER COMP)
    #115= -1. * [ #109 ]
    #117= 0.5 * [ #9 + #7 ]
    #118= -1. * [ #117 ]
    #119= [ 0.6495 / 4 ]
    #120= -1. * [ #110 ]
    #122= [ 1 / #4 ]
    #124= -1. * [ #123 - 1. ]
    #125= [ #4 * #11 ]
    #126= FIX[ #125 ]
    #127= -1. * [ #126 ]
    #150= #4 - #5 (TPI-ZDEPTH)
    #128= [ 1 / #4 ] * [ #5 - 1. ] (ZMOVE)
    IF [ [ #3 EQ 2. ] AND [ #8 EQ 1. ] ] GOTO2010
    IF [ [ #3 EQ 2. ] AND [ #8 EQ 2. ] ] GOTO2020
    IF [ [ #3 EQ 1. ] AND [ #8 EQ 1. ] ] GOTO2030
    N2000 (MACHINING ID THREAD RIGHT HAND)
    WHILE [ #150 GT 0 ] DO1
    T#20 M06
    S#100 M03
    G00 G90 G#1 X#24 Y#25 M08 (HOLE LOCATION)
    G43 H#20 Z [ #26 + 0.1 ] (MOVE TO .1" ABOVE PART ZERO)
    G01 Z#102 F100. (FEED DOWN TO BOTTOM OF HOLE)
    G41 X [ #24 + 0.1 ] D#20 F#101 (ACTIVATE CUTTER COMPENSATION)
    G03 X#105 Z#109 R#106 (HELIX ON)
    G03 I#107 Z#122 (HELIX THREAD)
    G03 X [ #24 + 0.1 ] Z#109 R#106 (HELIX OFF)
    G01 G40 X#24
    #102= #102 + #128 (Z MOVE)
    #150= #150 - 1.
    END1
    G91 G28 Z0
    M99



    WHAT IS WRONG??


  2. #2
    Registered dcoupar's Avatar
    Join Date
    Mar 2003
    Location
    USA
    Posts
    2,502
    Downloads
    0
    Uploads
    0
    Probably the font.

    Whaddya mean "WHAT IS WRONG??"?

    I'll tell ya what's wrong, you forgot to tell us what it does that it shouldn't or what it doesn't do that it should!!! Do you get an alarm? Does the coolant foam up? Does the main circuit breaker trip??? What happens when you try to run the macro???

    Splain, Lucy!!! Sheesh.


  3. #3
    cmo
    cmo is offline
    Registered
    Join Date
    Aug 2009
    Location
    US
    Posts
    21
    Downloads
    0
    Uploads
    0
    this is a project for my class but i figured it out!! thanks anyways


  4. #4
    Registered machinistDroid's Avatar
    Join Date
    Jun 2010
    Location
    USA
    Posts
    4
    Downloads
    0
    Uploads
    0

    the loop

    The pitch minus the depth is probably not a good conditional statement in this case.
    #150=#4-#5
    if your pitch is 13(#4) and your depth in 1.(#5) then everything will loop, toolchange and all, at least 12 times. #150=#150-1


  • #5
    Registered KenFoulks's Avatar
    Join Date
    Aug 2010
    Location
    USA
    Posts
    569
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by cmo View Post
    this is a project for my class but i figured it out!! thanks anyways
    Why don't you post the working version and explain what it does?
    Thanks,
    Ken Foulks


  • #6
    Registered
    Join Date
    Jan 2007
    Location
    USA
    Posts
    1,378
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by KenFoulks View Post
    Why don't you post the working version and explain what it does?
    +1
    sure would be nice, as it might be useful to others.


  • #7
    Registered machinistDroid's Avatar
    Join Date
    Jun 2010
    Location
    USA
    Posts
    4
    Downloads
    0
    Uploads
    0
    Follow the code. He's trying to write a thread milling macro that accepts a dia., pitch, and depth as variables. That is why I preach documentation... to help follow your own logic, if nothing else, when proofing it out.

    He also needs to just loop the tool movement after the initial positioning. But I'm sure he found that out by now.
    I love macros.

    CNC macros


  • #8
    Registered
    Join Date
    Nov 2006
    Location
    US
    Posts
    248
    Downloads
    0
    Uploads
    0
    I wrote a much simpler one-pass macro that will can be called multiple times to yield the correct number of passes. But it steps out in diameter so the tool load isn't ideal.

    %
    O0101 (THREADMILL MAIN)
    T1 M06 (T1 = THREADMILL CUTTER)
    G00 G90 G58 X0. Y0.
    S1000 M03
    G00 G90 G43 H01 Z0.5 M08
    G65 P300 D1.98 C0.5 E0.05 Z-1.0 F20. M0. (CALL THREADMILL)
    G65 P300 D1.99 C0.5 E0.05 Z-1.0 F20. M0. (CALL THREADMILL)
    G65 P300 D2.00 C0.5 E0.05 Z-1.0 F20. M0. (CALL THREADMILL)
    G00 G90 G49 Z0. M09
    M01
    M30
    (----------------------------------------)
    O300 (THREADMILL ALIASED SUBROUTINE)
    (INSIDE THREAD - RIGHT HAND)
    (C=#3 - cutter dia)
    (D=#7 - pass dia)
    (E=#8 - lead of thread)
    (F=#9 - feed at edge of cutter)
    (Z=#26 - bottom z depth - thread start)
    (M=#13 - top Z - threadmill end)
    (#32 = threadmill pass radius - tool center)
    (#27 = feedrate adjusted for tool center programming)
    #30= 0 (30 = num of thread passes cut thus far)
    #14= #26 (14 = current Z height)
    G103 P1 (halt look ahead)
    (BLANK LINE)
    IF [ #13 EQ #0 ] THEN #13= 1 (must cut at least one thread)
    G01 Z[#26] F20. (feed down to bottom of hole)
    #32=[#7-#3]/2 (calculate path radius)
    #27=[#9*[#32/[#7/2]]] (calculate adjusted feedrate)
    G03 X#32 I[#32/2] J0 F#27 (arc into 3o'clock position)
    (while-do loop start)
    WHILE [#14 LT #13] DO1 (while current Z LT top Z...)
    G03 I[-#32] J0 Z[#26+[#8*#30]]
    #30= #30 + 1
    #14= #26 + [ #8 * #30 ] (calculate current z height)
    END1
    (while-do loop end)
    G03 X0 I[-#32/2] J0 (arc out to center position)
    G103
    M99
    %


    I'm working on making it calculate a "surface area cut" so the macro will automatically step out in diameter and up in Z, like a G76 threading cycle on a lathe. Is that what's happening in your much lengthier code?


  • Similar Threads

    1. Fanuc pocket milling macro
      By tturnbull50 in forum G-Code Programing
      Replies: 4
      Last Post: 08-30-2010, 03:48 AM
    2. Sprocket milling macro ???
      By theemudracer in forum G-Code Programing
      Replies: 20
      Last Post: 11-08-2007, 07:17 PM
    3. Continuous thread G32 macro
      By dcrace in forum G-Code Programing
      Replies: 3
      Last Post: 05-29-2007, 03:23 PM
    4. Milling Macro
      By sencinia in forum General Metalwork Discussion
      Replies: 2
      Last Post: 04-04-2007, 09:20 AM
    5. Macro for milling round bar
      By sencinia in forum General Metalwork Discussion
      Replies: 0
      Last Post: 03-31-2007, 11:58 AM

    Tags for this Thread

    Posting Permissions


     


    About CNCzone.com

      We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

    Follow us on

    Facebook Dribbble RSS Feed


    Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.