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.
This commit is contained in:
Joel Ebel 2018-05-07 22:52:51 -04:00
parent 2942f6005c
commit 72910f55ae

View File

@ -48,6 +48,8 @@ Vent_width = 1.5;
PCBLength = 80; PCBLength = 80;
// - Largeur PCB - PCB Width // - Largeur PCB - PCB Width
PCBWidth = 60; PCBWidth = 60;
// - Epaisseur PCB Thickness
PCBThick = 1.6;
// You likely need to maintain |Thick| margin on the left and right for tabs // You likely need to maintain |Thick| margin on the left and right for tabs
// and whatnot. // and whatnot.
// - Margin between front panel and PCB // - Margin between front panel and PCB
@ -58,8 +60,10 @@ BackEdgeMargin = 10;
LeftEdgeMargin = 11; LeftEdgeMargin = 11;
// - Margin between right wall and PCB // - Margin between right wall and PCB
RightEdgeMargin = 95; RightEdgeMargin = 95;
// - Margin between top of PCB foot and box top. // - Margin between top of PCB and box top.
TopMargin = 86; TopPCBMargin = 84;
/* [PCB_Feet] */ /* [PCB_Feet] */
// - Heuteur pied - Feet height above box interior // - Heuteur pied - Feet height above box interior
@ -121,6 +125,8 @@ Dec_size = Vent ? Thick*2 : 0.8;
// Calculate box dimensions from PCB. // Calculate box dimensions from PCB.
TopMargin = PCBThick + TopPCBMargin;
Length = PCBLength + FrontEdgeMargin + BackEdgeMargin + ((Thick*2 + m)*2); Length = PCBLength + FrontEdgeMargin + BackEdgeMargin + ((Thick*2 + m)*2);
Width = PCBWidth + LeftEdgeMargin + RightEdgeMargin + Thick*2; Width = PCBWidth + LeftEdgeMargin + RightEdgeMargin + Thick*2;
Height = FootHeight + TopMargin + Thick*2; Height = FootHeight + TopMargin + Thick*2;
@ -131,6 +137,12 @@ PanelWidth = Width - Thick*2 - m;
PanelHeight = Height - 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 /* Generic rounded box
Produces a box of the specified dimensions. Corners are rounded according to 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]) { translate([BackEdgeMargin + Thick*2 + m, LeftEdgeMargin + Thick, Thick]) {
//////////////////// - PCB only visible in the preview mode - ///////////////////// //////////////////// - PCB only visible in the preview mode - /////////////////////
translate([0, 0, FootHeight]) { translate([0, 0, FootHeight]) {
%square([PCBLength, PCBWidth]); %cube([PCBLength, PCBWidth, PCBThick]);
translate([PCBLength/2, PCBWidth/2, 0.5]) { translate([PCBLength/2, PCBWidth/2, PCBThick + 0.5]) {
color("Olive") { color("Olive") {
%text("PCB", halign="center", valign="center", font="Arial black"); %text("PCB", halign="center", valign="center", font="Arial black");
} }