mirror of
git://projects.qi-hardware.com/cae-tools.git
synced 2024-12-22 23:26:27 +02:00
cameo/fped2d2z.pl: new option -t Zmax to set the height of the workpiece
This is similar to -r, except that we don't swap X and Y, and we use the specified value instead of searching for the maximum in the input data.
This commit is contained in:
parent
53fe70950d
commit
c73509dacc
@ -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";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user