Simple EMC G-Code Generators Written in Python |
Simple LinuxCNC G-Code Generators Written in Python |
<toc> |
The Python scripts hosted on this wiki page have been moved to a repository on Github, where you can download them individually, or as a Zip file: |
From the official Python web site http://python.org/ "Python is a dynamic object-oriented programming language that can be used for many kinds of software development." Python is powerful,open source, cross platform compatible and easy to learn and use. It has become one of the favorite languages of the EMC development group. A tutorial for Python can be found here http://docs.python.org/tutorial/ |
https://github.com/linuxcnc/simple-gcode-generators |
This page contains links to Python scrips that generate simple G-Codes for EMC. For me to fire up a high dollar CAD program and the use the POST processor to generate simple routines is a time waster. So I'm writing a series of Python programs to do this. If you did an EMC install with Ubuntu you are good to go you have all you need. Make sure you make the mods to your ini file so you can open these up from Axis and paste the generated code directly into Axis... as shown at the bottom of the page. |
The programs will do Facing, Pockets, Slots, Drill Patterns etc. When they are all finished I'll package them all up into one. 1. Drilling Speeds-n-Feeds** This one helps you to calculate the speeds and feeds for drilling ** upload:drill.py Version 0.1 ** Some interesting reading on chip loading upload:Chip%20Load%20on%20Drills.odt 2. Arc Buddy** This one takes the center of an arc, the diameter, the start and end angle and spits out the G-Code ** The start point for the arc and the G2/3 code for the arc are generated. ** There might be a couple of bugs left in the code. If you find one e-mail me and I'll fix it. ** upload:Arc%20Buddy.odt A very short tutorial on Arc Buddy ** upload:Arc%20Tutorial%202.odt A more advanced tutorial on making arcs. ** upload:arcbuddy.py Version 1.1 This is a slightly different version of Arc Buddy that was modified by Sebastian Jardi Estadella for use in gEdit to insert the gcodes. The instructions for use with gEdit are in the comments section. upload:arcbuddy-sje.py 3. Facing SoftwareThe facing software is super simple. You input a few things and press a button and your code is saved to your NC directory ready to open in EMC2! ** upload:face-134.py Version 1.3.4 Last Updated on Jan 6, 2010 License is GNU license. *** for windows users download and rename face-134.py to face-134.pyw, download and install python2.4 [from Python.org] ** Features *** Lead-in, lead-out value can now be changed - version 1.3.4 *** Now has a radio button to set the X0-Y0 (Home) position: Left-Rear or Left-Front - version 1.3.3b ****** To change the default, see the comments in the file *** Now has a radio button for Inch/MM Version 1.3.2 *** Now accepts fractions in any field where this is appropriate. Version 1.3.1 *** One step file save after setting the NC File Directory Option. *** Vertical Scroll Bar added to text box. *** Added Spindle Speed setting that automaticly adds M2 and M5 if you specify a value *** Can leave Depth of Cut, Spindle Speed and Stepover blank. *** Added a menu! *** NC File Directory is saved to an .ini file! *** If you open in Axis you can directly save the g code to Axis!!! ** Undocumented Features *** Assumes that the top of the material is Z0 and nothing is above Z0 4. Bolt Circle Array Software**upload:boltcircle2.py **This program generates a circular array for canned drill cycles in a mill (ie 'bolt circle'). This program used face.py as a template, so it looks very similar. Some of the entry widgets have predefined values in them. Look carefully at these before pressing the 'Generate G-code' button (-Dan Falck). 5. Counterbore Software** upload:counterbore.py ** Version 1.3.1 ** This software generates the G-code for counterbores for socket head cap screws. ** If you have any comments just e mail me Big John T. **Features *** Pick a SHCS from one of the three lists and it puts the standard diameter and depth in for you. *** Minimum entrys needed are hole diameter/depth, tool diameter and location of the hole. *** M2 end of file option if you have to generate several size holes only use it on the last hole. *** Editing of X & Y list with mouse clicks on item. Maintains order if one is edited and put back. *** Speedy entry using number key pad and the key pad enter key for locations. **Bugs *** At this time there is a bug if you have a path that does not require a spiral... working on it 6. Grill Drilling Software** Version 1.3 upload:grill-13.py ** Version 1.2 upload:grill-12.py ** This software peck drills a circular array of holes typically used as a speaker grill or **as ventilation holes in a chassis panel. **Features *** Can drill circular, elliptical, rectangular or oval shaped arrays of holes *** Usable as an axis filter program (see below) *** Gcode can be copied to the clipboard for easy insertion into other gcode programs 7. Bezel Engraving Software** upload:bezel-11.py ** Version 1.1 ** This software engraves a bezel like you would see on the front panel of a stereo around the volume control knobs. **Features *** adjustable number of minor and major ticks *** adjustable start and stop positions *** center position is marked with a dot for later drilling operations *** usable as an axis filter program (see below) *** gcode can be copied to the clipboard for easy insertion into other gcode programs *** use of variables for center point and Z values for easy code block reuse 8. Text Engraving Software** upload:engrave-12.py Version 1.2 ** upload:cxf-fonts.tgz Old format cxf fonts ** This software engraves a text string. **Features *** uses Qcad font files (nice stroked font definitions) *** NOTE: As of 12Sept2014 this version of engrave only knows how to parse Version 1 .cxf font files. *** You can open the font file with a text editor and look at line 3 to see if the font file is compatible. *** Also, if you see the font path highlighted in RED, you probably do not have a correct path to a .cxf font file. *** You will need to obtain .cxf font files from the link above or use the ones from the qcad V2 package (Qcad V3 fonts do NOT parse properly) *** supports flipped(about x axis) or mirrored(about y axis) text *** mirrored text is useful for back cutting on Plexiglas panels *** usable as an axis filter program (see below) *** independent X and Y scaling so the look of a font can be modified *** adjustable character and word spacing *** string can be plotted at any arbitrary angle *** gcode can be copied to the clipboard for easy insertion into other gcode programs *** use of gcode variables for start point, scaling, rotation and Z values for easy code block reuse or tweaking *** Version 1.2 adds variable for linear arc conversion precision 9. Pycam - Drop Cutter Surfacing SoftwareA GPL 3D CNC Toolpath Generation program written by Lode Leroy :http://pycam.wiki.sourceforge.net/ ** Requires python, pyopengl, and togl to run under linux Download from here: :http://sourceforge.net/project/showfiles.php?group_id=237831 10. Dxf2gcode - import a 2D DXF file and produce G-codeWritten by Christian Kohloeffel. Url translated to English by Google: :http://64.233.179.104/translate_c?hl=en&langpair=de|en&u=http://www.christian-kohloeffel.homepage.t-online.de/dxf2gocde.html Original URL: http://www.christian-kohloeffel.homepage.t-online.de/dxf2gocde.html Download from here: :http://code.google.com/p/dxf2gcode/ old dead url(http://dxf2gcode.vegasoft.de/2008-07-27-dxf2gcode_v01_src.zip) This program seems to work pretty well with DXF files from QCAD. 11. Rectangulare-Circulare Pocketing Generator**This is for Generating simple Pocket Style Toolpathes with Differnt depth/stepover **Version 1 does only support Zero Path but you can simply edit the final path to G41 new spiral depth mode (04 2011) **upload:pocket_V1.py **Screenshot : * *** Written by Sammel Lothar Germany 12. Grid Rectangular Circular SpiderNet? G-code Generator**This wars written to test the speed and the acurathy of a milling mashine, with the grid alot of moves are taken and you can see the accurate by, checking Zero Border on the grid if it not harming the outside Shape! Now all shapes and functions are includet Aug_2010! *** upload:grid_v1.py ** ** *** Written by Sammel Lothar Germany 13. Other G Code Generators: http://wiki.linuxcnc.org/cgi-bin/wiki.pl?Cp1 CP1 is a conversational machining program written by Ray Henry and Matt Shaver with additional MOP's by Lawrence Glaister. : http://www.timeguy.com/cradek/truetype A TrueType? tracer with DXF and G-Code output 14. Using Python scripts with Axis** To download a file right click on it and select "Save link as" Do the following...** Place the .py files in your nc directory so it is easy to find ** Right click on the .py file in your file browser and select Properties. On the Permissions tab check Execute on the Owner line. ** Add the following lines to the [FILTER] section of the Axis ini file *** [FILTER] *** PROGRAM_EXTENSION = .py Python Script *** py = python ** If you don't have a [FILTER] section just add it ** Now use File Open in AXIS to open face.py and after you generate the g-code select Write to AXIS and Quit 15. Using Python scripts with Windows** Rename the file from .py to .pyw ** Download and install the python program 16. Using Python scripts onlineHere are some python generators that can be used from emc and online too. They are simple, but you can easily make new ones for yourself... using the hugomatic library, that abstracts the user interface. This is beta software, so please provide feedback. http://hugomatic.ca 17. mGcodeGenerator**It is a script for Blender. It can generate gcode ideal for emc^2 :) it export from mesh ( vertex / edge / edges (outlines) / objects ) to 2d, 2.5d and full 3d for (3axis mill). |
Please submit issues and improvements there. |
The Python scripts hosted on this wiki page have been moved to a repository on Github, where you can download them individually, or as a Zip file:
https://github.com/linuxcnc/simple-gcode-generators
Please submit issues and improvements there.