Skip to content

Commit 2f749b9

Browse files
committed
multiple hanging holes
1 parent 8d99059 commit 2f749b9

10 files changed

+171
-128
lines changed

cases/case1.scad

Lines changed: 130 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,15 @@ usb_cutout_hole_height = 3.2;
179179
usb_cutout_top_wall_thickness = 5.0;
180180

181181
/* [Hanging hole] */
182-
183-
hanging_hole = true;
184-
hanging_hole_edge = "top"; // [top, bottom, left, right]
182+
// [ [top, bottom, left, right], offset_percentage ]
183+
hanging_holes = [
184+
// ["top", 18],
185+
// ["left", 18],
186+
// ["right", 18],
187+
// ["bottom", 18]
188+
];
185189
hanging_hole_large_diameter = 8;
186190
hanging_hole_small_diameter = 3;
187-
hanging_hole_offset_percentage = 18;
188191
hanging_hole_box_width = 12;
189192
hanging_hole_box_height = 16;
190193
hanging_hole_depth = 7;
@@ -278,21 +281,6 @@ kickstand_full_width = kickstand_width + 2 * kickstand_wall_thickness + 2 * kick
278281
kickstand_leg_full_width = kickstand_leg_width + 2 * kickstand_wall_thickness + 2 * kickstand_gap_thickness;
279282
kickstand_leg_bridge_offset = kickstand_leg_bridge_offset_percentage * (kickstand_height - 2 * kickstand_leg_bridge_height) / 100;
280283

281-
hanging_hole_offset = hanging_hole_offset_percentage *
282-
(hanging_hole_edge == "left" || hanging_hole_edge == "right"
283-
? frame_full_width - hanging_hole_box_height
284-
: frame_full_height - hanging_hole_box_height) / 100;
285-
hanging_hole_x = hanging_hole_edge == "left"
286-
? hanging_hole_offset
287-
: hanging_hole_edge == "right"
288-
? frame_full_width - hanging_hole_offset - hanging_hole_box_height
289-
: (frame_full_width - hanging_hole_box_width) / 2;
290-
hanging_hole_y = hanging_hole_edge == "top"
291-
? hanging_hole_offset
292-
: hanging_hole_edge == "bottom"
293-
? frame_full_height - hanging_hole_offset - hanging_hole_box_height
294-
: (frame_full_height - hanging_hole_box_width) / 2;
295-
296284
usb_cutout_x = (frame_full_width - usb_cutout_box_width - usb_cutout_left_wall_thickness - usb_cutout_right_wall_thickness) * usb_cutout_offset_x_percentage / 100;
297285
usb_cutout_y = (frame_full_height - usb_cutout_box_height - usb_cutout_top_wall_thickness - usb_cutout_bottom_wall_thickness) * usb_cutout_offset_y_percentage / 100;
298286

@@ -332,6 +320,23 @@ screw_positions = [
332320
screw_offset_bottom + s * (frame_full_height - screw_offset_bottom - screw_offset_top) ]
333321
];
334322

323+
function hanging_hole_position(edge, offset_percentage) =
324+
let (
325+
offset = offset_percentage * (edge == "left" || edge == "right"
326+
? frame_full_width - hanging_hole_box_height
327+
: frame_full_height - hanging_hole_box_height) / 100
328+
) [
329+
edge == "left"
330+
? offset
331+
: edge == "right"
332+
? frame_full_width - offset - hanging_hole_box_height
333+
: (frame_full_width - hanging_hole_box_width) / 2,
334+
edge == "top"
335+
? offset
336+
: edge == "bottom"
337+
? frame_full_height - offset - hanging_hole_box_height
338+
: (frame_full_height - hanging_hole_box_width) / 2
339+
];
335340

