From bf7377efbb8643b23f8bf64c304cf7a80d4e5c46 Mon Sep 17 00:00:00 2001 From: Edward Kisiel Date: Sat, 21 Jan 2023 20:38:03 -0500 Subject: [PATCH] fixed access_port and access_cover 180 rotation in portrait and landscape. --- sbc_case_builder.scad | 45 ++++++++++++++++++++++++++++------- sbc_case_builder_library.scad | 17 ++++++++++--- 2 files changed, 50 insertions(+), 12 deletions(-) diff --git a/sbc_case_builder.scad b/sbc_case_builder.scad index abab76a..26b1b8f 100644 --- a/sbc_case_builder.scad +++ b/sbc_case_builder.scad @@ -46,7 +46,8 @@ 20221207 Version 2.0.3 added part view to facilitate individual part prints, updated sbc model framework, added n2l and m1 cases 2023xxxx Version 2.0.x fixed standoff sidewall support misplacement on sbc move, fixed standoff auto - opening z height, fixed case top right side standoffs support + opening z height, fixed case top right side standoffs support, + fixed access_port and access_cover 180 rotation in portrait and landscape, see https://github.com/hominoids/SBC_Case_Builder */ @@ -1221,16 +1222,42 @@ module case_bottom(case_design) { } if ((class == "add1" || class == "add2") && face == "bottom" && type == "access_port") { if(data_3 == "landscape") { - parametric_move_sub("rectangle",loc_x+6,loc_y-.5,loc_z-adjust,face,rotation, - parametric,size_x-17,size_y-1,floorthick+1,data_1,data_2,data_3,[.1,.1,.1,.1]); - parametric_move_sub("rectangle",loc_x+size_x-12.5,loc_y+(size_y/2)-6,loc_z-adjust,face,rotation, - parametric,5.5,10.5,floorthick+.12,data_1,data_2,data_3,[5.5,5.5,5.5,5.5]); + if(rotation[2] == 180) { + parametric_move_sub("rectangle",loc_x-6+size_x,loc_y+.5+size_y,loc_z-adjust,face,rotation, + parametric,size_x-17,size_y-1,floorthick+1,data_1,data_2,data_3,[.1,.1,.1,.1]); + parametric_move_sub("rectangle",loc_x-size_x+12.5+size_x,loc_y-(size_y/2)+6+size_y,loc_z-adjust, + face,rotation,parametric,5.5,10.5,floorthick+.12,data_1,data_2,data_3,[5.5,5.5,5.5,5.5]); + } + else { + parametric_move_sub("rectangle",loc_x+6,loc_y-.5,loc_z-adjust,face,rotation, + parametric,size_x-17,size_y-1,floorthick+1,data_1,data_2,data_3,[.1,.1,.1,.1]); + parametric_move_sub("rectangle",loc_x+size_x-12.5,loc_y+(size_y/2)-6,loc_z-adjust,face,rotation, + parametric,5.5,10.5,floorthick+.12,data_1,data_2,data_3,[5.5,5.5,5.5,5.5]); + + } } else { - parametric_move_sub("rectangle",loc_x+.5,loc_y+5.75,loc_z-adjust,face,rotation, - parametric,size_x-1,size_y-17,floorthick+1,data_1,data_2,data_3,[.1,.1,.1,.1]); - parametric_move_sub("rectangle",loc_x+(size_x/2)-5,loc_y+size_y-12.5,loc_z-adjust,face,rotation, - parametric,10.5,5.5,floorthick+.12,data_1,data_2,data_3,[5.5,5.5,5.5,5.5]); + if(rotation[2] == 180) { + if(data_3 == "portrait") { + parametric_move_sub("rectangle",loc_x+size_x-.5,loc_y+size_y-5.75,loc_z-adjust,face, + rotation,parametric,size_x-1,size_y-17,floorthick+1,data_1,data_2,data_3,[.1,.1,.1,.1]); + parametric_move_sub("rectangle",loc_x-(size_x/2)+5+size_x,loc_y-size_y+12.5+size_y, + loc_z-adjust,face,rotation,parametric,10.5,5.5,floorthick+.12,data_1,data_2,data_3, + [5.5,5.5,5.5,5.5]); + } + else { + parametric_move_sub("rectangle",loc_x-.5,loc_y-5.75,loc_z-adjust,face,rotation, + parametric,size_x-1,size_y-17,floorthick+1,data_1,data_2,data_3,[.1,.1,.1,.1]); + parametric_move_sub("rectangle",loc_x-(size_x/2)+5,loc_y-size_y+12.5,loc_z-adjust,face, + rotation,parametric,10.5,5.5,floorthick+.12,data_1,data_2,data_3,[5.5,5.5,5.5,5.5]); + } + } + else { + parametric_move_sub("rectangle",loc_x+.5,loc_y+5.75,loc_z-adjust,face,rotation, + parametric,size_x-1,size_y-17,floorthick+1,data_1,data_2,data_3,[.1,.1,.1,.1]); + parametric_move_sub("rectangle",loc_x+(size_x/2)-5,loc_y+size_y-12.5,loc_z-adjust,face,rotation, + parametric,10.5,5.5,floorthick+.12,data_1,data_2,data_3,[5.5,5.5,5.5,5.5]); + } } } if ((class == "model") && face == "bottom" && type == "h2_netcard") { diff --git a/sbc_case_builder_library.scad b/sbc_case_builder_library.scad index a62dfbb..3a80ca8 100644 --- a/sbc_case_builder_library.scad +++ b/sbc_case_builder_library.scad @@ -52,7 +52,8 @@ 2023xxxx version 2.0.x added h3_port_extender(style, mask = false), hk_pwr_button(mask = false), keyhole(keysize, mask = false), vent_hex(cells_x, cells_y, cell_size, cell_spacing, orientation) and supporting code, dsub(dsubsize, mask = false), vent_panel_hex(x, y, thick, cell_size, cell_spacing, border, borders), - added nut_holder(nut, style, dia_x, dia_y, height) + added nut_holder(nut, style, dia_x, dia_y, height), fixed access_port and access_cover 180 rotation + in portrait and landscape, see https://github.com/hominoids/SBC_Case_Builder @@ -277,10 +278,20 @@ module add(type,loc_x,loc_y,loc_z,face,rotation,size_x,size_y,size_z,data_1,data translate([loc_x,loc_y,loc_z]) rotate(rotation) feet(size_x, size_z); } if(type == "access_port") { - translate([loc_x,loc_y,loc_z]) rotate(rotation) access_port([size_x,size_y,size_z],data_3); + if(rotation[2] == 180) { + translate([loc_x+size_x,loc_y+size_y,loc_z]) rotate(rotation) access_port([size_x,size_y,size_z],data_3); + } + else { + translate([loc_x,loc_y,loc_z]) rotate(rotation) access_port([size_x,size_y,size_z],data_3); + } } if(type == "access_cover") { - color("grey",1) translate([loc_x,loc_y,loc_z]) rotate(rotation) access_cover([size_x,size_y,size_z],data_3); + if(rotation[2] == 180) { + color("grey",1) translate([loc_x+size_x,loc_y+size_y,loc_z]) rotate(rotation) access_cover([size_x,size_y,size_z],data_3); + } + else { + color("grey",1) translate([loc_x,loc_y,loc_z]) rotate(rotation) access_cover([size_x,size_y,size_z],data_3); + } } if(type == "boom_vring") { translate([loc_x,loc_y,loc_z]) rotate(rotation) boom_vring(data_1);