chiark / gitweb /
bike-lipo-box: make floor and ceiling be same thickness as walls, automatically
[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 totx_outer = 30;
73 toty_outer = 25;
74 totz_inner = 8;
75
76 $sealingbox_wallth = wallthick;
77 $sealingbox_floorth = wallthick;
78 $sealingbox_ceilth = wallthick;
79 $sealingbox_xbox = totx_outer;
80 $sealingbox_ybox = toty_outer;
81 $sealingbox_zbox = totz_inner;
82
83 module TestSealBox(){ ////toplevel
84   SealingBox_RectBox();
85   ts_cidoff = ($sealingbox_cnrrad * (1-.7) + wallthick * .8) * [1,1];
86   translate(ts_cidoff)
87     Commitid_BestCount([totx_outer,toty_outer] - 2*ts_cidoff);
88 }
89
90 module TestSealLid(){ ////toplevel
91   difference(){
92     SealingBox_RectLid();
93
94     translate([totx_outer * .75, toty_outer/2, 0])
95       cylinder(h=100, r=5);
96     
97     translate([-wallthick + $sealingbox_cnrrad*.5,
98                $sealingbox_cnrrad*.5 - wallthick,
99                totz_inner + $sealingbox_ceilth])
100       Commitid_BestCount([totx_outer * .75 - 2.5 - ($sealingbox_cnrrad*.5),
101                           toty_outer - ($sealingbox_cnrrad*.5 - wallthick)*2]);
102   }
103 }
104
105 module TestSealLidPrint(){ ////toplevel
106   rotate([180,0,0]) TestSealLid();
107 }
108
109 module ProfileDemos(){ ////toplevel
110   SealingBox_WallProfile();
111   color("blue") SealingBox_FloorProfile();
112   SealingBox_LidProfile();
113   color("blue") SealingBox_CeilProfile();
114   color("red") translate([-5,0]) square([1,totz_inner]);
115 }
116                           
117 //TestWall();
118 //ProfileDemos();
119 //TestSealBox();
120 //TestSealLid();
121 //FArcSegment_mask(350);