2.8. ADVANCED TOPICS
Post-Processing Scripts
There may be times when the G-Code generated by Slic3r has to be tweaked
or modified after it has been created. For this reason there exists the ability
to run arbitrary scripts as part of the final steps in the slicing process
18
.
In the Output options subsection of the Print Settings tab lies the
Post-processing scripts option. The absolute path to each script can
be added, separated by semicolons. Each scripts should be recognised by
the host system, and be executable.
Figure 2.61: Post-processing script option.
Each script will be passed the absolute path of the G-Code file that
Slic3r generates. All Slic3r configuration options are made available to the
scripts by way of environment variables. These all begin with SLIC3R_.
The following script would write out all Slic3r options to standard output:
#!/bin/sh
echo "Post-processing G-code file: $*"
env | grep ^SLIC3R
Figure 2.62: Example post-processing script to display Slic3r environment
variables.
Example scripts can be found in the GitHub repository
19
.
Perl’s in-place mode (perl -i) makes it easy to modify the contents
of the G-Code file, without having to copy, edit, then replace the original.
The following example will simply output the contents to standard output:
18
https://github.com/alexrj/Slic3r/wiki/Writing-post-processing-scripts
19
https://github.com/alexrj/Slic3r/tree/master/utils/post-processing
119