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