From d38a78e3f0d0d5e78f2a5f9af996fde136800f43 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 16 Feb 2020 21:11:09 +0000 Subject: [PATCH] quacks-ingredients: counts works Signed-off-by: Ian Jackson --- quacks-ingredients-counts | 11 +++++++++++ quacks-ingredients-counts.scad | 2 ++ 2 files changed, 13 insertions(+) diff --git a/quacks-ingredients-counts b/quacks-ingredients-counts index 6ee3500..a1e5f27 100755 --- a/quacks-ingredients-counts +++ b/quacks-ingredients-counts @@ -20,6 +20,9 @@ $_ = Dumper(\%count); s{^}{// }mg; our $name; +our $total_count; +our $max_nrows=0; +our $max_rowsz=0; sub wrtoplevel () { print "module $name(){ ////toplevel\n"; @@ -27,6 +30,9 @@ sub wrtoplevel () { my $total = 0; $total += $_ foreach values %$cs; my $rowsz = ceil(sqrt($total)); my $nrows = ceil($total / $rowsz); + $total_count += $total; + $max_nrows = $nrows if $nrows > $max_nrows; + $max_rowsz = $rowsz if $rowsz > $max_rowsz; my $ix = 0; print "// total=$total, rowsz=$rowsz, nrows=$nrows\n"; foreach my $nspots (sort keys %$cs) { @@ -54,6 +60,11 @@ foreach $name (sort keys %count) { wrtoplevel(); } +print <error and die $!; __DATA__ diff --git a/quacks-ingredients-counts.scad b/quacks-ingredients-counts.scad index 1c33a55..844d6f5 100644 --- a/quacks-ingredients-counts.scad +++ b/quacks-ingredients-counts.scad @@ -369,3 +369,5 @@ module Yellow(){ ////toplevel translate(token_pitch * [ 2.5, 1.0 ]) Token_L(); }; } +// total_count=216 +// max_rowsz=7 max_nrows=6 -- 2.30.2