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-01-2008, 12:41 PM
 
Join Date: Jul 2008
Location: USA
Posts: 49
rfrenzl is on a distinguished road
Simple routines for the offering

I thought before I clutter up the forums with useless code, I'd ask to see if there is any interest.

I have written a number of simple g-code programs that do repetitive tasks. To run, you edit the file to use the parameters you choose for that run, save, and execute. The kinds of things I've done are:

G77 code emulation. This can be for Lathe or Mill and emulates a facing job. You enter the length of cut, depth of each cut, speed, and off you go. I use it for many things as it is a lot easier to do than going back to the CAD/CAM program to compile a different version. What is nice about this is that you update parameters at the beginning and the script takes care of the rest. If you know a bit of programming, you can set it up for any axis combination you want.

Hole - create a hole in a bit of stock given the tool diameter, size of hole, depth to cut, and depth for each cut. Does not use tool offset file or any other features that may be in your software. Again, simple and easy to use. I have two versions, one that cuts a circle at a given depth for each pass, and another that ramps down into the stock over the course of a full circle. The later makes for a nice finish. This is NOT the same as clearing a shape or pocketing. It only goes around the circle at the determined diameter. The result is a hole and a disc, depending on which scrape you keep.

Disc - same as Hole but the tool offset is to the outside. Same features, edit the file for your specific part, save, and run.

I've also written code to cut slots in a disc given the number of slots required (like in a timing wheel). This can also be modified to do a circle of hole as in a pattern.
A script to do surfacing of a part with Mill.
And one for just doing simple peck drilling at a given location (I always forget the command structure so use variables and comments).

They all follow the same kind of format with similar variables, while loops, and condition branches. I'm an IT guy by trade and trained in programming (long ago). The code is not hard and should provide a good example for those who are learning. I don't claim that these scripts are great, but they serve a purpose and show some of the features in g-code for doing testing and loops.

If there is enough interest, I can post the code here or make it available via Google or other similar location. I can also create some code if asked. I won't do elaborate scripts but will more than happy to help or provide a stub for someone to use.

Thank you for looking and please comment as to this being good or bad for the forums. I have not really looked but perhaps there should be a specific location for such things. Like a community page for code, examples, and full programs.

Ron

I guess I should state that the programs are written in the form similar to MACH3 or EMC2. I use EMC2 for my machines but I have used very similar code for TurboCNC. For those that use a more propitiatory syntax, they should not have too much trouble converting.

Last edited by rfrenzl; 08-01-2008 at 12:48 PM. Reason: Coomment on Programming source
Reply With Quote

  #2   Ban this user!
Old 08-01-2008, 01:14 PM
 
Join Date: Nov 2003
Location: canada P.Q.
Age: 59
Posts: 84
valmet58 is on a distinguished road
Smile turbocnc

would your code be compatible with turbocnc..Thanks
__________________
Andy
Reply With Quote

  #3   Ban this user!
Old 08-01-2008, 01:22 PM
 
Join Date: Jul 2008
Location: USA
Posts: 49
rfrenzl is on a distinguished road

Andy,

If you note the last line, I started with TurboCNC and the syntax is very similar to what I use in EMC2. I fact, some of my routines I got from examples in TurboCNC.

So the short answer, is yes. They should work without modification or perhaps small changes to add/remove lines for specific functions. For the most part, the programs use "#nnnn" for the variables and "O" lines for loops. If I recall, there are some differences with TurboCNC in that it uses the () to determine variables and EMC2 uses [] and () are for comments. A review of the documentation should make it pretty clear and an editor like notepad can do a mass find and replace to make these kinds of changes. The scripts are simple so anyone with a little experience in programming will have no problems.

Ron
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
Help Making Sub Routines PROTOTRAKFAN Parametric Programing 7 07-14-2008 06:09 PM
Sub Routines on VF3 Rocko1 Haas Mills 8 11-10-2007 02:41 PM
sub routines earl Fanuc 2 03-04-2007 02:34 AM
Sears is offering the CompU Carver now thuffner3 CNC Machining Centers 1 11-25-2006 05:42 AM
JFettig Machines is now offering Plans JFettig Product Announcements & Manufacturer News 3 03-30-2006 07:25 PM




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