chiark / gitweb /
sealing-box, bike-lipo-box: combine $sealingbox_sz out of _xbox et al (nfc)
[reprap-play.git] / bike-lipo-box.scad
1 // -*- C -*-
2
3 include <commitid.scad>
4 include <utils.scad>
5 include <sealing-box.scad>
6
7 pxp6012_rad = 22.5 / 2 + 0.5; // make circular hole this size in outer wall
8 pxp6012_rad_outer = 32.0 / 2 - 0.5;
9
10 s1930_y = 30.2 + 0.2;
11 s1930_x =   22 + 0.2;
12 s1930_y_outer = 36.4 + 0.2;
13 s1930_x_outer = 27.6 + 0.2;
14
15 s1930_recess = 3;
16 s1930_around = 3;
17 s1930_behind = 3;
18
19 wallthick = 2.5;
20
21 // origin is at centre on outer face wall
22 // outside is towards positive x
23 // mounting is vertical
24 module S1930_Positive(){
25   d = s1930_recess + s1930_behind;
26   translate([-d/2, 0,0])
27     cube([d,
28           s1930_x_outer + s1930_around,
29           s1930_y_outer + s1930_around], center=true);
30 }
31 module S1930_Negative(){
32   cube([60, s1930_x, s1930_y],
33        center=true);
34   translate([1, 0,0])
35     cube([s1930_recess*2+2, s1930_x_outer, s1930_y_outer],
36          center=true);
37 }
38
39 module TestWall(){ ////toplevel
40   sw_ctr = [25, wallthick, 25];
41
42   rotate([0,0,-90]){
43     difference(){
44       union(){
45         cube([50, wallthick, 42]);
46       }
47
48       translate([30, -1, 20])
49         rotate([-90,0,0])
50         cylinder(r = pxp6012_rad, h=10, $fn=60);
51
52       rotate([90,0,0])
53         Commitid_BestCount([15,40]);
54     }
55   }
56
57   difference(){
58     union(){
59       cube([50, wallthick, 50]);
60       translate(sw_ctr)
61         rotate([0,0,90])
62         S1930_Positive();
63     }
64
65     translate(sw_ctr) {
66       rotate([0,0,90])
67         S1930_Negative();
68     }
69   }    
70 }
71
72 ts_totx = 30;
73 ts_toty = 25;
74 ts_totz_inner = 8;
75
76 ts_box_sz = [ts_totx, ts_toty, ts_totz_inner];
77
78 $sealingbox_wallth = wallthick;
79 $sealingbox_floorth = wallthick;
80 $sealingbox_ceilth = wallthick;
81
82 module TestSealBox(){ ////toplevel
83   $sealingbox_sz = ts_box_sz;
84
85   SealingBox_RectBox();
86   ts_cidoff = ($sealingbox_cnrrad * (1-.7) + wallthick * .8) * [1,1];
87   translate(ts_cidoff)
88     Commitid_BestCount([ts_totx,ts_toty] - 2*ts_cidoff);
89 }
90
91 module TestSealLid(){ ////toplevel
92   $sealingbox_sz = ts_box_sz;
93
94   difference(){
95     SealingBox_RectLid();
96
97     translate([ts_totx * .75, ts_toty/2, 0])
98       cylinder(h=100, r=5);
99     
100     translate([-wallthick + $sealingbox_cnrrad*.5,
101                $sealingbox_cnrrad*.5 - wallthick,
102                ts_totz_inner + $sealingbox_ceilth])
103       Commitid_BestCount([ts_totx * .75 - 2.5 - ($sealingbox_cnrrad*.5),
104                           ts_toty - ($sealingbox_cnrrad*.5 - wallthick)*2]);
105   }
106 }
107
108 module TestSealLidPrint(){ ////toplevel
109   rotate([180,0,0]) TestSealLid();
110 }
111
112 module ProfileDemos(){ ////toplevel
113   $sealingbox_sz = ts_box_sz;
114
115   SealingBox_WallProfile();
116   color("blue") SealingBox_FloorProfile();
117   SealingBox_LidProfile();
118   color("blue") SealingBox_CeilProfile();
119   color("red") translate([-5,0]) square([1,ts_totz_inner]);
120 }
121                           
122 //TestWall();
123 //ProfileDemos();
124 //TestSealBox();
125 //TestSealLid();
126 //FArcSegment_mask(350);