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  
Old 01-22-2011, 04:28 AM
Gold Member
 
Join Date: Oct 2005
Location: Australia
Posts: 2,247
RomanLini is on a distinguished road
Simple G-code samples for testing?

Hi, I am writing some new software for my CNC router and am adding a G-code command interpreter. Previously I have mainly worked in 2D or 2.5D using mainly flat cuts of 2D shapes and layers etc. I also have a 2D to 2D morphing system for doing tapered shapes etc.

Now my goal is to be able to run 3D G-code and cut more complex shapes and to reduce my time as it will be more automated, so I won't have to keep loading new layers etc to do an entire complex job. A lot of my work will remain 2D routing, but it will be nice to add tapered pocket features and some variable height profiling etc all in the one job file.

Currently I have implemented a couple of setup commands, then just G0 for 3D traverses and G1 for 3D cutting, but no arc commands or tool offset commands. And hopefully these will not be needed anyway.

Can anyone please suggest the minimum G-code commands that will allow me to use G-code from other people, and to also allow my software to export G-code that should be usable by others?

Also, I am after some simple G-code examples for testing purposes, preferably with no arc or tool offsets or anything complex and not too large (say under 1000 lines?).

Thank you very much for any help you can provide.
Reply With Quote

  #2   Ban this user!
Old 01-22-2011, 04:38 AM
mmcp42's Avatar  
Join Date: Dec 2010
Location: UK
Posts: 219
mmcp42 is on a distinguished road

I built a gCode interpreter based on RepRap (et al) that implements just this subset:
G0 rapid move
G1 controlled move
G4 dwell
G20 set inches
G21 set mm
G28 move to origin
G90 set absolute
G91 set relative
G92 set home
you'll probably also need:
M0 stop
M2 program end
M3 spindle clockwise
M4 spindle anti-clockwise
M5 spindle stop
M226 pause
M254 program start
If it's half as good as your PID controller - there'll be a queue before you even pick up your coding pencil
(can I take a number please?)

I have some sample PCB mill gcode if you'd like?
Reply With Quote

  #3  
Old 01-22-2011, 06:20 AM
ger21's Avatar
Community Moderator
 
Join Date: Mar 2003
Location: Shelby Twp, MI....USA
Posts: 20,454
ger21 is on a distinguished road
Buy me a Beer?

1000 lines isn't much for 3D. Objects that are about 75mm x 75mm can require over 100,000 lines. Here's ±5000, just cut out what you don't need.

Edit. There's an A axis move at the start that you probably need to remove. remnant from the 4 axis post.
Attached Files
File Type: txt Roman_Test.txt‎ (85.2 KB, 234 views)
__________________
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

  #4  
Old 01-22-2011, 08:23 PM
Gold Member
 
Join Date: Oct 2005
Location: Australia
Posts: 2,247
RomanLini is on a distinguished road

Thanks mmcp42, that's a nice concise list. I wasn't really thinking of releasing it, it's just a windows software to allow me to import and export files and of course do g-code tweaking and processing to make my life easier.

Currently it imports and exports basic HPGL PLT and g-code, and displays the move paths in top down and a few 3D views, and it has some editiing features so I can move the coords or scale the coords, either all coords or just ones in a user defined range etc. I was going to put some 2D-2D morphing in it as I already have that written in my other software. A make-duplicate feature is next on my list so it can import one g-code and then lay out a few of them in an array.

I thought there was plenty of windows software that have these features already released? Basically I was just coding my own because it's handy (being a programmer) having a tool I can change and adapt, and because I can make it optimised for my machine and my exact needs. Or do you think there is a need for a program like this?

Can you confirm that G0 and G1 (ok G28) are the only actual "moving" commands needed to make useful g-code?

And I would love to see the PCB g-code too if you don't mind.

Ger21- Thanks for the sample, I will have a play with it. I just said a limit of 1000 lines thinking it would be easier for people.
Reply With Quote

  #5   Ban this user!
Old 01-23-2011, 05:18 AM
mmcp42's Avatar  
Join Date: Dec 2010
Location: UK
Posts: 219
mmcp42 is on a distinguished road

indeed
G0 for "positioning"
and
G1 for "doing"
would be fine
you can just ignore anything else that you get

here's a couple of PCBs "wot i rote"
limit switch
Arduino CameraAxe

both made using Eagle and pcb-gcode

enjoy
Reply With Quote

Sponsored Links
  #6  
Old 01-24-2011, 07:35 PM
Gold Member
 
Join Date: Oct 2005
Location: Australia
Posts: 2,247
RomanLini is on a distinguished road

Thanks for the help Mmcp42 and Ger21.

I have basic g-code import, translation and display working ok, and thought you might like to see the results.

First photo is a "sphere in cube" example I found on the forum, second is your g-code Ger21, it looks like a sculpted 1/4 round object (part of a plaque?). Last item is your massive PCB gcode Mmcp42, it works fine and I also downloaded pcb-gcode ULP (same program as you used) and might have a play with some Eagle outputs later.

Mmcp42- May I ask what you meant by "If it's half as good as your PID controller - there'll be a queue...", did you think I was making a hardware device to interpret g-code? Isn't there already one of those?
Attached Thumbnails
Click image for larger version

Name:	GM1.jpg‎
Views:	95
Size:	128.4 KB
ID:	124791   Click image for larger version

