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 11-18-2007, 02:09 PM
 
Join Date: Oct 2005
Location: USA
Age: 43
Posts: 118
DroopyPawn is on a distinguished road
Manually Change Endmill

What code do I add to my program so that I can manually change endmills? I'll need to pause the program, change the tool, rezero the z-axis and resume the program from the paused position.
__________________
Gary Shepherd
www.16tracks.com
Reply With Quote

  #2   Ban this user!
Old 11-18-2007, 07:41 PM
Mitsui Seiki's Avatar  
Join Date: Feb 2007
Location: USA
Posts: 464
Mitsui Seiki is on a distinguished road

Add a M0 before the tool change.Switch to "Jog",change the tool,rezero and go back to Auto mode and start from where you paused.
Reply With Quote

  #3   Ban this user!
Old 11-18-2007, 11:51 PM
 
Join Date: Oct 2005
Location: USA
Age: 43
Posts: 118
DroopyPawn is on a distinguished road

That worked out well, thanks.

Now another question...

My code was generated by a downloaded demo of FlashCutCNC. The code is good but it's about 1000 lines long. My demo version of Mach3 only allows 500 lines of code.

Here's the code to do the outside contour of my part...
N10 G00 Z0.20000

N20 G00 X0.06200 Y0.00000
N30 G01 Z-0.02000 F12.00

N40 G01 X2.06200 Y0.00000
N50 G03 X2.12400 Y0.06200 I0.00000 J0.06200
N60 G01 X2.12400 Y0.81200
N70 G03 X2.06200 Y0.87400 I-0.06200 J0.00000
N80 G01 X1.77334 Y0.87400
N90 G03 X1.76165 Y0.87290 I-0.00004 J-0.06200
N100 G03 X1.75000 Y0.87400 I-0.01165 J-0.06090
N110 G01 X1.43700 Y0.87400
N120 G03 X1.37500 Y0.81200 I0.00000 J-0.06200
N130 G01 X1.37500 Y0.62404
N140 G01 X1.31196 Y0.62400
N150 G03 X1.25000 Y0.56200 I0.00004 J-0.06200
N160 G01 X1.25000 Y0.24904
N170 G01 X1.24900 Y0.24904
N180 G01 X1.24900 Y0.56200
N190 G03 X1.18700 Y0.62400 I-0.06200 J0.00000
N200 G01 X1.06200 Y0.62400
N210 G03 X1.00000 Y0.56200 I0.00000 J-0.06200
N220 G01 X1.00000 Y0.24904
N230 G01 X0.99900 Y0.24904
N240 G01 X0.99900 Y0.56200
N250 G03 X0.93700 Y0.62400 I-0.06200 J0.00000
N260 G01 X0.81200 Y0.62400
N270 G03 X0.75000 Y0.56200 I0.00000 J-0.06200
N280 G01 X0.75000 Y0.24904
N290 G01 X0.74900 Y0.24904
N300 G01 X0.74900 Y0.56200
N310 G03 X0.68700 Y0.62400 I-0.06200 J0.00000
N320 G01 X0.56200 Y0.62400
N330 G03 X0.50000 Y0.56200 I0.00000 J-0.06200
N340 G01 X0.50000 Y0.24904
N350 G01 X0.49900 Y0.24904
N360 G01 X0.49900 Y0.56200
N370 G03 X0.43700 Y0.62400 I-0.06200 J0.00000
N380 G01 X0.31200 Y0.62400
N390 G03 X0.25000 Y0.56200 I0.00000 J-0.06200
N400 G01 X0.25000 Y0.24954
N410 G02 X0.24900 Y0.24954 I-0.00050 J0.00000
N420 G01 X0.24900 Y0.56200
N430 G03 X0.18700 Y0.62400 I-0.06200 J0.00000
N440 G01 X0.06200 Y0.62400
N450 G03 X0.00000 Y0.56200 I-0.00000 J-0.06200
N460 G01 X0.00000 Y0.06200
N470 G03 X0.06200 Y0.00000 I0.06200 J-0.00000

I know that I can make lines 40 through 470 a subroutine and just call it over and over (after z changes) but I'm not sure exactly how that works. That would shorten my code A LOT. Not sure if Mach3 would still call it more than the 500 lines allowed in the demo but it will work until I have some extra money to register my copy of the program.

