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 08-10-2008, 01:19 PM
 
Join Date: May 2005
Location: usa
Posts: 104
69owb is on a distinguished road
Help with subprogram

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

  #2  
Old 08-10-2008, 03:11 PM
Gold Member
 
Join Date: Oct 2005
Location: USA
Posts: 663
Caprirs is on a distinguished road

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

  #3   Ban this user!
Old 08-11-2008, 08:18 AM
 
Join Date: Apr 2008
Location: USA
Posts: 27
Daleb is on a distinguished road

You could put the Z.100 in your subprogram
O1301
(2ND ROUGH)
G00G90Z.100
N266 G00 X-1.2493 Y-7.8085
*
*
*
*
N273 G90 G00 X-1.2493 Y-7.8085
Z.100
M99
Reply With Quote

  #4   Ban this user!
Old 08-11-2008, 02:03 PM
 
Join Date: Nov 2006
Location: UK
Posts: 121
ChattaMan is on a distinguished road
DO WHILE

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

  #5   Ban this user!
Old 08-11-2008, 09:49 PM
 
Join Date: May 2005
Location: usa
Posts: 104
69owb is on a distinguished road

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

Sponsored Links
  #6   Ban this user!
Old 09-02-2008, 09:08 PM
 
Join Date: Jul 2008
Location: USA
Posts: 24
Othatvideo is on a distinguished road
Thumbs up No If/Then abilities?

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

  #7   Ban this user!
Old 09-05-2008, 10:21 AM
 
Join Date: May 2007
Location: USA
Posts: 913
g-codeguy is on a distinguished road

Originally Posted by 69owb View Post
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
Seems you may not have Macro B capability. Otherwise it should have read the line.

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

  #8   Ban this user!
Old 09-05-2008, 05:06 PM
 
Join Date: May 2005
Location: usa
Posts: 104
69owb is on a distinguished road

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.
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
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




All times are GMT -5. The time now is 10:15 PM.





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