-
Notifications
You must be signed in to change notification settings - Fork 13
/
GreaseWeazle.scad
executable file
·210 lines (181 loc) · 6.5 KB
/
GreaseWeazle.scad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
use <roundedSquare.scad>;
use <hershey.scad>;
//<params>
pcbPortTolerance = 2;
pcbLengthTolerance = 0.8;
pcbRailTolerance = 0.2;
tolerance = 0.35;
driveLength = 144.44;
driveWidth = 100.5;
driveHeight = 24.92;
driveScrewFromBase = 4.9;
driveScrewsFromFront = [ 21.1, 80.88, 110.82 ];
forPrinting = 1; // 0:no, 1:yes
includeBase = 0; // 0:no, 1:yes
includeMain = 1; // 0:no, 1:yes
includeLogo = 1; // 0:no, 1:yes
pcbWidth = 22.55;
pcbLength = 53.43;
pcbThickness = 1.6;
pcbPortThickness = 3;
pcbPortWidth = 7.55;
pcbBackLeaveFree = 10;
pcbOffset = 3.5;
pcbBaseToDrive = 31;
pcbPillarStickout = 4;
pcbPillarThickness = 4;
pcbRailStickout = 2;
pcbRailThickness = 1.65;
pcbHolderExtraHeight = 14;
driveScrewDiameter = 3.91;
baseScrewDiameterInner = 2;
baseScrewDiameterOuter = 3.5;
baseScrewOffset = 5;
radius = 8;
sideWall = 2;
backWall = 2;
frontWall = 2;
ventLength = 10;
ventHeight = 5;
numberOfRearVents = 4;
numberOfSideVents = 6;
guideWidth = 5;
footDiameter = 10;
footHeight = 3.5;
//</params>
nudge = 0.01;
height = max(pcbWidth+pcbRailTolerance*2+pcbRailThickness*2+2*sideWall+2*tolerance,driveHeight+2*tolerance+2*radius);
width = driveWidth+2*tolerance;
length = driveLength + pcbBaseToDrive + pcbThickness + pcbOffset + backWall;
module profile(width,height,radius=radius,hollow=true) {
difference() {
roundedSquare([width+2*sideWall,height+2*sideWall],radius=radius+sideWall,center=true, $fn=64);
if (hollow) roundedSquare([width,height],radius=radius,center=true, $fn=64);
}
}
innerWidth = width-2*tolerance-2*sideWall;
innerHeight = height-2*tolerance-2*sideWall;
module outer(hollow=false) {
profile(width, height, hollow=hollow);
}
module inner(hollow=true) {
profile(innerWidth, innerHeight, radius=radius-tolerance-sideWall, hollow=hollow);
}
module pcbRail(sign) {
startDelta = radius;
xStart = innerWidth/2+sideWall-startDelta-pcbLengthTolerance;
railHeight = backWall+pcbOffset+pcbThickness+pcbRailStickout;
translate([xStart,-sign*(pcbWidth/2+pcbRailTolerance),0])
rotate([0,0,180])
rotate([0,90,0])
rotate([0,0,90])
linear_extrude(height=pcbLength-radius)
polygon([
[0,0],[sign*pcbRailThickness,0],[sign*pcbRailThickness,railHeight],[-sign*pcbRailStickout,railHeight],[0,railHeight-pcbRailStickout],[0,backWall+pcbOffset],[-sign*pcbRailStickout,backWall+pcbOffset]]);
translate([xStart+startDelta-pcbPillarThickness-pcbLength,pcbBackLeaveFree/2*sign-(1-sign)/2*(pcbWidth-pcbBackLeaveFree)/2,0])
cube([pcbPillarThickness,(pcbWidth-pcbBackLeaveFree)/2,pcbPillarStickout+pcbOffset+backWall+pcbThickness]);
}
module portCutout() {
z = backWall+pcbOffset+pcbThickness+pcbPortThickness/2;
mirror([1,0,0]) translate([width/2,0,z]) cube([10,pcbPortWidth+pcbPortTolerance*2,pcbPortThickness+2*pcbPortTolerance],center=true);
}
pcbHolderHeight = pcbOffset+pcbThickness+backWall + pcbHolderExtraHeight;
module bottomScrews(d) {
$fn = 20;
translate([0,0,pcbHolderHeight-baseScrewOffset]) {
rotate([0,-90,0])
cylinder(d=d,center=false,h=max(width,length)+10);
rotate([0,0,90])
rotate([0,90,0])
cylinder(d=d,center=true,h=max(width,length)+10);
}
}
module sideVent() {
translate([width/2,height/2,0]) rotate([0,0,45]) cube([20, ventHeight, ventLength],center=true);
}
module sideVents() {
for (i=[0:numberOfSideVents-1])
translate([0,0,length/(numberOfSideVents+1)*(i+1)]) sideVent();
}
module bottomVents() {
for (i=[0:numberOfRearVents-1])
translate([-innerWidth/2+innerWidth/(numberOfRearVents+1)*(i+1),0,0]) square([ventLength,ventHeight],center=true);
}
module pcbHolder() {
difference() {
union() {
linear_extrude(height=backWall) difference() {
inner(hollow=false);
bottomVents();
}
linear_extrude(height=pcbHolderHeight) difference() {
inner(hollow=true);
translate([innerWidth/2+sideWall/2,0]) square([radius*1.5+sideWall,pcbWidth+pcbRailThickness*2+pcbRailTolerance*2],center=true);
}
pcbRail(1);
pcbRail(-1);
}
bottomScrews(baseScrewDiameterInner);
sideVents();
mirror([1,0,0]) sideVents();
}
}
module driveScrews() {
for (h=driveScrewsFromFront) translate([0,-driveHeight/2+driveScrewFromBase,length-h]) rotate([0,90,0]) cylinder(h=width*4,d=driveScrewDiameter,$fn=20,center=true);
}
module guide() {
intersection() {
translate([tolerance+nudge+driveWidth/2-guideWidth,-height/2,pcbHolderHeight]) cube([guideWidth,(height-driveHeight)/2-tolerance,length-pcbHolderHeight]);
linear_extrude(height=length+nudge) outer(hollow=false);
}
}
module frontWallProfile() {
difference() {
outer(hollow=false);
square([driveWidth+2*tolerance,driveHeight+2*tolerance],center=true);
}
}
module frontWall() {
translate([0,0,length-frontWall]) linear_extrude(height=frontWall) frontWallProfile();
}
footOffset = footDiameter*1.5;
module foot() {
translate([0,-height/2-footHeight+nudge,0])
rotate([90,0,0])
cylinder(d2=footDiameter,d1=footDiameter+2*footHeight,h=footHeight+nudge);
}
module feet() {
translate([(driveWidth/2-footOffset),0,footOffset]) foot();
translate([-(driveWidth/2-footOffset),0,footOffset]) foot();
translate([(driveWidth/2-footOffset),0,length-footOffset]) foot();
translate([-(driveWidth/2-footOffset),0,length-footOffset]) foot();
}
module label() {
if (includeLogo)
rotate([0,0,90])
drawHersheyText("GreaseWeazle", font="SerifItalic", valign="center", halign="center", size=14.5,extraSpacing=-1.5) cylinder(d1=4,d2=1,h=2,$fn=16);
}
module shell() {
difference() {
linear_extrude(height=length) outer(hollow=true);
mirror([1,0,0]) bottomScrews(baseScrewDiameterOuter);
portCutout();
sideVents();
driveScrews();
mirror([1,0,0]) sideVents();
}
guide();
mirror([1,0,0]) guide();
frontWall();
feet();
translate([0,height/2+sideWall-nudge,length/2]) rotate([-90,0,0]) label();
}
if (includeBase) pcbHolder();
if (includeMain) {
translate([0,height+2*sideWall+5,0]) if (forPrinting) {
translate([0,0,length])
rotate([180,0,0])
shell();
}
else shell();
}