336341
/*****************************************************************************/
337342
/* Panel cover */
@@ -679,25 +684,33 @@ module case() {
679684
sdCardAdapterBase();
680685
}
681686
}
682-
if (hanging_hole) {
683-
color(case_color)
684-
cubeWithAngledTopBottom(
685-
loc=[
686-
hanging_hole_x - hanging_hole_wall_thickness,
687-
hanging_hole_y - hanging_hole_wall_thickness,
688-
back_depth + case_depth - min(back_depth + case_depth, hanging_hole_depth)
689-
],
690-
size=[
691-
hanging_hole_edge == "top" || hanging_hole_edge == "bottom"
692-
? hanging_hole_box_width + hanging_hole_wall_thickness * 2
693-
: hanging_hole_box_height + hanging_hole_wall_thickness * 2,
694-
hanging_hole_edge == "top" || hanging_hole_edge == "bottom"
695-
? hanging_hole_box_height + hanging_hole_wall_thickness * 2
696-
: hanging_hole_box_width + hanging_hole_wall_thickness * 2,
697-
min(back_depth + case_depth, hanging_hole_depth)
698-
],
699-
bottom=(view_mode == "print_vertical")
700-
);
687+
for (h = hanging_holes) {
688+
let (
689+
hanging_hole_edge = h[0],
690+
hanging_hole_offset_percentage = h[1],
691+
hanging_hole_pos = hanging_hole_position(hanging_hole_edge, hanging_hole_offset_percentage),
692+
hanging_hole_x = hanging_hole_pos[0],
693+
hanging_hole_y = hanging_hole_pos[1]
694+
) {
695+
color(case_color)
696+
cubeWithAngledTopBottom(
697+
loc=[
698+
hanging_hole_x - hanging_hole_wall_thickness,
699+
hanging_hole_y - hanging_hole_wall_thickness,
700+
back_depth + case_depth - min(back_depth + case_depth, hanging_hole_depth)
701+
],
702+
size=[
703+
hanging_hole_edge == "top" || hanging_hole_edge == "bottom"
704+
? hanging_hole_box_width + hanging_hole_wall_thickness * 2
705+
: hanging_hole_box_height + hanging_hole_wall_thickness * 2,
706+
hanging_hole_edge == "top" || hanging_hole_edge == "bottom"
707+
? hanging_hole_box_height + hanging_hole_wall_thickness * 2
708+
: hanging_hole_box_width + hanging_hole_wall_thickness * 2,
709+
min(back_depth + case_depth, hanging_hole_depth)
710+
],
711+
bottom=(view_mode == "print_vertical")
712+
);
713+
}
701714
}
702715
if (pi_pinholes) {
703716
color(case_color)
@@ -817,82 +830,90 @@ module case() {
817830
}
818831
}
819832

820-
if (hanging_hole) {
821-
color(case_color)
822-
cubeWithAngledTopBottom(
823-
loc=[
824-
hanging_hole_x,
825-
hanging_hole_y,
826-
back_depth + case_depth - min(back_depth + case_depth, hanging_hole_depth) + hanging_hole_wall_thickness
827-
],
828-
size=[
833+
for (h = hanging_holes) {
834+
let (
835+
hanging_hole_edge = h[0],
836+
hanging_hole_offset_percentage = h[1],
837+
hanging_hole_pos = hanging_hole_position(hanging_hole_edge, hanging_hole_offset_percentage),
838+
hanging_hole_x = hanging_hole_pos[0],
839+
hanging_hole_y = hanging_hole_pos[1]
840+
) {
841+
color(case_color)
842+
cubeWithAngledTopBottom(
843+
loc=[
844+
hanging_hole_x,
845+
hanging_hole_y,
846+
back_depth + case_depth - min(back_depth + case_depth, hanging_hole_depth) + hanging_hole_wall_thickness
847+
],
848+
size=[
849+
hanging_hole_edge == "top" || hanging_hole_edge == "bottom"
850+
? hanging_hole_box_width
851+
: hanging_hole_box_height,
852+
hanging_hole_edge == "top" || hanging_hole_edge == "bottom"
853+
? hanging_hole_box_height
854+
: hanging_hole_box_width,
855+
min(back_depth + case_depth, hanging_hole_depth) - hanging_hole_wall_thickness * 2
856+
],
857+
bottom=(view_mode == "print_vertical")
858+
);
859+
860+
// Big cyclinter hole
861+
color(case_color)
862+
translate([
829863
hanging_hole_edge == "top" || hanging_hole_edge == "bottom"
830-
? hanging_hole_box_width
831-
: hanging_hole_box_height,
864+
? frame_full_width / 2
865+
: hanging_hole_edge == "left"
866+
? hanging_hole_x + hanging_hole_box_height * 0.75
867+
: hanging_hole_x + hanging_hole_box_height * 0.25,
868+
hanging_hole_edge == "left" || hanging_hole_edge == "right"
869+
? frame_full_height / 2
870+
: hanging_hole_edge == "top"
871+
? hanging_hole_y + hanging_hole_box_height * 0.75
872+
: hanging_hole_y + hanging_hole_box_height * 0.25,
873+
case_depth - 0.11
874+
])
875+
rotate([0, 0, 90])
876+
cylinder(d = hanging_hole_large_diameter, h = back_depth + 0.21);
877+
878+
// Small cyclinter hole
879+
color(case_color)
880+
translate([
832881
hanging_hole_edge == "top" || hanging_hole_edge == "bottom"
833-
? hanging_hole_box_height
834-
: hanging_hole_box_width,
835-
min(back_depth + case_depth, hanging_hole_depth) - hanging_hole_wall_thickness * 2
836-
],
837-
bottom=(view_mode == "print_vertical")
838-
);
882+
? frame_full_width / 2
883+
: hanging_hole_edge == "left"
884+
? hanging_hole_x + hanging_hole_box_height * 0.25
885+
: hanging_hole_x + hanging_hole_box_height * 0.75,
886+
hanging_hole_edge == "left" || hanging_hole_edge == "right"
887+
? frame_full_height / 2
888+
: hanging_hole_edge == "top"
889+
? hanging_hole_y + hanging_hole_box_height * 0.25
890+
: hanging_hole_y + hanging_hole_box_height * 0.75,
891+
case_depth - 0.11
892+
])
893+
rotate([0, 0, 90])
894+
cylinder(d = hanging_hole_small_diameter, h = back_depth + 0.21);
839895

840-
// Big cyclinter hole
841-
color(case_color)
842-
translate([
843-
hanging_hole_edge == "top" || hanging_hole_edge == "bottom"
844-
? frame_full_width / 2
845-
: hanging_hole_edge == "left"
846-
? hanging_hole_x + hanging_hole_box_height * 0.75
896+
// Box connecitng the two
897+
color(case_color)
898+
translate([
899+
hanging_hole_edge == "top" || hanging_hole_edge == "bottom"
900+
? frame_full_width / 2 - hanging_hole_small_diameter / 2
847901
: hanging_hole_x + hanging_hole_box_height * 0.25,
848-
hanging_hole_edge == "left" || hanging_hole_edge == "right"
849-
? frame_full_height / 2
850-
: hanging_hole_edge == "top"
851-
? hanging_hole_y + hanging_hole_box_height * 0.75
902+
hanging_hole_edge == "left" || hanging_hole_edge == "right"
903+
? frame_full_height / 2 - hanging_hole_small_diameter / 2
852904
: hanging_hole_y + hanging_hole_box_height * 0.25,
853-
case_depth - 0.11
854-
])
855-
rotate([0, 0, 90])
856-
cylinder(d = hanging_hole_large_diameter, h = back_depth + 0.21);
857-
858-
// Small cyclinter hole
859-
color(case_color)
860-
translate([
861-
hanging_hole_edge == "top" || hanging_hole_edge == "bottom"
862-
? frame_full_width / 2
863-
: hanging_hole_edge == "left"
864-
? hanging_hole_x + hanging_hole_box_height * 0.25
865-
: hanging_hole_x + hanging_hole_box_height * 0.75,
866-
hanging_hole_edge == "left" || hanging_hole_edge == "right"
867-
? frame_full_height / 2
868-
: hanging_hole_edge == "top"
869-
? hanging_hole_y + hanging_hole_box_height * 0.25
870-
: hanging_hole_y + hanging_hole_box_height * 0.75,
871-
case_depth - 0.11
872-
])
873-
rotate([0, 0, 90])
874-
cylinder(d = hanging_hole_small_diameter, h = back_depth + 0.21);
875-
876-
// Box connecitng the two
877-
color(case_color)
878-
translate([
879-
hanging_hole_edge == "top" || hanging_hole_edge == "bottom"
880-
? frame_full_width / 2 - hanging_hole_small_diameter / 2
881-
: hanging_hole_x + hanging_hole_box_height * 0.25,
882-
hanging_hole_edge == "left" || hanging_hole_edge == "right"
883-
? frame_full_height / 2 - hanging_hole_small_diameter / 2
884-
: hanging_hole_y + hanging_hole_box_height * 0.25,
885-
case_depth - 0.11
886-
])
887-
cube([
888-
hanging_hole_edge == "top" || hanging_hole_edge == "bottom"
889-
? hanging_hole_small_diameter
890-
: hanging_hole_large_diameter,
891-
hanging_hole_edge == "left" || hanging_hole_edge == "right"
892-
? hanging_hole_small_diameter
893-
: hanging_hole_large_diameter,
894-
back_depth + 0.21
895-
]);
905+
case_depth - 0.11
906+
])
907+
cube([
908+
hanging_hole_edge == "top" || hanging_hole_edge == "bottom"
909+
? hanging_hole_small_diameter
910+
: hanging_hole_large_diameter,
911+
hanging_hole_edge == "left" || hanging_hole_edge == "right"
912+
? hanging_hole_small_diameter
913+
: hanging_hole_large_diameter,
914+
back_depth + 0.21
915+
]);
916+
}
896917
}
897918

898919
if (rear_cooling) {

cases/pimoroni.13in3.spectra.12mm.scad

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,11 @@ usb_cutout_box_height = 55;
7272
usb_cutout_hole_position = "top"; // [top, bottom, left, right, back]
7373

7474
/* [Hanging hole] */
75-
hanging_hole = true;
76-
hanging_hole_offset = 50;
75+
// [ [top, bottom, left, right], offset_percentage ]
76+
hanging_holes = [
77+
["top", 20],
78+
["right", 20]
79+
];
7780

7881
/* [SD card adapter cutout] */
7982
sd_card_in_leg = false;

cases/pimoroni.13in3.spectra.6mm.scad

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,11 @@ usb_cutout_box_height = 55;
7272
usb_cutout_hole_position = "top"; // [top, bottom, left, right, back]
7373

7474
/* [Hanging hole] */
75-
hanging_hole = true;
76-
hanging_hole_offset = 50;
75+
// [ [top, bottom, left, right], offset_percentage ]
76+
hanging_holes = [
77+
["top", 20],
78+
["right", 20]
79+
];
7780

7881
/* [SD card adapter cutout] */
7982
sd_card_in_leg = false;

cases/pimoroni.7in3.spectra.12mm.scad

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,10 @@ usb_cutout_box_height = 55;
7272
usb_cutout_hole_position = "top"; // [top, bottom, left, right, back]
7373

7474
/* [Hanging hole] */
75-
hanging_hole = false;
76-
hanging_hole_offset = 50;
75+
// [ [top, bottom, left, right], offset_percentage ]
76+
hanging_holes = [
77+
// ["top", 20],
78+
];
7779

7880
/* [SD card adapter cutout] */
7981
sd_card_in_leg = false;
@@ -99,7 +101,7 @@ pi_pinholes_x_percentage = 50;
99101
pi_pinholes_y_percentage = 85;
100102

101103
/* [Side buttons] */
102-
side_buttons_left = [0.2023, 0.3855, 0.5740, 0.7550];
104+
side_buttons_left = [];//[0.2023, 0.3855, 0.5740, 0.7550];
103105
side_buttons_right = [];
104106
side_buttons_top = [];
105107
side_buttons_bottom = [];

cases/waveshare.10in3.scad

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,11 @@ usb_cutout_hole_width = 14;
7070
usb_cutout_hole_height = 6.0;
7171

7272
/* [Hanging hole] */
73-
hanging_hole = true;
74-
hanging_hole_offset = 30;
73+
// [ [top, bottom, left, right], offset_percentage ]
74+
hanging_holes = [
75+
["top", 20],
76+
["left", 18],
77+
];
7578

7679
/* [Debug] */
7780
cross_section_percentage = 0; // [0:100]

cases/waveshare.13in3e.scad

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,11 @@ usb_cutout_box_height = 55;
6666
usb_cutout_hole_position = "top"; // [top, bottom, left, right, back]
6767

6868
/* [Hanging hole] */
69-
hanging_hole = true;
70-
hanging_hole_offset = 50;
69+
// [ [top, bottom, left, right], offset_percentage ]
70+
hanging_holes = [
71+
["top", 20],
72+
["left", 20],
73+
];
7174

7275
/* [SD card adapter cutout] */
7376
sd_card_in_leg = false;

cases/waveshare.4in01f.desk.scad

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,10 @@ usb_cutout_bottom_wall_thickness = 1.2;
6666
usb_cutout_hole_height = 5.8;
6767

6868
/* [Hanging hole] */
69-
hanging_hole = false;
70-
hanging_hole_offset = 4;
69+
// [ [top, bottom, left, right], offset_percentage ]
70+
hanging_holes = [
71+
// ["top", 10],
72+
];
7173

7274
/* [Debug] */
7375
cross_section_percentage = 0; // [0:100]

cases/waveshare.4in0e.desk.scad

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,10 @@ usb_cutout_bottom_wall_thickness = 1.2;
6666
usb_cutout_hole_height = 5.8;
6767

6868
/* [Hanging hole] */
69-
hanging_hole = false;
70-
hanging_hole_offset = 4;
69+
// [ [top, bottom, left, right], offset_percentage ]
70+
hanging_holes = [
71+
// ["top", 10],
72+
];
7173

7274
/* [Debug] */
7375
cross_section_percentage = 0; // [0:100]

cases/waveshare.7in3e.scad

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ usb_cutout_box_depth = 6.4;
6868
// usb_cutout_hole_width = 14;
6969

7070
/* [Hanging hole] */
71-
hanging_hole = true;
72-
hanging_hole_offset = 7;
71+
// [ [top, bottom, left, right], offset_percentage ]
72+
hanging_holes = [
73+
["top", 9],
74+
];
7375

7476
/* [SD card adapter cutout] */
7577
sd_card_in_leg = true;

0 commit comments

Comments
 (0)