chiark / gitweb /
sewing-table: introduce a concat (nfc)
[reprap-play.git] / sewing-table.scad.m4
index 37c2be03e45e5e7a9f4dc7d393bb1b586ce1f639..4d818ef008b7f74a739132673550cbac58024684 100644 (file)
@@ -1,6 +1,7 @@
 // -*- C -*-
 
 include <funcs.scad>
+include <commitid.scad>
 
 ply_th = 18;
 ply_hole_dia = 15;
@@ -46,7 +47,7 @@ module Post(){
 
 module Posts(posts) {
   for (p= posts) {
-    translate([p[0], p[1], 0])
+    translate(concat(p, [0]))
       Post();
   }
 }
@@ -54,9 +55,16 @@ module Posts(posts) {
 module TileBase(botleft_post, topright_post){
   botleft = botleft_post - thehd;
   size = topright_post - botleft_post + thehd * 2;
-  mirror([0,0,1])
-    translate([botleft[0], botleft[1], 0])
-    cube([size[0], size[1], tile_th]);
+  difference(){
+    mirror([0,0,1])
+      translate([botleft[0], botleft[1], 0])
+      cube([size[0], size[1], tile_th]);
+    translate( [ botleft_post[0], botleft_post[1], -tile_th ]
+              + 0.5 * [ post_dia, post_dia, 0 ] )
+      Commitid_BestCount_M( topright_post-botleft_post
+                           + [0, thehd[1] ]
+                           + [-post_dia,-post_dia] );
+  }
 }
 
 m4_dnl  INREFFRAME(left_post, right_post, morevars) { body; }
@@ -76,12 +84,12 @@ m4_define(`INREFFRAME',`
 m4_dnl  INREFFRAME(left_post, right_post, morevars)
 m4_dnl    INREFFRAME_EDGE { body; }
 m4_define(`INREFFRAME_EDGE',`
-  translate([-thehd[1], -thehd[0], -round_edge_rad])
+  translate(concat(-thehd, [-round_edge_rad]))
 ')
 
 module RoundEdge(left_post, right_post) {
   INREFFRAME(left_post, right_post,
-             `tlength = length + thehd[1] * 2;') m4_dnl '
+             `tlength = length + thehd[0] * 2;') m4_dnl '
     INREFFRAME_EDGE {
     difference(){
       rotate([0,90,0])
@@ -105,7 +113,7 @@ module RoundLeftCorner(this_post, right_post) {
 module InterlockCore(r, plusth, ymir) {
   dx = sqrt(3) * r;
   $fn= 80;
-  translate([0, -thehd[0], plusth]){
+  translate([0, -thehd[1], plusth]){
     mirror([0,ymir,0]){
       mirror([0,0,1]){
        linear_extrude(height=tile_th+plusth*2, convexity=10){
@@ -157,12 +165,12 @@ module TestPiece2(){ ////toplevel
   RoundEdge(holes[0], holes[1]);
   Interlock(holes[0], holes[0] + [0, -1]);
 }
+
 module Demo(){
-  translate([ -thehd[1], 0 ])
+  translate([ -thehd[0], 0 ])
     color("blue")
     TestPiece1();
-  translate([ +thehd[1], 0 ])
+  translate([ +thehd[0], 0 ])
     TestPiece2();
 }