chiark / gitweb /
maglite-holder: photo
[reprap-play.git] / cable-hole-trunking-cover.scad
index ce44475..ed2bc31 100644 (file)
@@ -1,25 +1,30 @@
 // -*- C -*-
 
-holedia = 25.4;
+holedia = 25;
+tapethick = 1.5;
+cutoutsz= 15;
+innerz = 11;
 
-sidewidth = 5;
-tapewidth = 7;
+sidesflatbase = 2;
+endsflatbase = 8;
 
-innerz = 10;
+basex = holedia + endsflatbase*2;
+basey = holedia + sidesflatbase*2;
 
-basex = holedia + sidewidth*2;
-basey = holedia + tapewidth*2;
-
-bevelz = 3;
+bevely = 2.75;
 bevelslope = 0.75;
-bevely = bevelz * bevelslope;
+bevelz = bevely / bevelslope;;
+basebevelt = 3;
 
 sideslop = 0.5;
 
 basebaset = 2;
-basebevelt = 3;
+sidewallt = 2;
 
+lidt = 1.3;
 endwallt = 2;
+zslop = 0.75;
+endslop = 0.75;
 
 module sheared_cube(sz, xperz, yperz) {
   multmatrix([[1,0,xperz,0],
@@ -29,34 +34,86 @@ module sheared_cube(sz, xperz, yperz) {
     cube(sz);
 }
 
-module Base(){
+module Base(cutouty){
+  echo(cutouty);
   difference(){
     union(){
-      translate([0, basey-basebevelt, 0])
-       sheared_cube([basex, basebevelt, bevelz], 0, bevelslope);
-      sheared_cube([basex, basebevelt, bevelz], 0, -bevelslope);
-      cube([basex, basey, basebaset]);
+      for (mir=[0,1]) mirror([0,mir,0]) {
+       translate([0, basey/2 - basebevelt, 0])
+         sheared_cube([basex, basebevelt, bevelz], 0, bevelslope);
+       cube([basex, basey/2, basebaset]);
+      }
     }
-    translate([basex/2, basey/2, -1])
+    translate([basex/2, 0, -1])
       cylinder(r=holedia/2, h=bevelz+2);
   }
-
-  rotate([90, 0, 90])
-    linear_extrude(height=endwallt)
-    polygon([[0,     0],
-            [basey, 0],
-            [basey + bevely, bevelz],
-            [basey + bevely, innerz],
-            [      - bevely, innerz],
-            [      - bevely, bevelz]]);
+  rotate([90, 0, 90]) {
+    linear_extrude(height=endwallt) {
+      difference(){
+       for (mir=[0,1]) mirror([mir,0,0]) {
+           polygon([[-0.1,             0],
+                    [basey/2,          0],
+                    [basey/2 + bevely, bevelz],
+                    [basey/2 + bevely, innerz],
+                    [-0.1,             innerz]]);
+       }
+       translate([cutouty, 0])
+         square(size=[cutoutsz, 3*innerz], center=true);
+      }
+    }
+  }
 }
 
 module Lid(){
-  translate([0, basey + sideslop, 0])
-    sheared_cube([basex, basebevelt, bevelz], 0, bevelslope);
-  translate([0, -basebevelt - sideslop, 0])
-    sheared_cube([basex, basebevelt, bevelz], 0, -bevelslope);
+  lidx = basex + endslop + endwallt;
+  for (mir=[0,1]) mirror([0,mir,0]) {
+    translate([0, basey/2 + sideslop + bevely, 0])
+      rotate([90,0,90])
+      linear_extrude(height = lidx)
+      polygon([[0,         0],
+              [-bevely,   0],
+              [0,         bevelz],
+              [0,         innerz + lidt + zslop],
+              [sidewallt, innerz + lidt + zslop],
+              [sidewallt, -tapethick],
+              [0,         -tapethick]]);
+    translate([0, -1, innerz + zslop])
+      cube([lidx, 1 + basey/2 + sideslop + bevely + sidewallt, lidt]);
+    translate([basex + endslop, -1, -tapethick])
+      cube([endwallt, 1 + basey/2 + sideslop + bevely + sidewallt,
+           tapethick + innerz + zslop + 0.1]);
+  }
+}
+
+module LidT(){ ////toplevel
+  rotate([180,0,0]) Lid();
+}
+
+module BaseCMid(){ ////toplevel
+  Base(0);
+}
+
+module BaseCTop(){ ////toplevel
+  Base(basey/2 + bevely - cutoutsz/2);
+}
+
+module BaseCBot(){ ////toplevel
+  Base(-(basey/2 + bevely - cutoutsz/2));
+}
+
+module BaseCNone(){ ////toplevel
+  Base(basey);
+}
+
+module Demo(){ ////toplevel
+  BaseCTop();
+  %Lid();
 }
 
-Base();
-Lid();
+//BaseCTop();
+//BaseCMid();
+//BaseCBot();
+//BaseCNone();
+//Lid();
+//LidT();
+//Demo();