chiark / gitweb /
brompton-computer-guard: wip
[reprap-play.git] / brompton-computer-guard.scad
1 // -*- C -*-
2
3 cover_ysz = 45;
4 cover_len = 70;
5
6 attach_tube_dia = 18;
7
8 attach_cx = -15;
9 attach_cdy = -5;
10 attach_w = 25;
11
12 attach_inrad = 25; ///
13 attach_hole_dist = 5; ///
14 attach_hole_dia = 4 + 0.5; ///
15 attach_ang = 45;
16
17 // calculated
18
19 cover_lcircle_r = cover_ysz / (1 + 1/sqrt(2));
20
21 base_len = cover_len - cover_lcircle_r;
22
23 attach_straight_len =
24   attach_inrad + attach_tube_dia + attach_hole_dist + attach_hole_dia/2
25   - attach_w / 2 + attach_hole_dist;
26
27 attach_down = tube_dia + attach_hole_dist;
28
29 module RearSideTemplate(){
30   polygon([[0.1,0],
31            [-base_len,0],
32            [-base_len,-cover_ysz],
33            [0.1,      -cover_ysz]]);
34   translate([-base_len, -cover_ysz + cover_lcircle_r])
35     circle(r=cover_lcircle_r);
36 }
37
38 module AttachTemplate(){
39   hull(){
40     polygon([[0,   0],
41              [-0.1, 0],
42              [-0.1, -cover_ysz],
43              [0,    -cover_ysz]]);
44     translate([attach_cx, -attach_cdy]) rotate([0,0,-attach_ang]) {
45       polygon([[-attach_cx,          attach_w/2],
46                [0,                   -attach_w/2],
47                [attach_straight_len, -attach_w/2],
48                [attach_straight_len, attach_w/2]]);
49       translate([attach_straight_len, 0])
50         circle(r=attach_w/2);
51     }
52   }
53 }
54
55 module BodyPositive(){
56   color("blue") linear_extrude(height=60) RearSideTemplate();
57   translate([0,0,-attach_down]) linear_extrude(height=100) AttachTemplate();
58 }
59
60 module Tube(){
61   %translate([attach_cx, -attach_cdy, -20]) {
62     rotate_extrude(convexity=10) {
63       translate([attach_inrad + attach_tube_dia/2, 0])
64         circle(r=attach_tube_dia/2);
65     }
66   }
67 }
68
69 module Bolt(){
70   %translate([0,0,-50]) linear_extrude(height=80) {
71     circle(r=attach_hole_dia/2, $fn=20);
72   }
73   %translate([0,0,10]) linear_extrude(height=20) {
74     circle(r=attach_hole_dia/2 * 2, $fn=20);
75   }
76 }
77
78 module Bolts(){
79   translate([attach_cx, -attach_cdy]) rotate([0,0,-attach_ang]) {
80     translate([attach_inrad - attach_hole_dist - attach_hole_dia/2, 0])
81       Bolt();
82     translate([attach_inrad + attach_tube_dia
83                +attach_hole_dist + attach_hole_dia/2, 0])
84       Bolt();
85   }
86 }
87
88 Tube();
89 Bolts();
90 BodyPositive();