@@ -179,12 +179,15 @@ usb_cutout_hole_height = 3.2;
179179usb_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+ ];
185189hanging_hole_large_diameter = 8 ;
186190hanging_hole_small_diameter = 3 ;
187- hanging_hole_offset_percentage = 18 ;
188191hanging_hole_box_width = 12 ;
189192hanging_hole_box_height = 16 ;
190193hanging_hole_depth = 7 ;
@@ -278,21 +281,6 @@ kickstand_full_width = kickstand_width + 2 * kickstand_wall_thickness + 2 * kick
278281kickstand_leg_full_width = kickstand_leg_width + 2 * kickstand_wall_thickness + 2 * kickstand_gap_thickness;
279282kickstand_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-
296284usb_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 ;
297285usb_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) {
0 commit comments