chiark / gitweb /
Add 'diziet-utils/' from commit 'd070a0324f10f76f9c97d8f56f864f0cafa88cf1'
[reprap-play.git] / brompton-computer-guard.scad
1 // -*- C -*-
2
3 arch_height = 18;
4 arch_width = 75;
5 end_width = 25;
6
7 arch_thick = 4;
8
9 arch_breadth = 25;
10
11 hole_dia = 4 + 0.5;
12
13 pbase_tab = 12;
14 pbase_thick = 4;
15 inner_pbase_thick = 12;
16 inner_pbase_rad_mul = 3;
17
18 // computed
19
20 arch_alpha = atan(arch_height / (arch_width/2));
21 arch_beta = 2*arch_alpha;
22 echo(arch_alpha,arch_beta);
23 arch_in_rad = arch_width/2 / sin(arch_beta);
24 arch_to_chord = arch_in_rad * cos(arch_beta);
25
26 echo(inner_pbase_thick);
27
28 inner_pbase_rad = arch_in_rad * inner_pbase_rad_mul;
29
30 end_thick = arch_thick;
31
32 holes = [[[  5  , 5  ], [16  , 21]], // left
33          [[ 18.5, 4.5], [ 4.5, 21]]]; // right
34
35 module ArchCircle(rad){
36   translate([0,-arch_to_chord])
37     circle(rad, $fa=0.1);
38 }
39
40 module ArchProfile(pbase){
41   intersection(){
42     translate([-200,0])
43       square([400,200]);
44     difference(){
45       union(){
46         ArchCircle(arch_in_rad + arch_thick);
47         for (m=[0,1])
48           mirror([m,0])
49             translate([arch_width/2,0])
50             multmatrix([[1,pbase ? -0.75 : 0,0,0],
51                         [0,1,0,0],
52                         [0,0,1,0],
53                         [0,0,0,1]])
54             square([end_width, pbase ? pbase_tab : end_thick]);
55       }
56     }
57   }
58 }
59
60 module Holes(){
61   for (m=[0,1]) {
62     mirror([1-m,0])
63       translate([arch_width/2, 50, 0])
64       rotate([90,0,0])
65       for (h=holes[m]) {
66         translate(h)
67           cylinder(r=hole_dia/2, h=100, $fn=20);
68       }
69   }
70 }
71
72 module MainCutout(){
73   ArchCircle(arch_in_rad);
74 }
75
76 module Arch(){
77   difference(){
78     rotate([0,0,180]){
79       linear_extrude(height=arch_breadth) {
80         difference(){
81           ArchProfile(false);
82           MainCutout();
83         }
84       }
85       difference(){
86         translate([0,0, arch_breadth - pbase_thick])
87         linear_extrude(height=pbase_thick){
88           difference(){
89             hull(){
90               ArchProfile(true);
91               ArchProfile(false);
92             }
93             intersection(){
94               MainCutout();
95               translate([0, -inner_pbase_thick
96                          - (inner_pbase_rad - arch_in_rad)])
97                 ArchCircle(inner_pbase_rad);
98             }
99           }
100         }
101       }
102     }
103     Holes();
104   }
105 }
106
107 rotate([0,0,45]) translate([0,0,arch_breadth]) rotate([0,180,0]) Arch();