From 72910f55ae12a161d9c21bf7e5b096482f011a9c Mon Sep 17 00:00:00 2001 From: Joel Ebel Date: Mon, 7 May 2018 22:52:51 -0400 Subject: [PATCH] Add a PCBThick parameter Use it to calculate the top margin from the top of the board. Draw the transparent board with appropriate thickness Provide convenience variables for board position on panel. --- files/U_Box_V104_Test_Cleaned.scad | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/files/U_Box_V104_Test_Cleaned.scad b/files/U_Box_V104_Test_Cleaned.scad index 94491c7..525a38e 100644 --- a/files/U_Box_V104_Test_Cleaned.scad +++ b/files/U_Box_V104_Test_Cleaned.scad @@ -48,6 +48,8 @@ Vent_width = 1.5; PCBLength = 80; // - Largeur PCB - PCB Width PCBWidth = 60; +// - Epaisseur PCB Thickness +PCBThick = 1.6; // You likely need to maintain |Thick| margin on the left and right for tabs // and whatnot. // - Margin between front panel and PCB @@ -58,8 +60,10 @@ BackEdgeMargin = 10; LeftEdgeMargin = 11; // - Margin between right wall and PCB RightEdgeMargin = 95; -// - Margin between top of PCB foot and box top. -TopMargin = 86; +// - Margin between top of PCB and box top. +TopPCBMargin = 84; + + /* [PCB_Feet] */ // - Heuteur pied - Feet height above box interior @@ -121,6 +125,8 @@ Dec_size = Vent ? Thick*2 : 0.8; // Calculate box dimensions from PCB. + +TopMargin = PCBThick + TopPCBMargin; Length = PCBLength + FrontEdgeMargin + BackEdgeMargin + ((Thick*2 + m)*2); Width = PCBWidth + LeftEdgeMargin + RightEdgeMargin + Thick*2; Height = FootHeight + TopMargin + Thick*2; @@ -131,6 +137,12 @@ PanelWidth = Width - Thick*2 - m; PanelHeight = Height - Thick*2 - m; +// Calculate board-relative positions with respect to the panel, for +// convenience in placing panel elements. +TopOfBoardWRTPanel = FootHeight + PCBThick - (m/2); +LeftEdgeOfBoardWRTPanel = LeftEdgeMargin - (m/2); + + /* Generic rounded box Produces a box of the specified dimensions. Corners are rounded according to @@ -307,8 +319,8 @@ module Feet() { translate([BackEdgeMargin + Thick*2 + m, LeftEdgeMargin + Thick, Thick]) { //////////////////// - PCB only visible in the preview mode - ///////////////////// translate([0, 0, FootHeight]) { - %square([PCBLength, PCBWidth]); - translate([PCBLength/2, PCBWidth/2, 0.5]) { + %cube([PCBLength, PCBWidth, PCBThick]); + translate([PCBLength/2, PCBWidth/2, PCBThick + 0.5]) { color("Olive") { %text("PCB", halign="center", valign="center", font="Arial black"); }