Date:2013-11-02 17:26:04 (5 months 21 days ago)
Author:Werner Almesberger
Commit:4fa9e129ee75ed86b4db629094622a41a760029a
Message:cameo/fped2stl.pl: sort layers by Z position

This way, the ordering of the layer stack doesn't matter.
Files: cameo/fped2stl.pl (2 diffs)

Change Details

cameo/fped2stl.pl
2323
2424sub flush
2525{
26    local ($z1) = sprintf("%e", $_[0]);
26    local ($name, $z, $z1, $s) = @_;
2727
28    $z = sprintf("%e", $z);
2928    return unless defined $s;
29    $z = sprintf("%e", $z);
30    $z1 = sprintf("%e", $z1);
3031print STDERR "$name $z ...\n";
3132    $^F = 20;
3233    pipe SR, SW;
...... 
6667$skip = 1;
6768while (<>) {
6869    if (/^# $pfx(.*?)-(\d+(\.\d*)?)\s*$/) {
69        &flush($2);
70        $name = $1;
7170        $z = $2;
72        undef $s;
71        $name{$z} = $1;
72        undef $s{$z};
7373        $skip = 0;
7474    } elsif (/^# /) {
7575        $skip = 1;
7676    }
7777    next if $skip;
7878    next if /^#/;
79    $s .= $_;
79    $s{$z} .= $_;
80}
81
82undef $last;
83for $z (sort { $b <=> $a } keys %s) {
84    &flush($name{$last}, $last, $z, $s{$last}) if defined $last;
85    $last = $z;
8086}
81&flush(0);
87&flush($name{$last}, $last, 0, $s{$last});

Archive Download the corresponding diff file

Branches:
master



interactive