chiark / gitweb /
belt-hole-cut-jig: toplevel
[reprap-play.git] / cable-hole-trunking-cover.scad
1 // -*- C -*-
2
3 holedia = 25;
4 tapethick = 1.5;
5 cutoutsz= 15;
6 innerz = 11;
7
8 sidesflatbase = 2;
9 endsflatbase = 8;
10
11 basex = holedia + endsflatbase*2;
12 basey = holedia + sidesflatbase*2;
13
14 bevely = 2.75;
15 bevelslope = 0.75;
16 bevelz = bevely / bevelslope;;
17 basebevelt = 3;
18
19 sideslop = 0.5;
20
21 basebaset = 2;
22 sidewallt = 2;
23
24 lidt = 1.3;
25 endwallt = 2;
26 zslop = 0.75;
27 endslop = 0.75;
28
29 module sheared_cube(sz, xperz, yperz) {
30   multmatrix([[1,0,xperz,0],
31               [0,1,yperz,0],
32               [0,0,1,    0],
33               [0,0,0,    1]])
34     cube(sz);
35 }
36
37 module Base(cutouty){
38   echo(cutouty);
39   difference(){
40     union(){
41       for (mir=[0,1]) mirror([0,mir,0]) {
42         translate([0, basey/2 - basebevelt, 0])
43           sheared_cube([basex, basebevelt, bevelz], 0, bevelslope);
44         cube([basex, basey/2, basebaset]);
45       }
46     }
47     translate([basex/2, 0, -1])
48       cylinder(r=holedia/2, h=bevelz+2);
49   }
50   rotate([90, 0, 90]) {
51     linear_extrude(height=endwallt) {
52       difference(){
53         for (mir=[0,1]) mirror([mir,0,0]) {
54             polygon([[-0.1,             0],
55                      [basey/2,          0],
56                      [basey/2 + bevely, bevelz],
57                      [basey/2 + bevely, innerz],
58                      [-0.1,             innerz]]);
59         }
60         translate([cutouty, 0])
61           square(size=[cutoutsz, 3*innerz], center=true);
62       }
63     }
64   }
65 }
66
67 module Lid(){
68   lidx = basex + endslop + endwallt;
69   for (mir=[0,1]) mirror([0,mir,0]) {
70     translate([0, basey/2 + sideslop + bevely, 0])
71       rotate([90,0,90])
72       linear_extrude(height = lidx)
73       polygon([[0,         0],
74                [-bevely,   0],
75                [0,         bevelz],
76                [0,         innerz + lidt + zslop],
77                [sidewallt, innerz + lidt + zslop],
78                [sidewallt, -tapethick],
79                [0,         -tapethick]]);
80     translate([0, -1, innerz + zslop])
81       cube([lidx, 1 + basey/2 + sideslop + bevely + sidewallt, lidt]);
82     translate([basex + endslop, -1, -tapethick])
83       cube([endwallt, 1 + basey/2 + sideslop + bevely + sidewallt,
84             tapethick + innerz + zslop + 0.1]);
85   }
86 }
87
88 module LidT(){ ////toplevel
89   rotate([180,0,0]) Lid();
90 }
91
92 module BaseCMid(){ ////toplevel
93   Base(0);
94 }
95
96 module BaseCTop(){ ////toplevel
97   Base(basey/2 + bevely - cutoutsz/2);
98 }
99
100 module BaseCBot(){ ////toplevel
101   Base(-(basey/2 + bevely - cutoutsz/2));
102 }
103
104 module BaseCNone(){ ////toplevel
105   Base(basey);
106 }
107
108 module Demo(){ ////toplevel
109   BaseCTop();
110   %Lid();
111 }
112
113 //BaseCTop();
114 //BaseCMid();
115 //BaseCBot();
116 //BaseCNone();
117 //Lid();
118 //LidT();
119 //Demo();