Path Postprocessor Customization/en

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 postprocessor 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
 * You might prefer your g-code output in either metric or imperial units.
 * It might be useful to perform a set of moves prior to calling for a tool change to make the action easier for the operator
 * You might wish to include comments for readability or suppress them to keep the program small
 * You might wish to include a custom header to identify or document the program for future reference.

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

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

Preparation for writing your own postprocessor
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 postprocessors such as or  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 postprocessor should get the name

If you are testing, place it in your macro directory. If it functions well, please consider providing it for others to benefit (post it to the FreeCAD Path forum) so that it can be included in the FreeCAD distribution going forward.

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

Related

 * [[Image:Path_PostProcess.svg|24px]] Path PostProcess