chiark / gitweb /
sealing-box: Provide BoxUseShape as separate macro (nfc)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 13 Feb 2016 20:53:04 +0000 (20:53 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 13 Feb 2016 20:53:04 +0000 (20:53 +0000)
sealing-box.scad.m4

index 2cb20f84ccfe0c6a3b1e801403b023f233975674..c3ff461c11b353fb01d945f44dbaba4fe3d3fdcd 100644 (file)
@@ -115,12 +115,18 @@ module SealingBox_CeilProfile(){
     square([wallthick*2, ceilth]);
 }
 
-module TestSealBoxBox(){
-  BoxDoShapeRect(SealingBox_WallProfile(););
-  hull(){ BoxDoShapeRect(SealingBox_FloorProfile();); }
-}
+// BoxDoShape(Basename,BoxDoShapeSomething)
+// generates modules BasenameBox and BasenameLid
+m4_define(`BoxUseShape',`
+  module $1Box(){
+    $2(SealingBox_WallProfile(););
+    hull(){ $2(SealingBox_FloorProfile();); }
+  }
 
-module TestSealBoxLid(){ ////toplevel
-  BoxDoShapeRect(SealingBox_LidProfile(););
-  hull(){ BoxDoShapeRect(SealingBox_CeilProfile();); }
-}
+  module $1Lid(){ ////toplevel
+    $2(SealingBox_LidProfile(););
+    hull(){ $2(SealingBox_CeilProfile();); }
+  }
+')
+
+BoxUseShape(`TestSealBox',`BoxDoShapeRect')