So how can I do the subroutine thing correctly?
__________________
Gary Shepherd
www.16tracks.com
Reply With Quote

  #4   Ban this user!
Old 11-19-2007, 02:08 PM
Mitsui Seiki's Avatar  
Join Date: Feb 2007
Location: USA
Posts: 464
Mitsui Seiki is on a distinguished road

Do it like this:

"Main prog with Z change."(0001)
(Call sub)M98 P0002( Line 40 through 470)
Z change
(Call sub) M98 P0002
Z change
....
....
....
....
M30
Reply With Quote

  #5   Ban this user!
Old 11-19-2007, 02:55 PM
 
Join Date: Oct 2005
Location: USA
Age: 43
Posts: 118
DroopyPawn is on a distinguished road

Yep. I got it working fine. My program went from over 1000 lines to about 70.
Thanks, gs
__________________
Gary Shepherd
www.16tracks.com
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 11-19-2007, 05:35 PM
 
Join Date: Feb 2007
Location: usa
Posts: 36
drewmeister is on a distinguished road

another easy way to shorten you program even more is make the z move incremental then swith back to absolute. just make sure the tool doesn't move up at the end of the sub.
Reply With Quote

  #7   Ban this user!
Old 11-19-2007, 05:56 PM
 
Join Date: Oct 2005
Location: USA
Age: 43
Posts: 118
DroopyPawn is on a distinguished road

Well here's what I did. How would I make it incremental and shorter?

