chiark / gitweb /
sealing-box: Introduce BoxLocals (nfc)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 13 Feb 2016 21:45:31 +0000 (21:45 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 13 Feb 2016 21:45:31 +0000 (21:45 +0000)
sealing-box.scad.m4

index e2b5702a0f79e242eab6cae2b210b8a43ceb5ba0..33b1069ecce0fb45c9a0ee25e2a458d558fa1f5f 100644 (file)
@@ -61,10 +61,12 @@ m4_define(`BoxPart_Extrude_Arc',`
     }
 ')
 
-ts_cidoff = (ts_cnrrad * (1-.7) + wallthick * .8) * [1,1];
+m4_define(`BoxLocals',`
+  ts_cidoff = (ts_cnrrad * (1-.7) + wallthick * .8) * [1,1];
 
-ts_xbox_lin = ts_xbox - ts_cnrrad*2;
-ts_ybox_lin = ts_ybox - ts_cnrrad*2;
+  ts_xbox_lin = ts_xbox - ts_cnrrad*2;
+  ts_ybox_lin = ts_ybox - ts_cnrrad*2;
+')
 
 m4_dnl BoxDoShapeRect(`profile(profileargs)');
 m4_define(`BoxDoShapeRect',`
@@ -81,16 +83,19 @@ m4_define(`BoxDoShapeRect',`
 m4_dnl '
 
 module SealingBox_WallProfile(){
+  BoxLocals
   z = ts_zbox - innertube - tubesealrad;
   translate([0, -0.1]) square([wallthick, z]);
   translate([tubesealrad, z]) circle(r=tubesealrad, $fn=20);
 }
 
 module SealingBox_FloorProfile(){
+  BoxLocals
   mirror([0,1]) square([wallthick, floorth]);
 }
 
 module SealingBox_LidProfile(){
+  BoxLocals
   rad = tubesealrad + innertube;
   morex = wallthick;
   difference(){
@@ -113,6 +118,7 @@ module SealingBox_LidProfile(){
 }
 
 module SealingBox_CeilProfile(){
+  BoxLocals
   translate([0, ts_zbox])
     square([wallthick*2, ceilth]);
 }
@@ -121,11 +127,13 @@ module SealingBox_CeilProfile(){
 // generates modules BasenameBox and BasenameLid
 m4_define(`BoxUseShape',`
   module $1Box(){
+    BoxLocals
     $2(SealingBox_WallProfile(););
     hull(){ $2(SealingBox_FloorProfile();); }
   }
 
   module $1Lid(){
+    BoxLocals
     $2(SealingBox_LidProfile(););
     hull(){ $2(SealingBox_CeilProfile();); }
   }