Separate the X and Y/Z gaps around the panel

The panel gap didn't need to be as large around the outer edge, so call
that PanelEdgeGap and default it to PartMargin*2. Leave the thickness
margin at CutoutMargin*2 + PartMargin*2 and rename it to PanelThickGap.
This commit is contained in:
Joel Ebel 2018-06-30 22:43:48 -04:00
parent b4d32de8fd
commit e06447fe86

View File

@ -66,7 +66,8 @@ Vent = 1; // [0:No, 1:Yes]
// - Decoration-Holes width (in mm) // - Decoration-Holes width (in mm)
Vent_width = 1.5; Vent_width = 1.5;
// - Tolerance (Panel/rails gap) // - Tolerance (Panel/rails gap)
PanelGap = CutoutMargin*2 + PartMargin*2; PanelThickGap = CutoutMargin*2 + PartMargin*2;
PanelEdgeGap = PartMargin*2;
/* [Box Fixation Tabs] */ /* [Box Fixation Tabs] */
@ -171,7 +172,7 @@ Dec_Thick = Vent ? Thick*1.001 + Filet : Thick/2;
// Separate vents with a square pillar by default. // Separate vents with a square pillar by default.
Dec_Spacing = Thick + Vent_width; Dec_Spacing = Thick + Vent_width;
// X offset to center of first vent // X offset to center of first vent
Dec_Offset = Thick*2 + PanelThick + PanelGap + Dec_Spacing - Vent_width/2; Dec_Offset = Thick*2 + PanelThick + PanelThickGap + Dec_Spacing - Vent_width/2;
// Resolution based on Round parameter. Set this first number to something // Resolution based on Round parameter. Set this first number to something
// smaller to speed up processing. It should always be a multiple of 4. // smaller to speed up processing. It should always be a multiple of 4.
@ -184,16 +185,16 @@ Resolution = Round ? 100: 4;
design, you will need to set the TopMargin to design, you will need to set the TopMargin to
(Height - Thick*2 - FootHeight - PCBThick) (Height - Thick*2 - FootHeight - PCBThick)
*/ */
Length = PCBLength + FrontEdgeMargin + BackEdgeMargin + ((Thick + PanelThick + PanelGap)*2); Length = PCBLength + FrontEdgeMargin + BackEdgeMargin + ((Thick + PanelThick + PanelThickGap)*2);
Width = PCBWidth + LeftEdgeMargin + RightEdgeMargin + Thick*2; Width = PCBWidth + LeftEdgeMargin + RightEdgeMargin + Thick*2;
Height = FootHeight + PCBThick + TopMargin + Thick*2; Height = FootHeight + PCBThick + TopMargin + Thick*2;
echo("Box: ", Length=Length, Width=Width, Height=Height); echo("Box: ", Length=Length, Width=Width, Height=Height);
// X position inset of mounting holes and tabs // X position inset of mounting holes and tabs
MountInset = Thick*3 + PanelThick + PanelGap + ScrewHole*4; MountInset = Thick*3 + PanelThick + PanelThickGap + ScrewHole*4;
// Calculate panel dimensions from box dimensions. // Calculate panel dimensions from box dimensions.
PanelWidth = Width - Thick*2 - PanelGap; PanelWidth = Width - Thick*2 - PanelEdgeGap;
PanelHeight = Height - Thick*2 - PanelGap; PanelHeight = Height - Thick*2 - PanelEdgeGap;
/* Panel Manager /* Panel Manager
@ -208,14 +209,14 @@ PanelHeight = Height - Thick*2 - PanelGap;
// Calculate board-relative positions with respect to the panel, for // Calculate board-relative positions with respect to the panel, for
// convenience in placing panel elements. // convenience in placing panel elements.
TopOfBoardWRTPanel = FootHeight + PCBThick - (PanelGap/2); TopOfBoardWRTPanel = FootHeight + PCBThick - (PanelEdgeGap/2);
LeftEdgeOfBoardWRTFPanel = LeftEdgeMargin - (PanelGap/2); LeftEdgeOfBoardWRTFPanel = LeftEdgeMargin - (PanelEdgeGap/2);
LeftEdgeOfBoardWRTBPanel = RightEdgeMargin - (PanelGap/2); LeftEdgeOfBoardWRTBPanel = RightEdgeMargin - (PanelEdgeGap/2);
// Visible panel edges // Visible panel edges
PanelBottomEdge = Thick - (PanelGap/2); PanelBottomEdge = Thick - (PanelEdgeGap/2);
PanelTopEdge = PanelHeight - Thick + (PanelGap/2); PanelTopEdge = PanelHeight - Thick + (PanelEdgeGap/2);
PanelLeftEdge = Thick - (PanelGap/2); PanelLeftEdge = Thick - (PanelEdgeGap/2);
PanelRightEdge = PanelWidth - Thick + (PanelGap/2); PanelRightEdge = PanelWidth - Thick + (PanelEdgeGap/2);
// Holes for front panel // Holes for front panel
@ -324,8 +325,8 @@ module MainBox() {
} }
// Makes interior backing for panel as a wall // Makes interior backing for panel as a wall
difference() { difference() {
RoundBox(xshrink=(Thick + PanelThick + PanelGap), yzshrink=Thick/2); RoundBox(xshrink=(Thick + PanelThick + PanelThickGap), yzshrink=Thick/2);
RoundBox(xshrink=(Thick*2 + PanelThick + PanelGap)); RoundBox(xshrink=(Thick*2 + PanelThick + PanelThickGap));
} }
} }
// Remove the top half // Remove the top half
@ -611,7 +612,7 @@ module foot() {
No arguments are used, but parameters provide the PCB and foot dimensions. No arguments are used, but parameters provide the PCB and foot dimensions.
*/ */
module Feet(top=0) { module Feet(top=0) {
translate([BackEdgeMargin + Thick + PanelThick + PanelGap, LeftEdgeMargin + Thick, Thick]) { translate([BackEdgeMargin + Thick + PanelThick + PanelThickGap, LeftEdgeMargin + Thick, Thick]) {
if (!top) { if (!top) {
%PCB(); %PCB();
} }
@ -682,7 +683,7 @@ module BottomShell() {
arguments but uses the global parameters. arguments but uses the global parameters.
*/ */
module Panel() { module Panel() {
Filet = (Filet > Thick*2) ? Filet - Thick - PanelGap/2 : Filet - PanelGap/2; Filet = (Filet > Thick*2) ? Filet - Thick - PanelEdgeGap/2 : Filet - PanelEdgeGap/2;
echo("Panel:", Thick=PanelThick, PanelWidth=PanelWidth, PanelHeight=PanelHeight, Filet=Filet); echo("Panel:", Thick=PanelThick, PanelWidth=PanelWidth, PanelHeight=PanelHeight, Filet=Filet);
translate([Filet, Filet, 0]) { translate([Filet, Filet, 0]) {
offset(r=Filet, $fn=Resolution) { offset(r=Filet, $fn=Resolution) {
@ -807,9 +808,9 @@ module CText(OnOff, Tx, Ty, Font, Size, TxtRadius, Angl, Turn, Content) {
text for your box. text for your box.
*/ */
module FPanL() { module FPanL() {
translate([Length - (Thick + PanelGap/2 + PanelThick), translate([Length - (Thick + PanelThickGap/2 + PanelThick),
Thick + PanelGap/2, Thick + PanelEdgeGap/2,
Thick + PanelGap/2]) { Thick + PanelEdgeGap/2]) {
rotate([90, 0, 90]) { rotate([90, 0, 90]) {
color(Couleur2) { color(Couleur2) {
linear_extrude(height=PanelThick) { linear_extrude(height=PanelThick) {
@ -838,9 +839,9 @@ module FPanL() {
text for your box. text for your box.
*/ */
module BPanL() { module BPanL() {
translate([Thick + PanelGap/2 + PanelThick, translate([Thick + PanelThickGap/2 + PanelThick,
Thick + PanelGap/2 + PanelWidth, Thick + PanelEdgeGap/2 + PanelWidth,
Thick + PanelGap/2]) { Thick + PanelEdgeGap/2]) {
rotate([90, 0, 270]) { rotate([90, 0, 270]) {
color(Couleur2) { color(Couleur2) {
linear_extrude(height=PanelThick) { linear_extrude(height=PanelThick) {