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! > WoodWorking Machines > DIY-CNC Router Table Machines


DIY-CNC Router Table Machines Discuss the building of home-made CNC Router tables here!


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 12-24-2010, 12:00 PM
 
Join Date: Sep 2007
Location: USA
Posts: 44
maspeir is on a distinguished road
Question Looking for a detailed G code primer.

I've written computer programs since I was 8 in many different languages, so I do not expect that I'll have any difficulty learning g code. However, Google really doesn't turn up much. I can find lists of varying lengths of the various g code commands, but I can find very little in the way of a tutorial. I would like to not only see the complete list of commands, but also an example of each command.

Maybe I'm using the wrong search terms. Can someone direct me to such a tutorial, if it exists?
Reply With Quote

  #2   Ban this user!
Old 12-24-2010, 12:08 PM
 
Join Date: Jul 2005
Location: Canada
Posts: 11,559
Geof will become famous soon enough

This is a very comprehensive course thst covers everything.

MFET 275 - CNC Applications

A thing to be aware of with G and M codes is that there are some differences in code interpretation between different manufacturers. Most codes do mean the same on just about every machine but codes that call up canned routines are often different.
__________________
An open mind is a virtue...so long as all the common sense has not leaked out.
Reply With Quote

  #3  
Old 12-24-2010, 12:21 PM
Al_The_Man's Avatar
Community Moderator
 
Join Date: Dec 2003
Location: Canada
Posts: 16,536
Al_The_Man is on a distinguished road
Buy me a Beer?

The difference also applies to Machine application types, for e.g. the G codes will vary between Mill, Lathe,Gantry (router,plasma,oxy/gas), EDM, Punch press etc, to suit the difference in machine peculiarities.
Also as Geoff points out M codes although often follow traditional practice, are written at the discretion of the MTB, so these can vary between identical controllers.
Get a hold of a copy of CNC Programming Handbook by Peter Smid.
Al.
__________________
CNC, Mechatronics Integration and Machine Design.
“Logic will get you from A to B. Imagination will take you everywhere.”
Albert E.
Reply With Quote

  #4   Ban this user!
Old 12-24-2010, 12:24 PM
 
Join Date: Sep 2007
Location: USA
Posts: 44
maspeir is on a distinguished road

That's good, but I'm hoping for more of a book format. Not necessarily a book, but in the format of a book.

Also, how would one write a g code program to machine a curve path? Let's say, for example, that I want to mill the letter "S" out of wood and I use a drawing program to define the character out of Bezier curves. How do I machine the profile? My guess would be to write a program (not g code) that converts the curves into a series of line segments and then outputs the correct g code. Is there a better way?

Originally Posted by Al_The_Man View Post
The difference also applies to Machine application types, for e.g. the G codes will vary between Mill, Lathe,Gantry (router,plasma,oxy/gas), EDM, Punch press etc, to suit the difference in machine peculiarities.
In my case, strictly mill.

Originally Posted by Al_The_Man View Post
Also as Geoff points out M codes although often follow traditional practice, are written at the discretion of the MTB, so these can vary between identical controllers.
So, if I am using Mach3, I need to write the g code for Mach3's interpretation?

Originally Posted by Al_The_Man View Post
Get a hold of a copy of CNC Programming Handbook by Peter Smid.
Will do, although I'd like an online reference as well. It has been my experience, from a game programming perspective, that technical books pretty much are out of date at the moment of printing. Maybe not so much in this case, but the internet is far more dynamic.
Reply With Quote

  #5  
Old 12-24-2010, 01:01 PM
Al_The_Man's Avatar
Community Moderator
 
Join Date: Dec 2003
Location: Canada
Posts: 16,536
Al_The_Man is on a distinguished road
Buy me a Beer?

You need a CAM system, this follows the CAD operation, Mach has a built in CAM called Lazycam where you can import different CAD or drawing file types.
It also has a Customizable M code application.
Even complicated shapes end up as G code, if not simple arcs or circles then smaller segments are generated.
Al.
__________________
CNC, Mechatronics Integration and Machine Design.
“Logic will get you from A to B. Imagination will take you everywhere.”
Albert E.
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 12-24-2010, 01:04 PM
 
Join Date: Sep 2007
Location: USA
Posts: 44
maspeir is on a distinguished road

Originally Posted by Al_The_Man View Post
You need a CAM system, this follows the CAD operation, Mach has a built in CAM called Lazycam where you can import different CAD or drawing file types.
It also has a Customizable M code application.
Even complicated shapes end up as G code, if not simple arcs or circles then smaller segments are generated.
Al.
I don't have the money for "professional" CAM software and I am aware of LazyCAM. I'll probably use it for a while after my machine is built, but I would like to write my own simple CAM application. Other than that, I would really like to know what my machine is doing or about to do and that requires understanding g code in depth.
Reply With Quote

  #7   Ban this user!
