chiark / gitweb /
95a28d29fa56ccba6c29fa6459ef80eef30e808e
[reprap-play.git] / wardrobe-hook.scad
1 // -*- C -*-
2
3 module FArcSegment_mask(beta) {
4   for (i=[0 : 0.75 : 3]) {
5     rotate(i*beta/4)
6       polygon([[0, 0],
7                [1, 0],
8                [cos(beta/4), sin(beta/4)]]);
9   }
10 }
11
12 module FArcSegment(xc,yc,inrad,outrad,alpha,delta) {
13   translate([xc,yc]) {
14     intersection() {
15       difference() {
16         circle(r=outrad);
17         circle(r=inrad);
18       }
19       rotate(alpha) scale(outrad*2) {
20         FArcSegment_mask(delta);
21       }
22     }
23   }
24 }
25
26 tubeheight = 30;
27 tubewidth = 15;
28 mainthick = 4;
29
30 clipthick = 2;
31 clipang = 120;
32
33 stemlen = 50;
34
35 topwidth = 30;
36
37 hookinrad = 7.5;
38 hookcurl = 60;
39 hookwidth = 4;
40
41 tuberad = tubewidth/2;
42 bend = atan(tuberad/stemlen);
43 mainoutrad = tuberad + mainthick;
44 hookoutrad = hookinrad + hookwidth;
45 hookcy = stemlen - hookoutrad;
46
47 module Plan(){
48   dy = tubeheight - tuberad*2;
49   FArcSegment(0, dy, tuberad, mainoutrad, -1, 181);
50   FArcSegment(0, 0,  tuberad, mainoutrad, -bend, bend+1);
51   translate([tuberad, 0]) square(center=false, size=[mainthick,dy]);
52   FArcSegment(0, 0, tuberad, tuberad + clipthick, 360-clipang, clipang+1);
53   rotate(-bend) translate([tuberad, 0]) mirror([0,1])
54     square(center=false, size=[mainthick, stemlen/cos(bend)]);
55 }
56
57 module Elevation(){
58   FArcSegment(0, -hookcy, hookinrad, hookoutrad, 180, 90+hookcurl);
59   translate([-hookoutrad*sqrt(0.5), -(stemlen+10)]) mirror([1,0])
60     square(center=false, size=[topwidth, stemlen + tubeheight + 20]);
61 }
62
63 Plan();
64 translate([50,0])
65   Elevation();