From: Ian Jackson Date: Sat, 6 Feb 2016 19:44:23 +0000 (+0000) Subject: commitid.scad.pl: Add $size parameter to gen3dmodule (nfc as yet) X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=5df9e389ad6b418dd5578d9b4c6eef4b7f0c0ffc;p=reprap-play.git commitid.scad.pl: Add $size parameter to gen3dmodule (nfc as yet) --- diff --git a/commitid.scad.pl b/commitid.scad.pl index c1d3a4c..0eac05d 100755 --- a/commitid.scad.pl +++ b/commitid.scad.pl @@ -283,7 +283,9 @@ sub argl_formal (@) { join ', ', @_; } sub argl_actual (@) { join ',', map { m/=/ ? $` : $_ } @_; } sub gen3dmodule ($@) { - my ($modb,@argl) = (@_); + my ($modb,$size,@argl) = (@_); + $size ||= "${modb}_sz()"; + p " // size = $size\n"; p "module ${modb}(".argl_formal(@argl)."){\n"; p " d=Commitid_depth();\n"; p " translate([0,0,-d]) linear_extrude(height=d*2)\n"; @@ -312,7 +314,7 @@ sub gentextmodule ($@) { } p " }\n"; p "}\n"; - gen3dmodule($modb); + gen3dmodule($modb,''); p sprintf "function %s_sz() = Commitid__scale() * 0.1 * [ %d, %d ];\n", $modb, 2 * ($cols * 4 - 1), 2 * (@lines * 6 - 1); @@ -590,7 +592,7 @@ END p $_ foreach @do; p "}\n"; - gen3dmodule "Commitid_$modname", @argl; + gen3dmodule "Commitid_$modname", 'max_sz', @argl; } sub do_git_best () {