From 1196805d0dafd3aae7759e89ee147404d5ad5d32 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 5 Feb 2016 15:54:12 +0000 Subject: [PATCH] commitid.scad.pl: Provide %s_sz --- commitid.scad.pl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/commitid.scad.pl b/commitid.scad.pl index de1efa8..e7aee60 100755 --- a/commitid.scad.pl +++ b/commitid.scad.pl @@ -90,6 +90,7 @@ sub gentextmodule ($@) { p "module ${modb}_2D(){\n"; p " scale(Commitid__scale()){\n"; my $y = @lines; + my $cols = 1; foreach my $line (@lines) { $y--; my $x = 0; @@ -99,6 +100,7 @@ sub gentextmodule ($@) { $x, $y, chrmodname $chr; $x++; } + $cols = $x if $x > $cols; } p " }\n"; p "}\n"; @@ -106,6 +108,8 @@ sub gentextmodule ($@) { p " d=Commitid_depth();\n"; p " translate([0,0,-d]) linear_extrude(height=d*2) ${modb}_2D();\n"; p "}\n"; + p sprintf "function %s_sz() = Commitid__scale() * 0.1 * [ %d, %d ];\n", + $modb, 2 * (@lines * 6 - 1), 2 * ($cols * 4 - 1); } our @demo; -- 2.30.2