![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| G-Code Programing Discuss G-code programing and problems here! |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| |||
| |||
Hi Is there an easy way of writing a sub that will feed down Z-0.400, run the sub then rapid up to Z0.100 then loop intel it reaches Z-1.600, then start over. The way I have it wrote now will not retract out of the part Thanks for the help N18 G00 G90 G54 X-2.0.0 Y1.0 N33 G00 Z0.1000 N12 M98 P1300L4 N12 G90 G00 Z0.100 N12 M98 P1301L4 N12 G90 G00 Z0.100 N12 M98 P1302L4 N12 G90 G00 Z0.100 O1300 (1ST ROUGH) N247 G00 X4.1396 Y-12.7000 N248 G91 G01 Z-0.5000 F14.00 N249 G90 G01 X5.7000 Y-11.1396 F14.0 N250 G91 G00 Z0.1000 N251 G90 G00 X4.1396 Y-12.7000 M99 O1301 (2ND ROUGH) N266 G00 X-1.2493 Y-7.8085 N267 G91 G01 Z-0.5000 F20.00 N268 G90 G02 X-0.4538 Y-6.7504 I4.1493 J-2.2915 F14.00 N269 G03 X-0.2900 Y-6.3547 I-0.3962 J0.3957 N270 G01 Y-2.4863 N271 G01 X-0.5400 N272 G91 G00 Z0.1000 N273 G90 G00 X-1.2493 Y-7.8085 M99 |
|
#2
| |||
| |||
| Add a variable which increments. N18 G00 G90 G54 X-2.0.0 Y1.0 N33 G00 Z0.1000 #100=.05 N12 M98 P1300L4 N12 G90 G00 Z0.100 #100=.05 N12 M98 P1301L4 N12 G90 G00 Z0.100 #100=.05 N12 M98 P1302L4 N12 G90 G00 Z0.100 O1300 (1ST ROUGH) N247 G00 X4.1396 Y-12.7000 N248 G91 G01 Z-#100 F14.00 N249 G90 G01 X5.7000 Y-11.1396 F14.0 N250 G00 Z0.1000 N251 G90 G00 X4.1396 Y-12.7000 #100=#100+.05 M99 O1301 (2ND ROUGH) N266 G00 X-1.2493 Y-7.8085 N267 G91 G01 Z-#100 F20.00 N268 G90 G02 X-0.4538 Y-6.7504 I4.1493 J-2.2915 F14.00 N269 G03 X-0.2900 Y-6.3547 I-0.3962 J0.3957 N270 G01 Y-2.4863 N271 G01 X-0.5400 N272 G00 Z0.1000 N273 G90 G00 X-1.2493 Y-7.8085 #100=#100+.05 M99 |
|
#4
| |||
| |||
I prefer to use DO WHILE loops rather than subs. G91 can get messy and staying in G90 is easier to track. All blocks are in one prog rather than storing loads of subs for one part. Try it this way...... N18 G00 G90 G54 X-2.0.0 Y1.0 N33 G00 Z0.1000 (1ST ROUGH) #500=-0.4 (sets variable to first cut) WHILE[#500GE-1.6]DO1 (starts loop, which ends at -1.6) N247 G00 X4.1396 Y-12.7000 (rapid to start position) N248 G01 Z#500 F14.00 (feed to Z position) N249 G01 X5.7000 Y-11.1396 F14.0 N250 G00 Z0.1000 (rapid to Z0.1) #500=#500-0.4 (adds -0.4 for next Z position) END1 (return to start of loop, or carry on if Z is at desired depth) Your prog would feed from Z0.1 down to the next Z position, which wastes time cutting air. Add an extra line to rapid down to 0.1 above your next Z position. N18 G00 G90 G54 X-2.0.0 Y1.0 N33 G00 Z0.1000 (1ST ROUGH) #500=-0.4 (sets variable to first cut) WHILE[#500GE-1.6]DO1 (starts loop, which ends at -1.6) N247 G00 X4.1396 Y-12.7000 (rapid to start position) G00 Z[#500+0.5] (rapid to 0.5 above next Z position) N248 G01 Z#500 F14.00 (feed to Z position) N249 G01 X5.7000 Y-11.1396 F14.0 N250 G00 Z0.1000 (rapid to Z0.1) #500=#500-0.4 (adds -0.4 for next Z position) END1 Hope it makes sense. Just another way of doing the same thing. |
|
#5
| |||
| |||
| Thanks Guys for all the ideas. The only Problem I'm having is when I send the program to the DNC from Bobcad - predator,the control (Fanuc 6M) shows this N7 1001000.400 instead of this N7 #100=#100+0.400 basically all the variables are the same way, I tried without the line number but same thing. Any Ideas |
| Sponsored Links |
|
#6
| |||
| |||
| I'm not understanding the .100 move BUT, I agree with Chattman that G91's can get messy...but here's an example of jumping back & forth a SubRoutine & your Main Program. We're talking Mits Wire EDM Macro here, it really doesn't apply to a mill application, but maybe your machine's IF/THEN statement might work for you... H=a variable you have a multitude of variables available, for example: Let H50=4 (the # of passes you wish to run) Let H51=-.400 (the amount of the z move that you wish to have each pass equal) You could put a counter on it such as N100 H50=H50-1 N102 G91 N104 G01 ZH51 F5. M90 Move Z -the value of H51 @ a Feed of 5"/minute with Adaptive Control on N110 G22 (Send it to your X&Y move subroutine) When it returns from the routine - It does compares the current value of Variable #50 N200 G202 A220 B0 CH50 IF B = C THEN Branch/Jump to the Block # that's in A (in this case Block #220) without returning. IF B does NOT = C, then continue to the next block N210 G200 A100 (Branch/Jump to Block #100) (here's the loop - it will keep sending it to Block #100 until H51=0) (return to zero area) N220 G90 N230 G92 X0 Y0 Z-H50*H51 Here you're telling it that Z = -.400 X 4 (-.400 times the # of reps) N240 G01 Z0 F25. M91 And here, returning to the original Z. Macro is such a confusing but powerful thing. Good luck - Brent www.videotech.me |
|
#7
| |||
| |||
We have Macro B on an older Hardinge. I have the same macro program loaded in all the barfeeds. It wasn't until I went to use it in the OT control machine that I found out it doesn't support the THEN statement. When the macro program loads it makes the THEN statement T space H space END (3 separate words). Not exactly what I wanted. ![]() Did you ever get the problem solved? |
|
#8
| |||
| |||
| I did some research on macro A & B and I was able to turn some parameters on. So now it shows the varibles but I haven't tried it yet to see if it works. Had to start making metal chips so I wrote the program a littel different to get it up and running. |
![]() |
| 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 |
| eia subprogram | rs1982 | Mazak, Mitsubishi, Mazatrol | 4 | 04-11-2008 08:10 AM |
| having trouble with subprogram | dshowald | Milltronics | 10 | 02-10-2007 02:32 PM |
| Restarting an EIA subprogram | ajl6549 | Mazak, Mitsubishi, Mazatrol | 6 | 08-09-2006 06:06 AM |
| Fanuc 16T subprogram example?? | stex | Fanuc | 11 | 03-27-2006 02:15 PM |
| Mazatrol subprogram | BeanO | Mazak, Mitsubishi, Mazatrol | 5 | 11-24-2005 03:12 AM |