Skip to content

CNC Post Processors

Alessio Cavalieri edited this page Aug 7, 2017 · 4 revisions

−Table of Contents

I. Post-processors for FABlin
    1. What is a post-processor
    2. Flatcam post-processor
    3. Heekscad post-processor
    4. Makercam post-processor
II. Setting up a bash emulator shell in Windows

I. Post-processors for FABlin

  1. What is a post-processor

The GCode generated by different SW applications is generally neither optimized nor compatible with a given CNC machine. A post-processor is a SW application dependent program that converts the GCode generated by that SW application into the specific GCode valid for a given CNC machine. In some SW applications, like Heekscad, the post-processor is integrated into the SW application. Others, like FlatCAM, do not support this feature (yet), so a separate application / script must be executed taking as input the GCode output by the SW application. 2. Flatcam post-processor

This is a bash script. I runs on any Linux bash. If you are using Windows look here to know how to set up a bash environment in Windows.

The script can be downloaded from here.

Usage:

./post_process.sh input.gcode 15000

where:

  • input.gcode is the file output by FlatCAM.

  • the second value (15000 in the example) is the rpms of the spindle (recent versions of FlatCAM allow to set the spindle in FlatCAM, if you do it so, this script may not work. Just do not set the spindle in FlatCAM).

Other related scripts

In the same repository you can find this other two scripts:

addfinishingpass.sh

A very simple script that adds an additional pass with a higher depth. The depth can be controlled by the script:

usage: addfinishingpass.sh Protohead_v4_FAB_rc1-F_Cu.gbr_iso1_cnc_2_0.5mm_postprocessed.gcode 0.025

The number is the “extra depth” of the finishing pass. So if your file is coded to mill away 0.075 mm, it will do a first pass with that amount and a second finishing pass with 0.1 mm (0.075+0.025).

mergepostprocessedfiles.sh

It merges several gcode files (to be executed with the same tool) into a single one.

mergepostprocessedfiles.sh Protohead_v4_FAB_rc1-F_Cu.gbr_iso1_cnc_2_0.5mm_postprocessed_finishpath.gcode Protohead_v4_FAB_rc1-F_Cu.gbr_iso3_cnc_2_0.5mm_postprocessed_finishpath.gcode

generates a Protohead_v4_FAB_rc1-F_Cu.gbr_iso1_cnc_2_0.5mm_postprocessed_finishpath_merged.gcode with both files executed in the given order.

Tip: This mergepostprocessedfiles.sh script is born deprecated, because FlatCAM +8.0 already includes a tool to “join” geometry into a “combo” and then generate gcode for this combo. So the script is there, but I will use the “join geometry” in the “Edit” menu instead for this purpose. The of course, I will have to post-process the output and probably add a finishing pass using the other script. 3. Heekscad post-processor

The result is also gcode that is not usable with the FABtotum. But I have written a post processor for Heekscad that you can download from here. This is much more integrated that in the FlatCAM case, you just install it once and then all the gcode that is generated is compatible with the FAB.

In the repo there is an installation script that is Linux and distribution specific. The idea is that you have to copy the machines.xml file to the directory where all your machine definitions reside, in my case /usr/share/heekscnc/machines.xml and marlin.py to the directory containing the post-processor scripts, in my case /usr/lib/heekscnc/nc/marlin.py.

  1. Makercam post-processor

MakerCAM2FABtotum

GCODE postprocessor from MakerCAM to FABtotum (FABlin)

Based on imarin flatcam2fabtotum (https://github.com/imarin2/Flatcam2FABtotum) post processor, is a CAM gcode post processor from Makercam generated gcode to FABlin (Marlin based) CNC firware.

How to find them

https://github.com/alessiocavalieri/MakerCAM2FABtotum

How to use

This is a bash shell script, so it is intended to be used in Linux/Unix or in any other bash compatible environment

It is used like this:

./post_process.sh filename.gcode 12000

the first parameter is the gcode file to convert. the second parameter is the RPMSs (rotation speed) of the spindle.

This will result in a new file named:

filename_postprocessed.gcode

being created. This file is now FABtotum compatible.

Video tutorial: run bash on Windows

Via Git Desktop bash, you are able to run makercam2fabtotum script

FABtotum #13: videotutorial GCODE postprocessor, run bash under windows (makercam2fabtotum)

Logs

2015_09_21 - v.0.1b

in whole file

  • after the line that start with G0, add Fxxx (for example F10000) in order to speedup movement in rapids in the head of file
  • replace G21 G90 G40 with G90
  • delete T0 M6 row
  • delete G17 row

in the tail of file

  • delete M5 row
  • delete M30 row

II. Setting up a bash emulator shell in Windows

I believe this is the process that worked for me but I did try an awful lot of different ways to get Imarin's bash scripts to work in windows and so some components MAY have been installed which I didnt see. If this doesn't work for you please let me know and perhaps I can help. (FABtotum forum user skintoss).

Download GitHub Desktop from here

Copy and save Imarin's bash script to post-process your gcode files from here. The script is just over half way down the page but if you have not milled before then the whole page is worth a read. Name it something simple but identifying as you will be typing its name a lot! Save it into a file where you are going to save your milling gcode files e.g.

you can see in this folder I have my original files, post-processed files and the shell script (gcode_marlin2)

To get the shell script to process the files you will need (after installing GitHub Desktop) to right click in the open window and you should see the Git options.

from here you need to select 'Git Bash Here' which opens a new window like so:

In this window you need to type $ bash (name of script file).sh (name of g.code file).gcode 15000

like so:

hit enter and a _postprocessed.gcode file should apear in you folder alongside the original. You can then load the _postprocessed.gcode file into the FABtotum object manager and use it for milling!

Seems simple now so I hope this works for you but as said above, if not let me know and ill see what I can do.

Clone this wiki locally
You can’t perform that action at this time.