Old 12-24-2010, 01:28 PM
 
Join Date: Oct 2005
Location: US
Posts: 1,220
MrWild is on a distinguished road

You don't need a CAM program, it just makes things easier. I went to a community college and bought a G-code programming book (used) at the book store. It came with a 100 line G-code interpreter (Predator CNC) to show the moves from a written G-code program.

A book from a college book store will teach you how to interpret a blue print, offset your cutter (cutter comp) and do lead in's to your work. Ebay might be a good place to look for a used college book that's cheaper than a college bookstore would be. My book used Fanuc G-code language as the G-code it taught. Fanuc is about as generic a G-code as it comes.
Reply With Quote

  #8  
Old 12-24-2010, 02:22 PM
ger21's Avatar
Community Moderator
 
Join Date: Mar 2003
Location: Shelby Twp, MI....USA
Posts: 20,446
ger21 is on a distinguished road
Buy me a Beer?

Also, how would one write a g code program to machine a curve path? Let's say, for example, that I want to mill the letter "S" out of wood and I use a drawing program to define the character out of Bezier curves. How do I machine the profile? My guess would be to write a program (not g code) that converts the curves into a series of line segments and then outputs the correct g code. Is there a better way?
That's pretty much it. Some CAD programs can export the Bezier curves (spines) as line segments.
__________________
Gerry

Mach3 2010 Screenset
http://home.comcast.net/~cncwoodworker/2010.html

(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
Reply With Quote

  #9  
Old 12-24-2010, 02:31 PM
Al_The_Man's Avatar
Community Moderator
 
Join Date: Dec 2003
Location: Canada
Posts: 16,536
Al_The_Man is on a distinguished road
Buy me a Beer?

Originally Posted by maspeir View Post
but I would like to write my own simple CAM application. Other than that, I would really like to know what my machine is doing or about to do and that requires understanding g code in depth.
If you run a program through Lazycam, you can see the resultant G code to get an example of what you require for programming purposes.
Al.
__________________
CNC, Mechatronics Integration and Machine Design.
“Logic will get you from A to B. Imagination will take you everywhere.”
Albert E.
Reply With Quote

  #10   Ban this user!
Old 12-24-2010, 02:32 PM
johnohara's Avatar  
Join Date: Aug 2008
Location: www.johnohara.net
Posts: 178
johnohara is on a distinguished road
RS274NGC

As a developer, my guess is you'll appreciate this document.

http://citeseerx.ist.psu.edu/viewdoc...=rep1&type=pdf

G-Code files are text, so understanding what the interpreter is looking for is a good place to start.

Another good resource is the EMC2 Project. The source code is available as a free download.

~John
Reply With Quote

Sponsored Links
  #11   Ban this user!
Old 12-24-2010, 07:58 PM
 
Join Date: Sep 2007
Location: USA
Posts: 44
maspeir is on a distinguished road
Thumbs up

Originally Posted by ger21 View Post
That's pretty much it. Some CAD programs can export the Bezier curves (spines) as line segments.
I was really expecting it to be more involved than that. CNC is all about precision and accuracy and representing a curve with line segments is, in the graphics programming world at least, considered to be the least precise and accurate representation of a curve. No matter how finely you subdivide the curve, part of the line segment will always be off of the curve.

Originally Posted by johnohara View Post
As a developer, my guess is you'll appreciate this document.
That is EXACTLY the kind of thing I was looking for! Thanks!

I'll look up the EMC2 project. Sounds interesting.
Reply With Quote

  #12   Ban this user!
Old 12-24-2010, 08:47 PM
judleroy's Avatar  
Join Date: Dec 2006
Location: USA
Posts: 406
judleroy is on a distinguished road

I agree that breaking things up into line segments detracts from accuracy...but... You can decide the standard deviation from the actual curve. That means basicly you can let the path deviate by as much as you want to shorten program length by using longer and fewer line segments. You can also specify better accuracy standards which just means more smaller segments that better apporximate the actual geometry. This can give you accuracy to as close a tolerance as your machine tool can hold. (.01-.001 for a decent cnc router or .001-.0002 for a mill from my experiance).
Judleroy
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 On
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mi primer CNC <<Colombia>> macsim Spanish CNCzone 45 04-11-2012 08:13 AM
Primer post, solicito ayuda. dolordemuela Spanish CNCzone 1 11-23-2010 02:15 PM
Construyendo mi primer Maquina. bernardo Spanish CNCzone 18 11-16-2009 08:48 AM
Newbie- ISO Surface Grinding Primer r11449 General Metalwork Discussion 2 03-21-2009 12:04 PM
A Primer on Soldering kreutz General Electronics Discussion 0 03-17-2008 07:00 PM




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