chiark / gitweb /
brompton-computer-guard: break out MainCutout (nfc)
[reprap-play.git] / pull-cord-keeper.scad
1 // -*- C -*-
2
3 hoopthick = 3;
4
5 hinnerrad = 15;
6 houterrad = hinnerrad + hoopthick;
7 hcentredist = 10;
8
9 blockdepth = 5;
10 blockwidth = hcentredist*2 + 6;
11
12 height = 20;
13
14 ziglen = hcentredist/2;
15
16 feedxgap = 5;
17 feedzgap = 5;
18 ribsgap = 1;
19
20 ribdepth = 3;
21 ribheight = 4;
22
23 backxgap = 1;
24
25 blockoverlapcnr = 5;
26
27 screwholedia = 4 + 0.5;
28
29 module Oval(centredist, rad) {
30   hull() {
31     translate([-centredist/2,0,0]) circle(r=rad);
32     translate([+centredist/2,0,0]) circle(r=rad);
33   }
34 }  
35
36 module Hoop(){
37   difference(){
38     hull(){
39       Oval(hcentredist, houterrad);
40       translate([0, (blockdepth + hoopthick)/2 + hinnerrad])
41         square([blockwidth,
42                 blockdepth + hoopthick],
43                center=true);
44     }
45     Oval(hcentredist, hinnerrad);
46   }
47 }
48
49 module Positive(){
50   difference(){
51     translate([0,0, -height/2])
52       linear_extrude(height=20)
53       Hoop();
54
55     rotate([90,0,0])
56       translate([0,0,-50])
57       cylinder(r=screwholedia/2, h=100);
58   }
59 }
60
61 module Ribs(){
62   imax = ceil(height*2 / ribheight);
63   for (i=[-imax:imax]) {
64     hull(){
65       translate([-ribdepth/2,
66                  ribheight*i,
67                  0])
68         polygon([[0,          0],
69                  [ribdepth, -ribheight],
70                  [ribdepth, +ribheight]]);
71       translate([50, 0])
72         square([1, height*2], center=true);
73     }
74   }
75 }           
76
77 module Division(cutmore) {
78   mirror([0,0,1]) {
79     translate([0, 0, -cutmore*feedzgap/2]) {
80       translate([-ziglen + -cutmore*feedxgap/2, -100, 0])
81         cube([100, 100, 50]);
82     }
83   }
84   translate([blockwidth/2 - blockoverlapcnr + -cutmore*backxgap/2,
85              -1,
86              -50])
87     cube([100, 100, 100]);
88
89   translate([ziglen + -cutmore*feedxgap/2,
90              -50,
91              -50])
92     cube([100, 51, 100]);
93
94   translate([50,
95              hinnerrad/2 + houterrad/2 + blockdepth/2 + -cutmore*ribsgap/2,
96              0])
97     rotate([-90,0,90])
98     linear_extrude(height=100)
99     Ribs();
100 }
101
102 module SDemo(){
103   //difference(){
104   %  Positive();
105   //  Division(0);
106   //}
107   Division(-1);
108 }
109
110 module A(){
111   difference(){
112     Positive();
113     Division(+1);
114   }
115 }
116
117 module B(){
118   intersection(){
119     Positive();
120     Division(-1);
121   }
122 }
123
124 module Demo(){
125   color("red") A();
126   color("blue") B();
127 }
128
129 //Ribs();
130 //Demo();
131
132 //A();
133 //B();
134 //%Division(+1);
135
136 //Hoop();
137
138 Demo();