![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| G-Code Programing Discuss G-code programing and problems here! |
| This forum is sponsored by: |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| |||
| |||
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 |
|
#3
| |||
| |||
| 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 |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
| |
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 |