chiark / gitweb /
fairphone-case: Struts: support negative thickness for inverted objects (nfc)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 20 Jan 2018 23:10:15 +0000 (23:10 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 20 Jan 2018 23:10:15 +0000 (23:10 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
fairphone-case.scad

index 5cd591e09fd9aec157e427b4037b50613d66615b..52a9b31f4dd5c6c029aa803148e98792f3942d53 100644 (file)
@@ -246,14 +246,17 @@ module AroundEdges(fill_zstart, fill_th, fill_downwards=0){
 }
 
 module Struts(z_min, th){
 }
 
 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])
   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),
               case_struts_solid_below])
       translate([0,
               -phone_height * i / (case_struts_count+1),
               case_struts_solid_below])
-      linear_extrude(height= th
+      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 ]);
                     -(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 ]);