@@ -34,8 +34,23 @@ output:
34
34
echo "Post-processing G-code file: $*"
35
35
env | grep ^SLIC3R
36
36
37
- For security reasons you can't supply arguments to the scripts. However, you
38
- can just write a wrapper script.
37
+
38
+ #### Post-Processing Script Parameters
39
+
40
+ You can use parameters with your script as such:
41
+
42
+ Examples:
43
+
44
+ ` /path/to/executable ` becomes ` /path/to/executable ` with the arg ` outputfilename.gcode `
45
+
46
+ ` /path/to/executable -arg -arg2 ` becomes ` /path/to/executable ` with ` args -arg, -arg2 ` , and ` outputfilename.gcode `
47
+
48
+ ` /path/to/executable! with! spaces -arg -arg2 ` becomes ` /path/to/executable with spaces with args -arg, -arg2 ` , and ` outputfilename.gcode `
49
+
50
+ ` /path/to/executable!! -arg -arg2 ` becomes ` /path/to/executable! ` with ` args -arg, -arg2 ` , and ` outputfilename.gcode `
51
+
52
+ ` /path/to/executable option! with! spaces ` becomes ` /path/to/executable ` with args ` option with spaces ` and ` outputfilename.gcode `
53
+
39
54
40
55
Perl example
41
56
------------
@@ -58,3 +73,27 @@ If you are getting a *can't do inplace edit without backup* error when specifyin
58
73
the post-process script, try adding ` $^I = '.bak'; ` before the while loop. This will
59
74
create a backup file of the generated G-Code file. Windows does not like to have two
60
75
scripts creating and/or accessing a single file at once, so a backup is needed.
76
+
77
+
78
+ Python example
79
+ --------------
80
+
81
+ #### Windows
82
+ To use a Python post-processing script with Windows, you'll need to adjust the paths like this:
83
+
84
+ C:\Program! Files! (x86)\Python37-32\python.exe c:\dev\SCPP\Slic3rConfigPrettyPrint.py -o --au "John Doe"
85
+
86
+ Note the ** !** before all white-spaces! Make sure you adjust the path to your script as well.
87
+ Yes, you can save your G-Code file to somewhere with spaces in it's path.
88
+
89
+ Your script needs to accept at least one parameter: The filename of your G-Code file.
90
+ ` -o ` and ` --au "John Doe" ` are optional parameters. The filename, of your G-Code, will be added to the end of this string.
91
+
92
+ Python.exe will then run your script with the specified parameters.
93
+
94
+ This ` example.py ` will just output the filename submitted by Slic3r:
95
+
96
+ import sys
97
+ print ('This is the name of your G-Code file: {0}'.format(sys.argv[1]))
98
+
99
+ ` sys.argv[0] ` is the script ` example.py ` .
0 commit comments