]> www.fi.muni.cz Git - things.git/blob - chair-spring.scad
zaves-clip
[things.git] / chair-spring.scad
1 infty = 100;
2 eps = 0.01;
3
4 wall = 2;
5 spring_y = 23.8;
6 spring_x = 8;
7 spring_z = 8.5;
8
9 spring_low = 1.2; // mm lower than spring_x
10
11 clip_add_z = 5;
12 clip_w = 15;
13
14 // bottom
15 translate([0, -spring_y/2, 0]) cube([wall, spring_y, spring_z]);
16
17 // sides
18 for (i = [-1,1]) scale([1, i, 1])
19         translate([0, spring_y/2 - wall, 0])
20                 cube([spring_x, wall, spring_z]);
21
22 // clip
23 translate([0, -clip_w/2, 0]) cube([wall, clip_w, spring_z + clip_add_z]);
24
25 spring_top_r = 9;
26 spring_y_off = spring_y/4;
27
28 difference() {
29         union() {
30                 // center beam
31                 translate([spring_x - wall, -spring_y/2, 0])
32                         cube([wall, spring_y, spring_z]);
33                 // round bottom of the spring
34                 for (i = [-1,1])
35                         translate([spring_top_r+spring_x- wall- spring_low,
36                                 i*spring_y_off, 0])
37                                 cylinder(r = spring_top_r, h = spring_z,
38                                         $fn = 128);
39         }
40         // top of the spring
41         difference() {
42                 translate([spring_x, -infty/2, -infty/2]) cube(infty);
43                 translate([spring_x - 1, 0, -eps]) scale([0.8, 1, 1]) cylinder(r = 2.5, h = spring_z + 2*eps, $fn = 128);
44         }
45
46         // sides
47         for (i = [-1, 1]) scale([1, i, 1])
48         translate([-infty/2, spring_y/2, -infty/2]) cube(infty);
49
50         // round top of the spring
51         for (i = [-1,1])
52                 translate([spring_top_r+spring_x- wall- spring_low,
53                         i*spring_y_off, -eps])
54                         cylinder(r = spring_top_r - wall, h = spring_z + 2*eps,
55                                         $fn = 128);
56 }
57
58 // color("red") translate([23.5, 0, 0]) cylinder(r = 18, h = spring_z);