chiark / gitweb /
sewing-table: before reorge RoundEdge
[reprap-play.git] / sewing-table.scad
1 // -*- C -*-
2
3 ply_th = 18;
4 ply_hole_dia = 15;
5 ply_edge_min = 10;
6
7 tile_th = 3;
8 post_dia = 8;
9
10 post_shorter = 1;
11
12 screw_dia = 2.2;
13 screw_big_dia = 3.6;
14 screw_big_len = 4.0;
15
16 round_edge_rad = 2.0;
17
18 // calculated
19
20 ply_edge_hole_dist = ply_edge_min + ply_hole_dia/2;
21
22 echo("HOLES IN PLY ctr dist from edge = "+str(ply_edge_hole_dist));
23
24 hole_slop = (ply_hole_dia - post_dia)/2;
25 tile_hard_edge_hole_dist = ply_edge_hole_dist + hole_slop;
26 thehd = [ tile_hard_edge_hole_dist, tile_hard_edge_hole_dist ];
27
28 module Post(){
29   mirror([0,0,1]) {
30     difference(){
31       cylinder(r= post_dia/2, h= tile_th + ply_th - post_shorter);
32       translate([0,0, tile_th]) {
33         cylinder(r= screw_big_dia/2, h= screw_big_len);
34         cylinder(r= screw_dia/2, h= ply_th);
35       }
36     }
37   }
38 }
39
40 module Posts(posts) {
41   for (p= posts) {
42     translate([p[0], p[1], 0])
43       Post();
44   }
45 }
46
47 module TileBase(botleft_post, topright_post){
48   botleft = botleft_post - thehd;
49   size = topright_post - botleft_post + thehd * 2;
50   mirror([0,0,1])
51     translate([botleft[0], botleft[1], 0])
52     cube([size[0], size[1], tile_th]);
53 }
54
55 module RoundEdge(left_post, right_post) {
56   length_vec = right_post - left_post;
57   ortho_vec = [ -length_vec[1], length_vec[0] ] / dist2d(length_vec);
58   multmatrix([ [ length_vec[0],  length_vec[1], 0, left_post[0], ],
59                [ otho_vec[0],    ortho_vec[1],  0, left_post[1], ],
60                [ 0,              0,             1,            0, ],
61                [ 0,              0,             0,            1, ] ]) {
62     translate([0, -tile_hard_edge_hole_dist, -round_edge_rad]){
63       difference(){
64         rotate([0,90,0])
65           cylinder(r= round_edge_rad, h= 1.0);
66         translate([-1, 0, -20])
67           cube([3, 20, 20]);
68       }
69     }
70   }
71 }
72
73 module RoundLeftCorner(this_post, right_post) {
74 }
75
76 module TestPiece1(){
77   holes = [ [-100, 0],
78             [   0, 0]
79             ];
80   TileBase(holes[0], holes[1]);
81   Posts(holes);
82   RoundEdge(holes[0], holes[1]);
83   RoundLeftCorner(holes[0], holes[1]);
84 }
85
86 TestPiece1();