chiark / gitweb /
bike-lipo-box: TestSeal: change macro plumbing (nfc)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 12 Feb 2016 00:01:32 +0000 (00:01 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 12 Feb 2016 00:01:32 +0000 (00:01 +0000)
bike-lipo-box.scad.m4

index 56fcaa05613abf0e0cd65fdaefc661e83acf6200..a468a1592cd781473ad8b60b204609650cdb707a 100644 (file)
@@ -67,31 +67,34 @@ ts_zbox = 20;
 ts_innertube = 0.1;
 
 m4_dnl Box_Part($1=transl_x,$2=transl_y, $3=rot_z,$4=mirror_xy)
-m4_dnl          $5=kind(kindargs)
-m4_dnl   profile(profileargsargs);
+m4_dnl          $5=kind, $6=kindargs, $7=profile(profileargsargs))
 m4_define(`Box_Part',`
   translate([($1),($2)])
     rotate([0,0,($3)])
     mirror([($4),0,0])
-    BoxPart_Extrude_$5') m4_dnl
+    BoxPart_Extrude_$5($6, $7)') m4_dnl
 
 boxpart_d = 0.01;
 
-m4_dnl BoxPart_Extrude_Linear(dist) profile(...);
+m4_dnl BoxPart_Extrude_Linear(dist, `profile(...);');
 m4_define(`BoxPart_Extrude_Linear',`
   rotate([90,0,0])
     translate([0,0, -($1)])
-    linear_extrude(height= boxpart_d + ($1))
+    linear_extrude(height= boxpart_d + ($1)) {
+      $2
+    }
 ')
 
-m4_dnl BoxPart_Extrude_Arc(outer_radius, swept_angle)
+m4_dnl BoxPart_Extrude_Arc(outer_radius, swept_angle, `profile(...);')
 m4_dnl  arc starting at transl_x, transl_y, moving towards positive
 m4_dnl  y at first and then bending towards positive x, until
 m4_dnl  swept_angle is reached
 m4_define(`BoxPart_Extrude_Arc',`
   translate([+($1),0,0])
     rotate_extrude(angle=($2), convexity=10, $fs=1, $fn=36)
-    translate([-($1),0,0])
+    translate([-($1),0,0]) {
+      $3
+    }
 ')
 
 ts_xbox_lin = ts_xbox - ts_cnrrad*2;
@@ -99,14 +102,14 @@ ts_ybox_lin = ts_ybox - ts_cnrrad*2;
 
 m4_dnl TestSealDoBoxShape(`profile(profileargs)');
 m4_define(`TestSealDoBoxShape',`
-  Box_Part(0,               ts_cnrrad,    0,0, Linear(ts_ybox_lin)) $1;
-  Box_Part(0, ts_ybox-ts_cnrrad,          0,0, Arc(ts_cnrrad,90)  ) $1;
-  Box_Part(ts_cnrrad,       ts_ybox,    -90,0, Linear(ts_xbox_lin)) $1;
-  Box_Part(ts_xbox-ts_cnrrad, ts_ybox,  -90,0, Arc(ts_cnrrad,90)  ) $1;
-  Box_Part(ts_xbox, ts_ybox-ts_cnrrad, -180,0, Linear(ts_ybox_lin)) $1;
-  Box_Part(ts_xbox,         ts_cnrrad, -180,0, Arc(ts_cnrrad,90)  ) $1;
-  Box_Part(ts_xbox-ts_cnrrad, 0,       -270,0, Linear(ts_xbox_lin)) $1;
-  Box_Part(ts_cnrrad,         0,       -270,0, Arc(ts_cnrrad,90)  ) $1;
+  Box_Part(0,               ts_cnrrad,    0,0, Linear,`ts_ybox_lin', `$1' )
+  Box_Part(0, ts_ybox-ts_cnrrad,          0,0, Arc,`ts_cnrrad,90'  , `$1' )
+  Box_Part(ts_cnrrad,       ts_ybox,    -90,0, Linear,`ts_xbox_lin', `$1' )
+  Box_Part(ts_xbox-ts_cnrrad, ts_ybox,  -90,0, Arc,`ts_cnrrad,90'  , `$1' )
+  Box_Part(ts_xbox, ts_ybox-ts_cnrrad, -180,0, Linear,`ts_ybox_lin', `$1' )
+  Box_Part(ts_xbox,         ts_cnrrad, -180,0, Arc,`ts_cnrrad,90'  , `$1' )
+  Box_Part(ts_xbox-ts_cnrrad, 0,       -270,0, Linear,`ts_xbox_lin', `$1' )
+  Box_Part(ts_cnrrad,         0,       -270,0, Arc,`ts_cnrrad,90'  , `$1' )
 ')
 
 m4_dnl '
@@ -118,7 +121,7 @@ module TestSealWallProfile(){
 }
 
 module TestSealBox(){
-  TestSealDoBoxShape(`TestSealWallProfile()');
+  TestSealDoBoxShape(`TestSealWallProfile();');
 }
 
 //TestWall();