From 63412ee3da06f90b292673a7185c3cb32862c9d5 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 28 Mar 2020 21:48:58 +0000 Subject: [PATCH] quacks-ingredients: wip Base vs Witches vs Both Put $which in everything Signed-off-by: Ian Jackson --- quacks-ingredients-counts | 12 ++--- quacks-ingredients-counts.scad | 84 +++++++++++++++++----------------- 2 files changed, 48 insertions(+), 48 deletions(-) diff --git a/quacks-ingredients-counts b/quacks-ingredients-counts index 15e6bd8..4913f3c 100755 --- a/quacks-ingredients-counts +++ b/quacks-ingredients-counts @@ -39,7 +39,7 @@ foreach my $nspots (qw(1 2 3 4)) { m/\+/; $count{$names[$i]}{$nspots} = - $which eq 'Both' ? $` + $' : + $which eq 'All' ? $` + $' : $which eq 'Base' ? $` : $which eq 'Witches' ? $' : die "$which ?"; @@ -57,7 +57,7 @@ our $max_nrows=0; our $max_rowsz=0; sub wrtoplevel () { - print "module $name(){ ////toplevel\n"; + print "module ${which}_$name(){ ////toplevel\n"; my $cs = $count{$name}; my $total = 0; $total += $_ foreach values %$cs; my $rowsz = ceil(sqrt($total)); @@ -67,8 +67,8 @@ sub wrtoplevel () { $max_nrows = $nrows if $nrows > $max_nrows; $max_rowsz = $rowsz if $rowsz > $max_rowsz; my $ix = 0; - printf "// %-10s total=%2d rowsz=$rowsz nrows=$nrows\n", - "$name", $total; + printf "// %-5s %-10s total=%2d rowsz=$rowsz nrows=$nrows\n", + $which, "$name", $total; foreach my $nspots (sort keys %$cs) { my $c = $cs->{$nspots}; print <error and die $!; diff --git a/quacks-ingredients-counts.scad b/quacks-ingredients-counts.scad index 1eeb70c..3b0e28f 100644 --- a/quacks-ingredients-counts.scad +++ b/quacks-ingredients-counts.scad @@ -1,8 +1,8 @@ // autogenerated - do not edit // update script is quacks-ingredients-updates-levels // source is quacks-ingredients-counts -module 1xFour(){ ////toplevel -// 1xFour total= 1 rowsz=1 nrows=1 +module Base_1xFour(){ ////toplevel +// Base 1xFour total= 1 rowsz=1 nrows=1 union(){ Frame($phase, token_pitch * [ 1 + 1.00, 1 + 0.50 ]); $nspots = 1; @@ -21,8 +21,8 @@ module 1xFour(){ ////toplevel translate(token_pitch * [ 0.0, 0.0 ]) Token_L(); }; } -module 1xOne(){ ////toplevel -// 1xOne total= 1 rowsz=1 nrows=1 +module Base_1xOne(){ ////toplevel +// Base 1xOne total= 1 rowsz=1 nrows=1 union(){ Frame($phase, token_pitch * [ 1 + 1.00, 1 + 0.50 ]); $nspots = 1; @@ -41,8 +41,8 @@ module 1xOne(){ ////toplevel $nspots = 4; }; } -module 1xThree(){ ////toplevel -// 1xThree total= 1 rowsz=1 nrows=1 +module Base_1xThree(){ ////toplevel +// Base 1xThree total= 1 rowsz=1 nrows=1 union(){ Frame($phase, token_pitch * [ 1 + 1.00, 1 + 0.50 ]); $nspots = 1; @@ -61,8 +61,8 @@ module 1xThree(){ ////toplevel $nspots = 4; }; } -module 1xTwo(){ ////toplevel -// 1xTwo total= 1 rowsz=1 nrows=1 +module Base_1xTwo(){ ////toplevel +// Base 1xTwo total= 1 rowsz=1 nrows=1 union(){ Frame($phase, token_pitch * [ 1 + 1.00, 1 + 0.50 ]); $nspots = 1; @@ -81,8 +81,8 @@ module 1xTwo(){ ////toplevel $nspots = 4; }; } -module 2xFour(){ ////toplevel -// 2xFour total= 2 rowsz=2 nrows=1 +module Base_2xFour(){ ////toplevel +// Base 2xFour total= 2 rowsz=2 nrows=1 union(){ Frame($phase, token_pitch * [ 2 + 1.00, 1 + 0.50 ]); $nspots = 1; @@ -102,8 +102,8 @@ module 2xFour(){ ////toplevel translate(token_pitch * [ 0.5, 0.0 ]) Token_L(); }; } -module 2xOne(){ ////toplevel -// 2xOne total= 2 rowsz=2 nrows=1 +module Base_2xOne(){ ////toplevel +// Base 2xOne total= 2 rowsz=2 nrows=1 union(){ Frame($phase, token_pitch * [ 2 + 1.00, 1 + 0.50 ]); $nspots = 1; @@ -123,8 +123,8 @@ module 2xOne(){ ////toplevel $nspots = 4; }; } -module 2xThree(){ ////toplevel -// 2xThree total= 2 rowsz=2 nrows=1 +module Base_2xThree(){ ////toplevel +// Base 2xThree total= 2 rowsz=2 nrows=1 union(){ Frame($phase, token_pitch * [ 2 + 1.00, 1 + 0.50 ]); $nspots = 1; @@ -144,8 +144,8 @@ module 2xThree(){ ////toplevel $nspots = 4; }; } -module 2xTwo(){ ////toplevel -// 2xTwo total= 2 rowsz=2 nrows=1 +module Base_2xTwo(){ ////toplevel +// Base 2xTwo total= 2 rowsz=2 nrows=1 union(){ Frame($phase, token_pitch * [ 2 + 1.00, 1 + 0.50 ]); $nspots = 1; @@ -165,8 +165,8 @@ module 2xTwo(){ ////toplevel $nspots = 4; }; } -module 3xFour(){ ////toplevel -// 3xFour total= 3 rowsz=2 nrows=2 +module Base_3xFour(){ ////toplevel +// Base 3xFour total= 3 rowsz=2 nrows=2 union(){ Frame($phase, token_pitch * [ 2 + 1.00, 2 + 0.50 ]); $nspots = 1; @@ -187,8 +187,8 @@ module 3xFour(){ ////toplevel translate(token_pitch * [ 0.5, -0.5 ]) Token_L(); }; } -module 3xOne(){ ////toplevel -// 3xOne total= 3 rowsz=2 nrows=2 +module Base_3xOne(){ ////toplevel +// Base 3xOne total= 3 rowsz=2 nrows=2 union(){ Frame($phase, token_pitch * [ 2 + 1.00, 2 + 0.50 ]); $nspots = 1; @@ -209,8 +209,8 @@ module 3xOne(){ ////toplevel $nspots = 4; }; } -module 3xThree(){ ////toplevel -// 3xThree total= 3 rowsz=2 nrows=2 +module Base_3xThree(){ ////toplevel +// Base 3xThree total= 3 rowsz=2 nrows=2 union(){ Frame($phase, token_pitch * [ 2 + 1.00, 2 + 0.50 ]); $nspots = 1; @@ -231,8 +231,8 @@ module 3xThree(){ ////toplevel $nspots = 4; }; } -module 3xTwo(){ ////toplevel -// 3xTwo total= 3 rowsz=2 nrows=2 +module Base_3xTwo(){ ////toplevel +// Base 3xTwo total= 3 rowsz=2 nrows=2 union(){ Frame($phase, token_pitch * [ 2 + 1.00, 2 + 0.50 ]); $nspots = 1; @@ -253,8 +253,8 @@ module 3xTwo(){ ////toplevel $nspots = 4; }; } -module Black(){ ////toplevel -// Black total=18 rowsz=5 nrows=4 +module Base_Black(){ ////toplevel +// Base Black total=18 rowsz=5 nrows=4 union(){ Frame($phase, token_pitch * [ 5 + 1.00, 4 + 0.50 ]); $nspots = 1; @@ -290,8 +290,8 @@ module Black(){ ////toplevel $nspots = 4; }; } -module Blue(){ ////toplevel -// Blue total=34 rowsz=6 nrows=6 +module Base_Blue(){ ////toplevel +// Base Blue total=34 rowsz=6 nrows=6 union(){ Frame($phase, token_pitch * [ 6 + 1.00, 6 + 0.50 ]); $nspots = 1; @@ -343,8 +343,8 @@ module Blue(){ ////toplevel translate(token_pitch * [ 2.5, 0.5 ]) Token_L(); }; } -module Green(){ ////toplevel -// Green total=38 rowsz=7 nrows=6 +module Base_Green(){ ////toplevel +// Base Green total=38 rowsz=7 nrows=6 union(){ Frame($phase, token_pitch * [ 7 + 1.00, 6 + 0.50 ]); $nspots = 1; @@ -400,8 +400,8 @@ module Green(){ ////toplevel translate(token_pitch * [ 3.0, -1.5 ]) Token_L(); }; } -module Orange(){ ////toplevel -// Orange total=20 rowsz=5 nrows=4 +module Base_Orange(){ ////toplevel +// Base Orange total=20 rowsz=5 nrows=4 union(){ Frame($phase, token_pitch * [ 5 + 1.00, 4 + 0.50 ]); $nspots = 1; @@ -439,8 +439,8 @@ module Orange(){ ////toplevel $nspots = 4; }; } -module Purple(){ ////toplevel -// Purple total=15 rowsz=4 nrows=4 +module Base_Purple(){ ////toplevel +// Base Purple total=15 rowsz=4 nrows=4 union(){ Frame($phase, token_pitch * [ 4 + 1.00, 4 + 0.50 ]); $nspots = 1; @@ -473,8 +473,8 @@ module Purple(){ ////toplevel $nspots = 4; }; } -module Red(){ ////toplevel -// Red total=30 rowsz=6 nrows=5 +module Base_Red(){ ////toplevel +// Base Red total=30 rowsz=6 nrows=5 union(){ Frame($phase, token_pitch * [ 6 + 1.00, 5 + 0.50 ]); $nspots = 1; @@ -522,8 +522,8 @@ module Red(){ ////toplevel translate(token_pitch * [ 2.5, 2.0 ]) Token_L(); }; } -module White(){ ////toplevel -// White total=32 rowsz=6 nrows=6 +module Base_White(){ ////toplevel +// Base White total=32 rowsz=6 nrows=6 union(){ Frame($phase, token_pitch * [ 6 + 1.00, 6 + 0.50 ]); $nspots = 1; @@ -573,8 +573,8 @@ module White(){ ////toplevel $nspots = 4; }; } -module Yellow(){ ////toplevel -// Yellow total=29 rowsz=6 nrows=5 +module Base_Yellow(){ ////toplevel +// Base Yellow total=29 rowsz=6 nrows=5 union(){ Frame($phase, token_pitch * [ 6 + 1.00, 5 + 0.50 ]); $nspots = 1; @@ -621,5 +621,5 @@ module Yellow(){ ////toplevel translate(token_pitch * [ 2.5, 1.0 ]) Token_L(); }; } -// total_count=240 total_real_count=216 -// max_rowsz=7 max_nrows=6 +// Base total_count=240 total_real_count=216 +// Base max_rowsz=7 max_nrows=6 -- 2.30.2