Skip to content

Commit 1f19691

Browse files
committed
side buttons
1 parent 1ff3be0 commit 1f19691

File tree

2 files changed

+240
-12
lines changed

2 files changed

+240
-12
lines changed

cases/case1.scad

Lines changed: 232 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,19 @@ pi_pinholes_spacer_height = 3;
191191
pi_pinholes_height = 23;
192192
pi_pinholes_width = 58;
193193

194-
/* [Debug] */
194+
/* [Side buttons] */
195+
side_buttons_left = [];
196+
side_buttons_right = [];
197+
side_buttons_top = [];
198+
side_buttons_bottom = [];
199+
side_button_width = 10 - 0.8;
200+
side_button_height = 4 - 0.8;
201+
side_button_extrude = 1.5;
202+
side_button_base = 1;
203+
side_button_base_border = 0.8;
204+
side_button_hole_gap = 0.1;
195205

206+
/* [Debug] */
196207
// Gap between STL parts for visual debugging
197208
debug_gap = 40;
198209
// Gap on baseplate between case and body when printing
@@ -734,6 +745,8 @@ module case() {
734745
if (rear_cooling) {
735746
rearCooling();
736747
}
748+
749+
sideButtonHoles();
737750
}
738751
}
739752

@@ -954,7 +967,7 @@ module caseWithKickstand() {
954967
/*****************************************************************************/
955968

956969

957-
module filletBox(x, y, z, r = fillet_radius) {
970+
module filletBox(x, y, z, r = fillet_radius, fn=64) {
958971
// Optional sanity check (warn if the fillet is too large):
959972
if (x < 2*r || y < 2*r || z < 2*r) {
960973
echo("WARNING: fillet radius is too large for box dimensions!");
@@ -969,33 +982,62 @@ module filletBox(x, y, z, r = fillet_radius) {
969982
cube([x - 2*r, y - 2*r, z - 2*r], center = false);
970983

971984
// Add the sphere that “rounds” the corners/edges
972-
sphere(r = r, $fn = 64); // $fn=64 for smoother arcs
985+
sphere(r = r, $fn = fn); // $fn=64 for smoother arcs
973986
}
974987
}
975988

976-
module filletBoxTop(x, y, z, r = fillet_radius) {
989+
module filletBoxTop(x, y, z, r = fillet_radius, fn=64) {
977990
intersection() {
978991
cube([x, y, z]);
979-
filletBox(x, y, z * 2, r);
992+
filletBox(x, y, z * 2, r, fn);
980993
}
981994
}
982995

983-
module filletBoxMiddle(x, y, z, r = fillet_radius) {
996+
module filletBoxMiddle(x, y, z, r = fillet_radius, fn=64) {
984997
intersection() {
985998
cube([x, y, z]);
986999
translate([0, 0, -z])
987-
filletBox(x, y, z * 3, r);
1000+
filletBox(x, y, z * 3, r, fn);
9881001
}
9891002
}
9901003

991-
module filletBoxBottom(x, y, z, r = fillet_radius) {
1004+
module filletBoxBottom(x, y, z, r = fillet_radius, fn=64) {
9921005
intersection() {
9931006
cube([x, y, z]);
9941007
translate([0, 0, -z])
995-
filletBox(x, y, z * 2, r);
1008+
filletBox(x, y, z * 2, r, fn);
1009+
}
1010+
}
1011+
1012+
module filletBoxLeft(x, y, z, r = fillet_radius, fn=64) {
1013+
intersection() {
1014+
cube([x, y, z]);
1015+
filletBox(x * 2, y, z, r, fn);
9961016
}
9971017
}
9981018

1019+
module filletBoxRight(x, y, z, r = fillet_radius, fn=64) {
1020+
intersection() {
1021+
cube([x, y, z]);
1022+
translate([-x, 0, 0])
1023+
filletBox(x * 2, y, z, r, fn);
1024+
}
1025+
}
1026+
1027+
module filletBoxUp(x, y, z, r = fillet_radius, fn=64) {
1028+
intersection() {
1029+
cube([x, y, z]);
1030+
filletBox(x, y * 2, z, r, fn);
1031+
}
1032+
}
1033+
1034+
module filletBoxDown(x, y, z, r = fillet_radius, fn=64) {
1035+
intersection() {
1036+
cube([x, y, z]);
1037+
translate([0, -y, 0])
1038+
filletBox(x, y * 2, z, r, fn);
1039+
}
1040+
}
9991041
module cubeWithAngledTopBottom(
10001042
loc, size,
10011043
top=false, topReverse=false,
@@ -1147,6 +1189,180 @@ module piPinholes() {
11471189
}
11481190
}
11491191

1192+
module sideButtonHoles() {
1193+
// side buttons left
1194+
for (side_button = side_buttons_left) {
1195+
translate([
1196+
-side_button_extrude,
1197+
side_button * (frame_full_height - side_button_width) / 100 - side_button_hole_gap,
1198+
(case_depth - side_button_height) / 2 - side_button_hole_gap
1199+
])
1200+
filletBoxLeft(
1201+
panel_border_right + case_inner_padding_right + side_button_base + side_button_extrude,
1202+
side_button_width + side_button_hole_gap * 2,
1203+
side_button_height + side_button_hole_gap * 2,
1204+
min(side_button_height / 2 - 0.01, fillet_radius)
1205+
);
1206+
}
1207+
1208+
// side buttons right
1209+
for (side_button = side_buttons_right) {
1210+
translate([
1211+
frame_full_width - panel_border_right - case_inner_padding_right - side_button_base,
1212+
side_button * (frame_full_height - side_button_width) / 100 - side_button_hole_gap,
1213+
(case_depth - side_button_height) / 2 - side_button_hole_gap
1214+
])
1215+
filletBoxRight(
1216+
panel_border_right + case_inner_padding_right + side_button_base + side_button_extrude,
1217+
side_button_width + side_button_hole_gap * 2,
1218+
side_button_height + side_button_hole_gap * 2,
1219+
min(side_button_height / 2 - 0.01, fillet_radius)
1220+
);
1221+
}
1222+
1223+
// side buttons top
1224+
for (side_button = side_buttons_top) {
1225+
translate([
1226+
side_button * (frame_full_width - side_button_width) / 100 - side_button_hole_gap,
1227+
-side_button_extrude,
1228+
(case_depth - side_button_height) / 2 - side_button_hole_gap
1229+
])
1230+
filletBoxUp(
1231+
side_button_width + side_button_hole_gap * 2,
1232+
panel_border_top + case_inner_padding_top + side_button_base + side_button_extrude,
1233+
side_button_height + side_button_hole_gap * 2,
1234+
min(side_button_height / 2 - 0.01, fillet_radius)
1235+
);
1236+
}
1237+
1238+
// side buttons bottom
1239+
for (side_button = side_buttons_bottom) {
1240+
translate([
1241+
side_button * (frame_full_width - side_button_width) / 100 - side_button_hole_gap,
1242+
frame_full_height - panel_border_bottom - case_inner_padding_bottom - side_button_base,
1243+
(case_depth - side_button_height) / 2 - side_button_hole_gap
1244+
])
1245+
filletBoxDown(
1246+
side_button_width + side_button_hole_gap * 2,
1247+
panel_border_bottom + case_inner_padding_bottom + side_button_base + side_button_extrude,
1248+
side_button_height + side_button_hole_gap * 2,
1249+
min(side_button_height / 2 - 0.01, fillet_radius)
1250+
);
1251+
}
1252+
}
1253+
1254+
1255+
module sideButtons() {
1256+
if (side_buttons_left) {
1257+
for (idx = [ 0 : len(side_buttons_left) - 1 ] ) {
1258+
translate([
1259+
idx * (side_button_width + side_button_extrude * 2 + 2),
1260+
0,
1261+
0
1262+
])
1263+
filletBoxBottom(
1264+
side_button_width,
1265+
side_button_height,
1266+
side_button_base + side_button_extrude + panel_border_left + case_inner_padding_left,
1267+
min(side_button_height / 2 - 0.01, fillet_radius)
1268+
);
1269+
1270+
translate([
1271+
idx * (side_button_width + side_button_extrude * 2 + 2) -side_button_base_border,
1272+
-side_button_base_border,
1273+
0
1274+
])
1275+
cube([
1276+
side_button_width + side_button_base_border * 2,
1277+
side_button_height + side_button_base_border * 2,
1278+
side_button_base
1279+
]);
1280+
}
1281+
}
1282+
1283+
if (side_buttons_right) {
1284+
for (idx = [ 0 : len(side_buttons_right) - 1 ] ) {
1285+
translate([
1286+
idx * (side_button_width + side_button_extrude * 2 + 2),
1287+
side_button_height + side_button_extrude * 2 + 2,
1288+
0
1289+
])
1290+
filletBoxBottom(
1291+
side_button_width,
1292+
side_button_height,
1293+
side_button_base + side_button_extrude + panel_border_right + case_inner_padding_right,
1294+
min(side_button_height / 2 - 0.01, fillet_radius)
1295+
);
1296+
1297+
translate([
1298+
idx * (side_button_width + side_button_extrude * 2 + 2) -side_button_base_border,
1299+
side_button_height + side_button_extrude * 2 + 2 -side_button_base_border,
1300+
0
1301+
])
1302+
cube([
1303+
side_button_width + side_button_base_border * 2,
1304+
side_button_height + side_button_base_border * 2,
1305+
side_button_base
1306+
]);
1307+
}
1308+
}
1309+
1310+
if (side_buttons_top) {
1311+
for (idx = [ 0 : len(side_buttons_top) - 1 ] ) {
1312+
translate([
1313+
idx * (side_button_width + side_button_extrude * 2 + 2),
1314+
(side_button_height + side_button_extrude * 2 + 2) * 2,
1315+
0
1316+
])
1317+
filletBoxBottom(
1318+
side_button_width,
1319+
side_button_height,
1320+
side_button_base + side_button_extrude + panel_border_top + case_inner_padding_top,
1321+
min(side_button_height / 2 - 0.01, fillet_radius)
1322+
);
1323+
1324+
translate([
1325+
idx * (side_button_width + side_button_extrude * 2 + 2) -side_button_base_border,
1326+
(side_button_height + side_button_extrude * 2 + 2) * 2 -side_button_base_border,
1327+
0
1328+
])
1329+
cube([
1330+
side_button_width + side_button_base_border * 2,
1331+
side_button_height + side_button_base_border * 2,
1332+
side_button_base
1333+
]);
1334+
}
1335+
}
1336+
1337+
if (side_buttons_bottom) {
1338+
for (idx = [ 0 : len(side_buttons_bottom) - 1 ] ) {
1339+
translate([
1340+
idx * (side_button_width + side_button_extrude * 2 + 2),
1341+
(side_button_height + side_button_extrude * 2 + 2) * 3,
1342+
0
1343+
])
1344+
filletBoxBottom(
1345+
side_button_width,
1346+
side_button_height,
1347+
side_button_base + side_button_extrude + panel_border_bottom + case_inner_padding_bottom,
1348+
min(side_button_height / 2 - 0.01, fillet_radius)
1349+
);
1350+
1351+
translate([
1352+
idx * (side_button_width + side_button_extrude * 2 + 2) -side_button_base_border,
1353+
(side_button_height + side_button_extrude * 2 + 2) * 3 -side_button_base_border,
1354+
0
1355+
])
1356+
cube([
1357+
side_button_width + side_button_base_border * 2,
1358+
side_button_height + side_button_base_border * 2,
1359+
side_button_base
1360+
]);
1361+
}
1362+
}
1363+
}
1364+
1365+
11501366
/*****************************************************************************/
11511367
/* Rendering */
11521368
/*****************************************************************************/
@@ -1189,8 +1405,13 @@ difference() {
11891405
} else {
11901406
case();
11911407
};
1192-
// translate([-frame_full_width / 2, -400, -100])
1193-
// cube([frame_full_width * cross_section_percentage / 100 + 0.2, frame_full_height + 500, 500]);
1408+
1409+
translate([
1410+
frame_full_width / 2 + print_gap,
1411+
- frame_full_height / 2,
1412+
view_mode == "print_vertical" ? 0 : - case_depth - back_depth
1413+
])
1414+
sideButtons();
11941415
}
11951416

11961417
// cut off half

cases/waveshare.7in3e.scad

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ kickstand_depth = 6.7;
6262
/* [USB cutout] */
6363
usb_cutout = true;
6464
usb_cutout_offset_x_percentage = 92;
65-
usb_cutout_offset_y_percentage = 50;
65+
usb_cutout_offset_y_percentage = 70;
6666
usb_cutout_box_depth = 6.4;
6767
usb_cutout_hole_height = 5.8;
6868

@@ -89,6 +89,13 @@ pi_pinholes_ordientation = "vertical"; // [horizontal, vertical]
8989
pi_pinholes_x_percentage = 5.5;
9090
pi_pinholes_y_percentage = 15;
9191

92+
/* [Side buttons] */
93+
side_buttons_left = [];
94+
side_buttons_right = [];
95+
side_buttons_top = [];
96+
// side_buttons_top = [90];
97+
side_buttons_bottom = [];
98+
9299
/* [Debug] */
93100
cross_section_percentage = 0; // [0:100]
94101
vertical_print_scale = 1.004; // 0.4mm shrinkage for every 100mm

0 commit comments

Comments
 (0)