CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > Machine Controllers Software and Solutions > G-Code Programing


G-Code Programing Discuss G-code programing and problems here!


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 12-12-2009, 03:39 PM
stevepetmonkey's Avatar  
Join Date: Dec 2009
Location: Australia
Posts: 5
stevepetmonkey is on a distinguished road
Question Block repeat?

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.
Reply With Quote

  #2   Ban this user!
Old 12-13-2009, 11:03 AM
 
Join Date: Nov 2006
Location: UK
Posts: 121
ChattaMan is on a distinguished road
DO/WHILE loop

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.
Reply With Quote

  #3   Ban this user!
Old 12-13-2009, 11:43 PM
stevepetmonkey's Avatar  
Join Date: Dec 2009
Location: Australia
Posts: 5
stevepetmonkey is on a distinguished road

Tried that today but no luck, thanks anyway.
The manual is pretty basic, and seems to be badly translated.
I'll scan the pages up see if anyone can figure it out.
Reply With Quote

  #4   Ban this user!
Old 12-14-2009, 12:28 AM
stevepetmonkey's Avatar  
Join Date: Dec 2009
Location: Australia
Posts: 5
stevepetmonkey is on a distinguished road

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.
Attached Files
File Type: pdf Macros.pdf‎ (438.0 KB, 51 views)
Reply With Quote

  #5   Ban this user!
Old 12-14-2009, 09:09 AM
 
Join Date: Jun 2008
Location: United States
Posts: 1,507
stevo1 is on a distinguished road

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
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 12-14-2009, 05:20 PM
 
Join Date: Nov 2006
Location: UK
Posts: 121
ChattaMan is on a distinguished road

I think stevo1 meant....

#3=#3+#2

not...

#3=#3+#1
Reply With Quote

  #7   Ban this user!
Old 12-15-2009, 12:08 AM
stevepetmonkey's Avatar  
Join Date: Dec 2009
Location: Australia
Posts: 5
stevepetmonkey is on a distinguished road

Originally Posted by ChattaMan View Post
I think stevo1 meant....

#3=#3+#2

not...

#3=#3+#1
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?
Reply With Quote

  #8   Ban this user!
Old 12-15-2009, 06:05 AM
RotarySMP's Avatar  
Join Date: Mar 2004
Location: Vienna, Austria
Posts: 1,048
RotarySMP is on a distinguished road

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
Reply With Quote

  #9   Ban this user!
Old 12-15-2009, 07:30 AM
 
Join Date: Jun 2008
Location: United States
Posts: 1,507
stevo1 is on a distinguished road

Originally Posted by ChattaMan View Post
I think stevo1 meant....

#3=#3+#2

not...

#3=#3+#1
Yes that is what i meant. It was an oversight on my part thank you for pointing it out.


Originally Posted by stevepetmonkey View Post
I still don't quite understand how it works though?

#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.
It is quite simple once you get the hang of it. You have to look at the value of #3 when it comes to the condition statement. Once the program starts #3=1 then it runs the program and it reads #3=#3+#2. So now #3=2. Now it reads the GOTO statement and what that means is “if #3 is less than or equal to #1 then go to N1” And as you can see #3 is equal to 2 and #1 is equal to 50 so it will go back to N1 and run it again each time adding 1 to #3. This will continue until #3 reaches the value of #1. Once that occurs it will no longer jump to N1 but proceed past it to M30.

#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
Reply With Quote

  #10   Ban this user!
Old 12-15-2009, 11:30 PM
stevepetmonkey's Avatar  
Join Date: Dec 2009
Location: Australia
Posts: 5
stevepetmonkey is on a distinguished road

Does that make more sense??

Stevo
Yes, Thanks so much, its been years since I did my CNC training at tech, when you don't use stuff like macros for a long time you forget bits, but its all starting to make sense again now.
Reply With Quote

Sponsored Links
  #11   Ban this user!
Old 12-16-2009, 07:33 AM
 
Join Date: Jun 2008
Location: United States
Posts: 1,507
stevo1 is on a distinguished road

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
Reply With Quote

Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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




All times are GMT -5. The time now is 12:25 AM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361