chiark / gitweb /
salter-scale-hook: wip ScrewHole
[reprap-play.git] / salter-scale-hook.scad
1 // -*- C -*-
2
3 include <utils.scad>
4
5 rod_dia = 8+2;
6 thick = 8;
7 screw_dia = 3.5 + 0.75;
8 screw_head_dia = 8.2 + 1.0;
9 rod_offset = 14 + 2;
10 mainheight = 25;
11 width = 40;
12 rearthick = 4;
13 screw_head_depth = 3;
14
15 // calculated
16
17 d = rod_dia/2 + thick/2;
18 yminc = -d;
19 ymin = yminc-thick/2;
20 ymaxc = mainheight;
21 ymax = mainheight+thick/2;
22
23 cutdepth = rod_offset - rod_dia/2 - rearthick;
24
25 cut_z0 = screw_head_dia/2;
26 cut_z1 = width/2 - rearthick;
27
28 cutslopez = cutdepth * 0.5;
29
30 module C() {
31   circle(r = thick/2, $fn=30);
32 }
33
34 module Profile() {
35   e = rod_offset;
36   hull(){
37     translate([-d, 0]) C();
38     translate([-d,-d]) C();
39   }
40   difference(){
41     rectfromto([-d,ymin], [e,0]);
42     circle(r= rod_dia/2, $fn=50);
43   }
44   hull(){
45     for (y= [-d, +mainheight]) {
46       translate([d, y]) C();
47       rectfromto([d, y-thick/2], [e, y+thick/2]);
48     }
49   }
50 }
51
52 module CutProfile(){
53   hull(){
54     for (x = [rod_dia/2 + thick/2, 30]) {
55       for (y= [yminc,ymaxc] ) {
56         translate([x,y]) circle(r = (thick-rearthick)/2, $fn=20);
57       }
58     }
59   }
60 }
61
62 module ProfileDemo(){
63   Profile();
64   color("red") translate([0,0,1]) CutProfile();
65 }
66
67 module Cut(less){
68   translate([0,0, cut_z0 + less])
69     linear_extrude(height = cut_z1 - cut_z0 - less*2)
70     CutProfile();
71 }
72
73 module ScrewHole(){
74   translate([0,0,-50])
75     cylinder(h=100, r= screw_dia/2, $fn=20);
76 }
77
78 module Hook(){
79   difference(){
80     translate([0,0, -width/2])
81       linear_extrude(height=width) Profile();
82
83     for (m=[0,1]) {
84       mirror([0,0,m]) {
85         hull(){
86           Cut(cutslopez);
87           translate([cutdepth,0,0]) Cut(0);
88         }
89       }
90     }
91
92     translate([rod_dia/2 + screw_head_depth,
93                ymaxc - screw_head_dia,
94                0]) {
95       rotate([0,90,0])
96         ScrewHole();
97     }
98   }
99 }
100
101 //ProfileDemo();
102 Hook();