Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorAlessandro Ranellucci <aar@cpan.org>2011-12-11 13:20:53 +0400
committerAlessandro Ranellucci <aar@cpan.org>2011-12-11 13:20:53 +0400
commit9a610395ced694a25bcff638cc8db02dd06fef98 (patch)
tree526d5bacda6712eaa15979c819438f146cb96cb5 /utils
parente99de80cd849e323296587b7563f65d910cedab5 (diff)
Move post-processing to utils/ directory
Diffstat (limited to 'utils')
-rwxr-xr-xutils/post-processing/z-every-line.pl23
1 files changed, 23 insertions, 0 deletions
diff --git a/utils/post-processing/z-every-line.pl b/utils/post-processing/z-every-line.pl
new file mode 100755
index 000000000..5f9d311b6
--- /dev/null
+++ b/utils/post-processing/z-every-line.pl
@@ -0,0 +1,23 @@
+#!/usr/bin/perl
+
+use strict;
+
+my $z = 0;
+
+# read stdin and any/all files passed as parameters one line at a time
+for (<>) {
+ # if we find a Z word, save it
+ $z = $1 if /Z(\d+(\.\d+)?)/;
+
+ # if we don't have Z, but we do have X and Y
+ if (!/Z/ && /X/ && /Y/ && $z > 0) {
+ # chop off the end of the line (incl. comments), saving chopped section in $1
+ s/\s*([\r\n\;\(].*)//s;
+ # print start of line, insert our Z value then re-add the chopped end of line
+ print "$_ Z$z $1";
+ }
+ else {
+ # nothing interesting, print line as-is
+ print;
+ }
+}