![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| Haas Mills Discuss Haas machinery here! |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| |||
| |||
% 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
| ||||
| ||||
| 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. |
|
#4
| ||||
| ||||
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 |
|
#7
| ||||
| ||||
| 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
| |||
| |||
| 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? |
![]() |
| Tags |
| macro threadmilling |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Fanuc pocket milling macro | tturnbull50 | G-Code Programing | 4 | 08-30-2010 02:48 AM |
| Sprocket milling macro ??? | theemudracer | G-Code Programing | 20 | 11-08-2007 06:17 PM |
| Continuous thread G32 macro | dcrace | G-Code Programing | 3 | 05-29-2007 02:23 PM |
| Milling Macro | sencinia | General Metalwork Discussion | 2 | 04-04-2007 08:20 AM |
| Macro for milling round bar | sencinia | General Metalwork Discussion | 0 | 03-31-2007 10:58 AM |