Name:	GM2.gif‎
Views:	67
Size:	26.5 KB
ID:	124792   Click image for larger version

Name:	GM3.gif‎
Views:	78
Size:	41.3 KB
ID:	124793  
Reply With Quote

  #7  
Old 01-24-2011, 10:13 PM
Al_The_Man's Avatar
Community Moderator
 
Join Date: Dec 2003
Location: Canada
Posts: 16,539
Al_The_Man is on a distinguished road
Buy me a Beer?

Originally Posted by RomanLini View Post

Can you confirm that G0 and G1 (ok G28) are the only actual "moving" commands needed to make useful g-code?
Roman G0 is considered rapid non-interpolated move, G1 is set by F feedrate and is interpolated.
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

  #8   Ban this user!
Old 01-25-2011, 02:28 AM
mmcp42's Avatar  
Join Date: Dec 2010
Location: UK
Posts: 219
mmcp42 is on a distinguished road

Originally Posted by RomanLini View Post
...
Mmcp42- May I ask what you meant by "If it's half as good as your PID controller - there'll be a queue...", did you think I was making a hardware device to interpret g-code? Isn't there already one of those?
Not sure I know the real answer, but I sense that a lot of CNC software runs on PCs and use the parallel port to spit out timing signals to fairly dumb driver boards
That's the reasoning behind why I went down the "smart controller" route (apart from I like playing )
a) uses USB to talk PC-controller
b) offloads the generation of timing to hardware close to the drivers

I have implemented the subset I mentioned in an earlier post
I did wonder if you may be heading the same way

If you are thinking of building a hardware controller (like your PID controller) especially if you implemented acceleration, I am sure there would be a market.

RomanCNC -> USB -> RomanController -> Drivers -> Steppers

If you want more bits and bytes about where I've got to - very happy to share.

cheers!
Mike
Reply With Quote

  #9   Ban this user!
Old 01-25-2011, 01:30 PM
mmcp42's Avatar  
Join Date: Dec 2010
Location: UK
Posts: 219
mmcp42 is on a distinguished road

d'oh
and then you stumble across this
Reply With Quote

  #10   Ban this user!
Old 01-26-2011, 01:21 AM
 
Join Date: Jul 2007
Location: Greece
Posts: 7
nian_id is on a distinguished road

Originally Posted by RomanLini View Post
Can you confirm that G0 and G1 (ok G28) are the only actual "moving" commands needed to make useful g-code?
I really think you should include arcs (G2, G3)
Reply With Quote

Sponsored Links
  #11  
Old 01-26-2011, 04:38 AM
Gold Member
 
Join Date: Oct 2005
Location: Australia
Posts: 2,247
RomanLini is on a distinguished road

Al_the_man- Thanks for the tip, so let me see if I understand you right; regarding G0 it should move at the max rapid speed for the longest moving axis and not an exact hypotenuse speed as used for G1 cutting?

Mmcp42- Thanks for the link, I had not seen that product. It looks to have a PC software and USB controlled step generator in hardware. I think is a bit like the Smoothstepper product but from what I know about Smoothstepper it communicates directly with Mach3. There must be a few more products like that as well.

RomanCNC -> USB -> RomanController -> Drivers -> Steppers
Actually that's exactly the way I made my little CNC plastics mill in January last year; RomanLini's hobby_small_plastics_mill_router

Do you have a build log for your machine and electronics? I'd love to see it! As for a commercial hardware CNC driver I really wouldn't want to enter a "PC->USB controller" market that has great products like the Smoothstepper etc, it's much more preferable for me to create a product where there is a complete gap in the market (like the SuperPID for example).

Anyway this windows software I'm working on is mainly just to create a useful tool for me, at this point anyway.

Nian_id- Thanks for the suggestion to include arcs. I did consider arc importing, then converting to small linear moves as my machine hardware can only do linear moves.

Do people really use arcs much in their g-code? The impression I got from the CNC router crowd was that they normally export DXF to linear g-code and just use that on their machines. I thought arcs were more for the metalworking guys that cut round bearing recesses etc?

Last edited by RomanLini; 01-26-2011 at 04:55 AM.
Reply With Quote

  #12   Ban this user!
Old 01-26-2011, 07:20 AM
mmcp42's Avatar  
Join Date: Dec 2010
Location: UK
Posts: 219
mmcp42 is on a distinguished road



here's a link my build log
a bit higgledly piggledy
but ...

I have been watching several of your threads
had seen the plastics router one (excellent btw!), but managed to not see the bit where you mention the controller

and as for arcs
the Eagle - gcode route seems to code up circular pads as lots of short x and y movements
sounds like a tinkly piano when it's drawing them!
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
NC-Corrector, New Free G-code Editor for testing CyberPunk Coding 14 03-17-2012 12:26 PM
Need (hopefully simple)G code Help inventor30 General CNC (Mill and Lathe) Control Software (NC) 2 11-12-2010 05:32 AM
G-code testing on a SCM tech Z25 plus PuresoundGuitar WoodWorking 5 02-23-2009 07:47 PM
Need help with simple G code Step by Step Coding 2 10-24-2008 08:49 PM
Tutorials , exercices, samples , mold samples engrsc Solidworks 4 02-22-2007 09:24 AM




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