chiark / gitweb /
sewing-table: RoundCorner: introduce ROUNDCORNER_VARS (nfc)
[reprap-play.git] / sewing-table.scad.m4
index 85659de75f018bea4f3bdf57bd7137f339863abd..3b498f3e10d80dcf9abf17feb1758a0029280075 100644 (file)
@@ -237,6 +237,13 @@ module RoundEdge(left_cnr, right_cnr) {
   }
 }
 
+m4_define(`ROUNDCORNER_VARS',`
+  this_cnr = ci[0];
+  right_cnr = ci[1];
+  left_cnr = ci[2];
+  bigr= round_cnr_rad - round_edge_rad
+')
+
 module RoundCorner_selector(ci, adj) {
   r = round_cnr_rad - round_edge_rad;
   cube(r*2 + adj, center=true);
@@ -245,10 +252,7 @@ module RoundCorner_selector(ci, adj) {
 module RoundCornerCut(ci) {
   // ci should be [this_cnr, right_cnr, left_cnr]
   // where right_cnr is to the right (ie, anticlockwise)
-  this_cnr = ci[0];
-  right_cnr = ci[1];
-  left_cnr = ci[2];
-  bigr= round_cnr_rad - round_edge_rad;
+  ROUNDCORNER_VARS;
   INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
     difference(){
       RoundCorner_selector(ci, -0.1);
@@ -259,10 +263,7 @@ module RoundCornerCut(ci) {
 }
 
 module RoundCornerAdd(ci) {
-  this_cnr = ci[0];
-  right_cnr = ci[1];
-  left_cnr = ci[2];
-  bigr = round_cnr_rad - round_edge_rad;
+  ROUNDCORNER_VARS;
   INREFFRAME(this_cnr, right_cnr) INREFFRAME_EDGE {
     intersection(){
       RoundCorner_selector(ci, +0.1);