chiark / gitweb /
fairphone-case: Struts: support negative thickness for inverted objects (nfc)
[reprap-play.git] / fairphone-case.scad
index 726bdc63846a8047b0b1d3edc652a6d7b5ac3b0f..52a9b31f4dd5c6c029aa803148e98792f3942d53 100644 (file)
@@ -21,8 +21,8 @@ case_th_side = 2;
 case_th_lip = 1.2;
 
 case_struts_count = 6;
-case_struts_solid_below = 0.75;
-case_struts_solid_above = 1.00;
+case_struts_solid_below = 1.00;
+case_struts_solid_above = 0.75;
 case_struts_width = 0.10;
 
 keeper_th_z = 0.75;
@@ -246,11 +246,17 @@ module AroundEdges(fill_zstart, fill_th, fill_downwards=0){
 }
 
 module Struts(z_min, th){
+  // if th is negative, starts at z_min and works towards -ve z
+  // and object should then be printed other way up
   for (i= [1 : 1 : case_struts_count]) {
     translate([0,
+              0,
+              z_min])
+      mirror([0,0, th<0 ? 1 : 0])
+      translate([0,
               -phone_height * i / (case_struts_count+1),
-              z_min + case_struts_solid_below])
-      linear_extrude(height= th
+              case_struts_solid_below])
+      linear_extrude(height= abs(th)
                     -(case_struts_solid_below+case_struts_solid_above))
       rectfromto([               epp2i[0], -0.5 * case_struts_width ],
                 [ phone_width - epp2i[0], +0.5 * case_struts_width ]);