Post-processing
Post-processing is a function which allows to change already generated Gcode to fit your hardware requirements.Functions that we want to appear in Post-processing (those one who ready marked with bold):
- Remap: does string replace in gcode. Coud do several replaces at the time.
- Axis remap: to change one axis to another
- Axis Flip: to change one axis to another
- Make Gcode parametric
- Scale and offset
- Round float values to specified degree
- Regexp: makes regular expression replace on each string
- ...
Syntax:
Postprocesing look like a script with commands that are executed one by one. Each command affects whole Gcode.Commands should be separated by semicolon.
Example:
Код: Выделить всё
scale(2,2,1);move(10);parameterize();
Descrpition of the commands
remap
Syntax:
remap("change from"->"change to",...,"change from"->"change to").Remap works very like replace function the only difference that all replaces are done together not one after another.
Example:
Lets take the one line of Gcode: "x 10 y 20".remap("x"->"y","y"->"z"); will give "y10 z20"
But if we'll do to consecutive replaces we'll have the following:
Original: "x 10 y 20"
after replace "x" -> "y" : "y 10 y 20"
after replace "y" -> "z" : "z 10 z 20"
See the difference?
round
Syntax:
round(int precision)Rounds all floating point values to specified precision. Some controllers raises an error if it sees a floating point with long fraction part.
Example:
round(4);will change "G01 Y 3.9912333333 X 11.0000003233 F 400.0000000000" to "G01 Y 3.9912 X 11.0000 F 400.0000"
regexp
Syntax:
regexp (str patern, str replacement);Makes regular expression replace on each string. For regular expression syntax see the python's re. manual: http://docs.python.org/library/re.html .
You can use pythons r" " string format to escape "\" correctly. (Ex. regexp(r"G0(\d)", r"G\1");)
Example:
regexp(r"G0(\d)", r"G\1");Replaces all G01, G02 ... G09 to G1, G2 ... G9.
Will change "G01 Y 3 X 11 F 400" to "G1 Y 3 X 11 F 400"