(Drilling Shaft Hole with 3/8" drill)
N1 G00 Z2
N2 G00 X1.749 Y0.437
N3 G01 Z0.1 F25
N4 G01 Z-0.3 F15
N5 G00 Z1.5 F25
N6 M0 (change to 1/8" endmill)

G00 Z0.20000
G00 X0.06200 Y0.00000
G01 X0.06200 Y0.00000 F150.00
G01 Z-0.02000 M98 P1
G01 Z-0.04000 M98 P1
G01 Z-0.06000 M98 P1
G01 Z-0.08000 M98 P1
G01 Z-0.10000 M98 P1
G01 Z-0.12000 M98 P1
G01 Z-0.14000 M98 P1
G01 Z-0.16000 M98 P1
G01 Z-0.18000 M98 P1
G01 Z-0.20000 M98 P1
G01 Z-0.22000 M98 P1
G01 Z-0.24000 M98 P1
G01 Z-0.26000 M98 P1
G01 Z-0.28000 M98 P1
G01 Z-0.30000 M98 P1
M30


O1 (Subroutine - Contour the part)
G01 X2.06200 Y0.00000
G03 X2.12400 Y0.06200 I0.00000 J0.06200
G01 X2.12400 Y0.81200
G03 X2.06200 Y0.87400 I-0.06200 J0.00000
G01 X1.77334 Y0.87400
G03 X1.76165 Y0.87290 I-0.00004 J-0.06200
G03 X1.75000 Y0.87400 I-0.01165 J-0.06090
G01 X1.43700 Y0.87400
G03 X1.37500 Y0.81200 I0.00000 J-0.06200
G01 X1.37500 Y0.62404
G01 X1.31196 Y0.62400
G03 X1.25000 Y0.56200 I0.00004 J-0.06200
G01 X1.25000 Y0.24904
G01 X1.24900 Y0.24904
G01 X1.24900 Y0.56200
G03 X1.18700 Y0.62400 I-0.06200 J0.00000
G01 X1.06200 Y0.62400
G03 X1.00000 Y0.56200 I0.00000 J-0.06200
G01 X1.00000 Y0.24904
G01 X0.99900 Y0.24904
G01 X0.99900 Y0.56200
G03 X0.93700 Y0.62400 I-0.06200 J0.00000
G01 X0.81200 Y0.62400
G03 X0.75000 Y0.56200 I0.00000 J-0.06200
G01 X0.75000 Y0.24904
G01 X0.74900 Y0.24904
G01 X0.74900 Y0.56200
G03 X0.68700 Y0.62400 I-0.06200 J0.00000
G01 X0.56200 Y0.62400
G03 X0.50000 Y0.56200 I0.00000 J-0.06200
G01 X0.50000 Y0.24904
G01 X0.49900 Y0.24904
G01 X0.49900 Y0.56200
G03 X0.43700 Y0.62400 I-0.06200 J0.00000
G01 X0.31200 Y0.62400
G03 X0.25000 Y0.56200 I0.00000 J-0.06200
G01 X0.25000 Y0.24954
G02 X0.24900 Y0.24954 I-0.00050 J0.00000
G01 X0.24900 Y0.56200
G03 X0.18700 Y0.62400 I-0.06200 J0.00000
G01 X0.06200 Y0.62400
G03 X0.00000 Y0.56200 I-0.00000 J-0.06200
G01 X0.00000 Y0.06200
G03 X0.06200 Y0.00000 I0.06200 J-0.00000
M99
__________________
Gary Shepherd
www.16tracks.com
Reply With Quote

  #8   Ban this user!
Old 11-20-2007, 12:47 AM
Mitsui Seiki's Avatar  
Join Date: Feb 2007
Location: USA
Posts: 464
Mitsui Seiki is on a distinguished road

This is a little shorter.
You use G91 G1 Z -0.02 at the end of the sub prog (O01)
And you need to have a second sub prog (O02)without the Z drop at the end..
That takes up more space in your machine though.
Unless you use block skip on the Z drop and turn it on when it does it's last run.That way you don't need the second sub prog.


Code:
(Drilling Shaft Hole with 3/8" drill)
N1 G00 Z2
N2 G00 X1.749 Y0.437
N3 G01 Z0.1 F25
N4 G01 Z-0.3 F15
N5 G00 Z1.5 F25
N6 M0 (change to 1/8" endmill)

G00 Z0.20000
G00 X0.06200 Y0.00000 
G01 X0.06200 Y0.00000 F150.00 
M98 P1
M98 P1
M98 P1
M98 P1
M98 P1
M98 P1
M98 P1
M98 P1
M98 P1
M98 P1
M98 P1
M98 P1
M98 P1
M98 P1
M98 P2
M30


O1 (Subroutine - Contour the part)
G01 X2.06200 Y0.00000
G03 X2.12400 Y0.06200 I0.00000 J0.06200
G01 X2.12400 Y0.81200
G03 X2.06200 Y0.87400 I-0.06200 J0.00000
G01 X1.77334 Y0.87400
G03 X1.76165 Y0.87290 I-0.00004 J-0.06200
G03 X1.75000 Y0.87400 I-0.01165 J-0.06090
G01 X1.43700 Y0.87400
G03 X1.37500 Y0.81200 I0.00000 J-0.06200
G01 X1.37500 Y0.62404
G01 X1.31196 Y0.62400
G03 X1.25000 Y0.56200 I0.00004 J-0.06200
G01 X1.25000 Y0.24904
G01 X1.24900 Y0.24904
G01 X1.24900 Y0.56200
G03 X1.18700 Y0.62400 I-0.06200 J0.00000
G01 X1.06200 Y0.62400
G03 X1.00000 Y0.56200 I0.00000 J-0.06200
G01 X1.00000 Y0.24904
G01 X0.99900 Y0.24904
G01 X0.99900 Y0.56200
G03 X0.93700 Y0.62400 I-0.06200 J0.00000
G01 X0.81200 Y0.62400
G03 X0.75000 Y0.56200 I0.00000 J-0.06200
G01 X0.75000 Y0.24904
G01 X0.74900 Y0.24904
G01 X0.74900 Y0.56200
G03 X0.68700 Y0.62400 I-0.06200 J0.00000
G01 X0.56200 Y0.62400
G03 X0.50000 Y0.56200 I0.00000 J-0.06200
G01 X0.50000 Y0.24904
G01 X0.49900 Y0.24904
G01 X0.49900 Y0.56200
G03 X0.43700 Y0.62400 I-0.06200 J0.00000
G01 X0.31200 Y0.62400
G03 X0.25000 Y0.56200 I0.00000 J-0.06200
G01 X0.25000 Y0.24954
G02 X0.24900 Y0.24954 I-0.00050 J0.00000
G01 X0.24900 Y0.56200
G03 X0.18700 Y0.62400 I-0.06200 J0.00000
G01 X0.06200 Y0.62400
G03 X0.00000 Y0.56200 I-0.00000 J-0.06200
G01 X0.00000 Y0.06200
G03 X0.06200 Y0.00000 I0.06200 J-0.00000
G91G1Z-0.02
G90
M99


O2 (Subroutine - Contour the part)
G01 X2.06200 Y0.00000
G03 X2.12400 Y0.06200 I0.00000 J0.06200
G01 X2.12400 Y0.81200
G03 X2.06200 Y0.87400 I-0.06200 J0.00000
G01 X1.77334 Y0.87400
G03 X1.76165 Y0.87290 I-0.00004 J-0.06200
G03 X1.75000 Y0.87400 I-0.01165 J-0.06090
G01 X1.43700 Y0.87400
G03 X1.37500 Y0.81200 I0.00000 J-0.06200
G01 X1.37500 Y0.62404
G01 X1.31196 Y0.62400
G03 X1.25000 Y0.56200 I0.00004 J-0.06200
G01 X1.25000 Y0.24904
G01 X1.24900 Y0.24904
G01 X1.24900 Y0.56200
G03 X1.18700 Y0.62400 I-0.06200 J0.00000
G01 X1.06200 Y0.62400
G03 X1.00000 Y0.56200 I0.00000 J-0.06200
G01 X1.00000 Y0.24904
G01 X0.99900 Y0.24904
G01 X0.99900 Y0.56200
G03 X0.93700 Y0.62400 I-0.06200 J0.00000
G01 X0.81200 Y0.62400
G03 X0.75000 Y0.56200 I0.00000 J-0.06200
G01 X0.75000 Y0.24904
G01 X0.74900 Y0.24904
G01 X0.74900 Y0.56200
G03 X0.68700 Y0.62400 I-0.06200 J0.00000
G01 X0.56200 Y0.62400
G03 X0.50000 Y0.56200 I0.00000 J-0.06200
G01 X0.50000 Y0.24904
G01 X0.49900 Y0.24904
G01 X0.49900 Y0.56200
G03 X0.43700 Y0.62400 I-0.06200 J0.00000
G01 X0.31200 Y0.62400
G03 X0.25000 Y0.56200 I0.00000 J-0.06200
G01 X0.25000 Y0.24954
G02 X0.24900 Y0.24954 I-0.00050 J0.00000
G01 X0.24900 Y0.56200
G03 X0.18700 Y0.62400 I-0.06200 J0.00000
G01 X0.06200 Y0.62400
G03 X0.00000 Y0.56200 I-0.00000 J-0.06200
G01 X0.00000 Y0.06200
G03 X0.06200 Y0.00000 I0.06200 J-0.00000
M99

Last edited by Mitsui Seiki; 11-20-2007 at 01:14 AM.
Reply With Quote

  #9   Ban this user!
Old 11-20-2007, 12:52 AM
 
Join Date: Oct 2005
Location: USA
Age: 43
Posts: 118
DroopyPawn is on a distinguished road

Ok. What happens when I want to go cut something else? Say for example, I want to cut the same part an inch away from the first part. Do I just set z to 1", move my x and y, and start over or does the G91 cause some kind of problem? Or will a G90 set things back to normal?

Thanks for taking the time to explain all this stuff.
__________________
Gary Shepherd
www.16tracks.com
Reply With Quote

  #10   Ban this user!
Old 11-20-2007, 01:04 AM
Mitsui Seiki's Avatar  
Join Date: Feb 2007
Location: USA
Posts: 464
Mitsui Seiki is on a distinguished road

Do that.And G90 will set it all back to normal.
I changed it a bit.I put the G90 at the end of the sub prog.
Reply With Quote

Sponsored Links
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
How to change Tool change position(About MAZATROL T1 control) liushuixingyun Mazak, Mitsubishi, Mazatrol 5 07-07-2007 02:58 PM
Endmill selection sdantonio Wood Working Tooling 1 04-07-2007 10:44 PM
Please help me identify AMS endmill johnbirch General Metalwork Discussion 0 04-07-2007 03:22 PM
How do you move an axis manually ? Eurisko DIY-CNC Router Table Machines 6 04-06-2007 09:00 PM
Manually starting spindle with edge finder diemaker76 Fadal 21 04-13-2006 06:13 PM




All times are GMT -5. The time now is 10:05 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