diff --git a/cameo/fped2d2z.pl b/cameo/fped2d2z.pl index e4c5fe9..01df3fd 100755 --- a/cameo/fped2d2z.pl +++ b/cameo/fped2d2z.pl @@ -14,8 +14,10 @@ sub usage { - print STDERR "usage: $0 [-r] [Zin=Zout ...] prefix [file ...]\n\n"; + print STDERR "usage: $0 [-r|-t Zmax] [Zin=Zout ...] prefix ". + "[file ...]\n\n"; print STDERR " Zin=Zout replace Zin with Zout\n"; + print STDERR " -t Zmax set the top of the piece\n"; print STDERR " -r reverse Z stacking. Also swaps X and Y.\n"; exit(1); } @@ -25,6 +27,10 @@ if ($ARGV[0] eq "-r") { shift @ARGV; $reverse = 1; } +if ($ARGV[0] eq "-t") { + shift @ARGV; + $top = shift @ARGV; +} &usage if $ARGV[0] =~ /^-[^0-9]/; while ($ARGV[0] =~ /=/) { @@ -55,6 +61,12 @@ if ($reverse) { } %z = %t; print "0 0 $zmax\n\n"; +} elsif (defined $top) { + for (keys %z) { + ($t{$top-$_} = $z{$_}) =~ + s/^(-?\d+(\.\d*)?)\s+(-?\d+(\.\d*)?)/$1 $3/mg; + } + %z = %t; } else { print "0 0 0\n\n"; }