Macro 3d Printer Slicer/it

This code, when run, will export the currently open design to STL file, and open it in the slicing software that you use. This example is for KISSlicer, but can be modified to use Slic3r, Cura, or any other 3d printer software. It can also be modified slightly to open up CAM software for CNC machines.

It is best used by creating a link to the macro on the toolbar, and when your ready to slice the object, just click it and your object, as it appears on the screen in FreeCAD will appear on your slicing software's interface, ready to slice. It will also create an STL file with the same filename as the design file in the same directory as the design file as a backup.



Script
The SLICER variable can be changed to any slicing software of your choosing, just make sure to set it before you try running it or it'll flag an error with the script.

Credits
Thanks to Wmayer for his help in writing this script.

Original forum topic: http://forum.freecadweb.org/viewtopic.php?f=10&t=4686