![]() | |
| 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, I need to find a way to repeat a block of program without copy pasting as I need to shorten the length of the programs. In my previous employment I would have used NEXT PASS programming but that was on Millacron system. The machines I am using now are Extron CNC (Korean I think) and the control system is MRIL Milling 2000. The programming manual is brief to say the least and concentrates mainly on the macines built in pocketing macros. However I find increasingly I need to create pockets with odd shapes, odd corner radius's at each corner etc.. I rough them with a pocket cycle but finishing requires copy pasting the finish tool path lots of times and adjusting the depth of each block pasted, as you will know this can take up a lot of program storage space, so what i want is something to to tell the m/c, sort of like a macro, but all in the same program: ![]() Say for example I want to m/c the above pocket profile to a depth of 50mm at 1mm cuts, so normally I would have to copy and paste 50 times: ;; M06 T5; 12MM CARBIDE G43 H5; S5000 M3; G00 X10 Y10; Z2; ;; G1 Z-1 F100; G41 D5 Y0 F500; X90; G3 X100 Y10 R10; G1 Y30; G3 X80 Y50 R20; G1 X20; G3 X0 Y30 R20; G1 Y10; G3 X10 Y0 R10; G1; G40 Y10; ;; G1 Z-2 F100; G41 D5 Y0 F500; X90; G3 X100 Y10 R10; G1 Y30; G3 X80 Y50 R20; G1 X20; G3 X0 Y30 R20; G1 Y10; G3 X10 Y0 R10; G1; G40 Y10; ;; G1 Z-3 F100; G41 D5 Y0 F500; X90; G3 X100 Y10 R10; G1 Y30; G3 X80 Y50 R20; G1 X20; G3 X0 Y30 R20; G1 Y10; G3 X10 Y0 R10; G1; G40 Y10; ;; etc... So instead I want to tell it IF Z is not at -50 go back and repeat until it is, I'm not up on macros at all but the manual says I can create custom macros but does not explain it very well, and like I said I really want everything in the same program. Any ideas? Your help would be very appreciated. Steve. |
|
#2
| |||
| |||
Don't know your control, so find out what it uses as variables in a macro. Look back at the manual you were reading and see if you can see #500 or #100. If so, then here ya go...... M06 T5; 12MM CARBIDE G43 H5; S5000 M3; G00 X10 Y10; Z2; #500=-1. (sets depth of 1st pass) WHILE[#500GE-50.]DO1 (starts looping untill #500=-50) G1 Z#500 F100; G41 D5 Y0 F500; X90; G3 X100 Y10 R10; G1 Y30; G3 X80 Y50 R20; G1 X20; G3 X0 Y30 R20; G1 Y10; G3 X10 Y0 R10; G1; G40 Y10; #500=#500-1 (changes variable for next pass) END1 (if start of loop has gone past -50 it jumps to here to end the loop) G0 Z10 M30 HTH. |
|
#4
| ||||
| ||||
| OK, I have attached the Macro part of the manual in PDF format if anyone would like to try and fathom it. I understand I can write the block of program in a sub program and call that up with M98 and execute that as many times as I want, but what I really need is to have everything in the same program. Thanks, Steve. |
|
#5
| |||
| |||
| Steve.....welcome to the group. What did not work about the WHILE statement? Did it alarm out? By looking through your macro section I did not see anything about the WHILE statements so I am going to ass u me that this control cannot handle this function. Or it could be similar to Fanuc were the option has to be activated and yours is not. Try going into MDI and type #100=1. If you get no alarm and #100 gets set to 1 then I will ass u me that the macros will work on your control. So let’s try the GOTO instead of the WHILE. This is just quick simple code. Be careful as this is not set up to avoid any depth that is not divisible by the pick size. IOW you will over shoot your final depth. M06 T5; 12MM CARBIDE #1=50(FINAL DEPTH) #2=1(PICK SIZE) #3=#2(COUNTER) G43 H5; S5000 M3; G00 X10 Y10; Z2 N1 G1 Z-#3 F100; G41 D5 Y0 F500; X90; G3 X100 Y10 R10; G1 Y30; G3 X80 Y50 R20; G1 X20; G3 X0 Y30 R20; G1 Y10; G3 X10 Y0 R10; G1; G40 Y10; #3=#3+#1 IF[#3LE#1]GOTO1 M30 |
| Sponsored Links |
|
#7
| ||||
| ||||
|
Ah, I figured that out eventually. Thanks. After several attempts I managed to get it going with the following program: #1=5 #2=1 #3=#2 N1 G1 Z-#3 #3=#3+#2 IF(#3<=#1)GOTO1 It worked a treat! So thanks to you both for the help. I still don't quite understand how it works though? #1=5 This sets variable #1 as the total depth right? #2=1 This sets the incremental depth? #3=#2 This sets variable #3 as 1 ??? N1 This is block 1 G1 Z-#3 This says move Z minus by 1 #3=#3+#2 This says variable #3 equals 1+1 so that makes variable #3=2 and that is where I am confused, happy that it works but confused??? IF(#3<=#1)GOTO1 Totally understand this bit. Its great though, I have tried it with odd total depth and set #2 as a division of total depth and its good. If you could enlighten me further that would be great. Again thanks to both of you for the help. Hold on, I just got it, its resets variable #3 as 2 then that stays as 2 because the computer returns to N1 and doesn't read the variables at the top again right? so every pass its adds another increment on and #3 increases each time by #2 until it gets to the depth #1, so its really working in absolute. I think I have it? |
|
#8
| ||||
| ||||
| Steve, check out the documentation for TurboCNC. http://www.dakeng.com/turbo.html They have very good explanations of using macros with worked examples. While the syntax may not axactly match your controller, once you get you head around the concepts, it is easy enough to sort out the syntax variations. Once you start programming using trig, functions, and conditional expressions you can write very powerful programs very quickly. Does your controller have an "ASK" type command? TurboCNC has this and it is very handy. For example, I wrote an ER Collet taper turning macro, which asks me which size ER collet it wants me to make and a couple other things like DOC, and then does a multipass cycle to turn it, with roughing and finishing cuts, followed by spring cuts. It was only about 30 lines of code long.
__________________ Regards, Mark www.wrathall.com |
|
#9
| |||
| |||
|
Yes that is what i meant. It was an oversight on my part thank you for pointing it out.#3 is the Z distance to move and each time it runs through the program it will continue to add 1 to itself which in turn keeps dropping the Z down. First run through #3=1 so Z-#3 really means Z-1. Once the program reads #3=#3+#2 it will set #3=2 and then read the GOTO statement and jump back to N1 still with #3=2 when it reads Z-#3 it will mean Z-2. It will continue this adding 1 to #3 every time through the program. Does that make more sense?? Stevo |
|
#10
| ||||
| ||||
|
| Sponsored Links |
|
#11
| |||
| |||
| It's like ridding a bike. It will all come back to you. Everything here is pretty much setup now and there is not much programming anymore. It sucks because I feel as you do. If you don't use it ya start to forget it. Stevo |
![]() |
| 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 |
| Need Help!- How to Repeat in G81-cycle with G91 | brinchen | Okuma | 1 | 03-05-2009 08:38 PM |
| Need Help!- Repeat | cshim | G-Code Programing | 4 | 08-07-2008 07:49 AM |
| pattern repeat | ac123 | G-Code Programing | 6 | 06-22-2008 12:23 AM |
| How Do I Repeat? | TZ250 | Dolphin CADCAM | 2 | 03-04-2008 05:11 AM |
| RS232 program block by block | smoregrava | General CNC (Mill and Lathe) Control Software (NC) | 3 | 12-22-2005 12:52 AM |