Path Postprocessor Customization

Introduction
FreeCAD uses as internal representation for the generated paths so called G-codes. They can describe such things as speed and feed rates, stopping the motor etc. But the most important thing is the movements they describe. These movements are rather simple: They can be straight lines or they can be circular arcs. More sophisticated curves such as B-splines are already approximated by FreeCAD's Path workbench.

What the post processor can do for you
Many mills use G-codes as well to control the milling process. They may look almost like the internal codes, but there may be some differences:
 * the machine can have a special startup sequence
 * it can have a special stop sequence
 * arcs can be defined with a relative or an absolute center
 * it may require line numbers in a certain format
 * it can used so called canned cycles for predefined subprocesses such as drilling

Furthermore there are other languages to control a mill, such as HPGL, DXF, or others.

The post processor is a program which translates the internal codes into a complete file, that can be uploaded to your machine.

Preparation for writing your own post processor
You may start with a very simple model showing how your machine reads straight lines and arcs. Prepare it with any program suitable for your machine.

A file for such paths starting at (0,0,0) and going towards Y would be helpful. Make sure it is the tool itself moving along this path, i.e. no tool radius compensation must be applied.



The path in FreeCAD would look like this. Please note the small blue arrow, it indicates the starting direction. For a very first go you may provide only one level in the XY-plane.



You can then have a look at the file and compare it to the output of existing post processors such as linux_cnc_post.py or grbl_post.py and try yourself to adapt them or you upload your to the path forum https://forum.freecadweb.org/viewforum.php?f=15 to get some help.

Naming convention
For a file format the post processor should get the name _post.py. For your tests you place it in your macro directory. If it works well, please provide it for others so that it can be included in the FreeCAD distribution.

Other existing post processors
For comparison you may look at the post processors which come with your FreeCAD installation. They are located under the Mod directory in Path/PathScripts/post.