From bdbdebde18524a228fb3f83e7d944d1dcbe836ef Mon Sep 17 00:00:00 2001 From: Joel Ebel Date: Fri, 20 Jul 2018 00:53:58 -0400 Subject: [PATCH 1/5] Separate horizontal and vertical panel gaps Turns out we still need more in the horizontal due to cutout margins at the bottom of the slot. This isn't needed in the vertical. Separating these lets us give more horizontal gap again without sacrificing tight vertical tolerancees. --- files/Ultimate_Box.scad | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/files/Ultimate_Box.scad b/files/Ultimate_Box.scad index 81123ef..97be1eb 100644 --- a/files/Ultimate_Box.scad +++ b/files/Ultimate_Box.scad @@ -67,7 +67,8 @@ Vent = 1; // [0:No, 1:Yes] Vent_width = 1.5; // - Tolerance (Panel/rails gap) PanelThickGap = CutoutMargin*2 + PartMargin*2; -PanelEdgeGap = PartMargin*2; +PanelVerticalGap = PartMargin*2; +PanelHorizontalGap = CutoutMargin*2 + PartMargin*2; /* [Box Fixation Tabs] */ @@ -193,8 +194,8 @@ echo("Box: ", Length=Length, Width=Width, Height=Height); MountInset = Thick*3 + PanelThick + PanelThickGap + ScrewHole*4; // Calculate panel dimensions from box dimensions. -PanelWidth = Width - Thick*2 - PanelEdgeGap; -PanelHeight = Height - Thick*2 - PanelEdgeGap; +PanelWidth = Width - Thick*2 - PanelHorizontalGap; +PanelHeight = Height - Thick*2 - PanelVerticalGap; /* Panel Manager @@ -209,14 +210,14 @@ PanelHeight = Height - Thick*2 - PanelEdgeGap; // Calculate board-relative positions with respect to the panel, for // convenience in placing panel elements. -TopOfBoardWRTPanel = FootHeight + PCBThick - (PanelEdgeGap/2); -LeftEdgeOfBoardWRTFPanel = LeftEdgeMargin - (PanelEdgeGap/2); -LeftEdgeOfBoardWRTBPanel = RightEdgeMargin - (PanelEdgeGap/2); +TopOfBoardWRTPanel = FootHeight + PCBThick - (PanelVerticalGap/2); +LeftEdgeOfBoardWRTFPanel = LeftEdgeMargin - (PanelHorizontalGap/2); +LeftEdgeOfBoardWRTBPanel = RightEdgeMargin - (PanelHorizontalGap/2); // Visible panel edges -PanelBottomEdge = Thick - (PanelEdgeGap/2); -PanelTopEdge = PanelHeight - Thick + (PanelEdgeGap/2); -PanelLeftEdge = Thick - (PanelEdgeGap/2); -PanelRightEdge = PanelWidth - Thick + (PanelEdgeGap/2); +PanelBottomEdge = Thick - (PanelVerticalGap/2); +PanelTopEdge = PanelHeight - Thick + (PanelVerticalGap/2); +PanelLeftEdge = Thick - (PanelHorizontalGap/2); +PanelRightEdge = PanelWidth - Thick + (PanelHorizontalGap/2); // Holes for front panel @@ -683,7 +684,7 @@ module BottomShell() { arguments but uses the global parameters. */ module Panel() { - Filet = (Filet > Thick*2) ? Filet - Thick - PanelEdgeGap/2 : Filet - PanelEdgeGap/2; + Filet = (Filet > Thick*2) ? Filet - Thick - PanelVerticalGap/2 : Filet - PanelVerticalGap/2; echo("Panel:", Thick=PanelThick, PanelWidth=PanelWidth, PanelHeight=PanelHeight, Filet=Filet); translate([Filet, Filet, 0]) { offset(r=Filet, $fn=Resolution) { @@ -809,8 +810,8 @@ module CText(OnOff, Tx, Ty, Font, Size, TxtRadius, Angl, Turn, Content) { */ module FPanL() { translate([Length - (Thick + PanelThickGap/2 + PanelThick), - Thick + PanelEdgeGap/2, - Thick + PanelEdgeGap/2]) { + Thick + PanelHorizontalGap/2, + Thick + PanelVerticalGap/2]) { rotate([90, 0, 90]) { color(Couleur2) { linear_extrude(height=PanelThick) { @@ -840,8 +841,8 @@ module FPanL() { */ module BPanL() { translate([Thick + PanelThickGap/2 + PanelThick, - Thick + PanelEdgeGap/2 + PanelWidth, - Thick + PanelEdgeGap/2]) { + Thick + PanelHorizontalGap/2 + PanelWidth, + Thick + PanelVerticalGap/2]) { rotate([90, 0, 270]) { color(Couleur2) { linear_extrude(height=PanelThick) { From dfde39fe116e7c813ecf4f35c4041b928dc39908 Mon Sep 17 00:00:00 2001 From: Joel Ebel Date: Fri, 20 Jul 2018 01:05:49 -0400 Subject: [PATCH 2/5] Think of panel gaps as on a single edge. Panel gaps were previously for both edges, as in the reduction in size of the panel. The code often divides this value by 2 to think about a single edge. It makes more sense to just store this value as on a single edge and just double it in the cases we need it, which is fewer than the cases were we previously cut it in half. This is fewer opterations and easier to reason about. --- files/Ultimate_Box.scad | 52 ++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/files/Ultimate_Box.scad b/files/Ultimate_Box.scad index 97be1eb..0c17d93 100644 --- a/files/Ultimate_Box.scad +++ b/files/Ultimate_Box.scad @@ -65,10 +65,10 @@ Decorations = 1; // [0:No, 1:Yes] Vent = 1; // [0:No, 1:Yes] // - Decoration-Holes width (in mm) Vent_width = 1.5; -// - Tolerance (Panel/rails gap) -PanelThickGap = CutoutMargin*2 + PartMargin*2; -PanelVerticalGap = PartMargin*2; -PanelHorizontalGap = CutoutMargin*2 + PartMargin*2; +// - Tolerance (Panel/rails gap on one edge) +PanelThickGap = CutoutMargin + PartMargin; +PanelVerticalGap = PartMargin; +PanelHorizontalGap = CutoutMargin + PartMargin; /* [Box Fixation Tabs] */ @@ -173,7 +173,7 @@ Dec_Thick = Vent ? Thick*1.001 + Filet : Thick/2; // Separate vents with a square pillar by default. Dec_Spacing = Thick + Vent_width; // X offset to center of first vent -Dec_Offset = Thick*2 + PanelThick + PanelThickGap + Dec_Spacing - Vent_width/2; +Dec_Offset = Thick*2 + PanelThick + PanelThickGap*2 + Dec_Spacing - Vent_width/2; // Resolution based on Round parameter. Set this first number to something // smaller to speed up processing. It should always be a multiple of 4. @@ -186,16 +186,16 @@ Resolution = Round ? 100: 4; design, you will need to set the TopMargin to (Height - Thick*2 - FootHeight - PCBThick) */ -Length = PCBLength + FrontEdgeMargin + BackEdgeMargin + ((Thick + PanelThick + PanelThickGap)*2); +Length = PCBLength + FrontEdgeMargin + BackEdgeMargin + ((Thick + PanelThick + PanelThickGap*2)*2); Width = PCBWidth + LeftEdgeMargin + RightEdgeMargin + Thick*2; Height = FootHeight + PCBThick + TopMargin + Thick*2; echo("Box: ", Length=Length, Width=Width, Height=Height); // X position inset of mounting holes and tabs -MountInset = Thick*3 + PanelThick + PanelThickGap + ScrewHole*4; +MountInset = Thick*3 + PanelThick + PanelThickGap*2 + ScrewHole*4; // Calculate panel dimensions from box dimensions. -PanelWidth = Width - Thick*2 - PanelHorizontalGap; -PanelHeight = Height - Thick*2 - PanelVerticalGap; +PanelWidth = Width - Thick*2 - PanelHorizontalGap*2; +PanelHeight = Height - Thick*2 - PanelVerticalGap*2; /* Panel Manager @@ -210,14 +210,14 @@ PanelHeight = Height - Thick*2 - PanelVerticalGap; // Calculate board-relative positions with respect to the panel, for // convenience in placing panel elements. -TopOfBoardWRTPanel = FootHeight + PCBThick - (PanelVerticalGap/2); -LeftEdgeOfBoardWRTFPanel = LeftEdgeMargin - (PanelHorizontalGap/2); -LeftEdgeOfBoardWRTBPanel = RightEdgeMargin - (PanelHorizontalGap/2); +TopOfBoardWRTPanel = FootHeight + PCBThick - PanelVerticalGap; +LeftEdgeOfBoardWRTFPanel = LeftEdgeMargin - PanelHorizontalGap; +LeftEdgeOfBoardWRTBPanel = RightEdgeMargin - PanelHorizontalGap; // Visible panel edges -PanelBottomEdge = Thick - (PanelVerticalGap/2); -PanelTopEdge = PanelHeight - Thick + (PanelVerticalGap/2); -PanelLeftEdge = Thick - (PanelHorizontalGap/2); -PanelRightEdge = PanelWidth - Thick + (PanelHorizontalGap/2); +PanelBottomEdge = Thick - PanelVerticalGap; +PanelTopEdge = PanelHeight - Thick + PanelVerticalGap; +PanelLeftEdge = Thick - PanelHorizontalGap; +PanelRightEdge = PanelWidth - Thick + PanelHorizontalGap; // Holes for front panel @@ -326,8 +326,8 @@ module MainBox() { } // Makes interior backing for panel as a wall difference() { - RoundBox(xshrink=(Thick + PanelThick + PanelThickGap), yzshrink=Thick/2); - RoundBox(xshrink=(Thick*2 + PanelThick + PanelThickGap)); + RoundBox(xshrink=(Thick + PanelThick + PanelThickGap*2), yzshrink=Thick/2); + RoundBox(xshrink=(Thick*2 + PanelThick + PanelThickGap*2)); } } // Remove the top half @@ -613,7 +613,7 @@ module foot() { No arguments are used, but parameters provide the PCB and foot dimensions. */ module Feet(top=0) { - translate([BackEdgeMargin + Thick + PanelThick + PanelThickGap, LeftEdgeMargin + Thick, Thick]) { + translate([BackEdgeMargin + Thick + PanelThick + PanelThickGap*2, LeftEdgeMargin + Thick, Thick]) { if (!top) { %PCB(); } @@ -684,7 +684,7 @@ module BottomShell() { arguments but uses the global parameters. */ module Panel() { - Filet = (Filet > Thick*2) ? Filet - Thick - PanelVerticalGap/2 : Filet - PanelVerticalGap/2; + Filet = (Filet > Thick*2) ? Filet - Thick - PanelVerticalGap : Filet - PanelVerticalGap; echo("Panel:", Thick=PanelThick, PanelWidth=PanelWidth, PanelHeight=PanelHeight, Filet=Filet); translate([Filet, Filet, 0]) { offset(r=Filet, $fn=Resolution) { @@ -809,9 +809,9 @@ module CText(OnOff, Tx, Ty, Font, Size, TxtRadius, Angl, Turn, Content) { text for your box. */ module FPanL() { - translate([Length - (Thick + PanelThickGap/2 + PanelThick), - Thick + PanelHorizontalGap/2, - Thick + PanelVerticalGap/2]) { + translate([Length - (Thick + PanelThickGap + PanelThick), + Thick + PanelHorizontalGap, + Thick + PanelVerticalGap]) { rotate([90, 0, 90]) { color(Couleur2) { linear_extrude(height=PanelThick) { @@ -840,9 +840,9 @@ module FPanL() { text for your box. */ module BPanL() { - translate([Thick + PanelThickGap/2 + PanelThick, - Thick + PanelHorizontalGap/2 + PanelWidth, - Thick + PanelVerticalGap/2]) { + translate([Thick + PanelThickGap + PanelThick, + Thick + PanelHorizontalGap + PanelWidth, + Thick + PanelVerticalGap]) { rotate([90, 0, 270]) { color(Couleur2) { linear_extrude(height=PanelThick) { From cc8d5278842c454d4055588a8c9af2fcfc11b13a Mon Sep 17 00:00:00 2001 From: Joel Ebel Date: Sat, 21 Jul 2018 22:08:20 -0400 Subject: [PATCH 3/5] Taper the screwless feet for easier fitting Make the screwless foot tips slightly conical. This makes it easier to fit the box halves together as it helps to alight the top and bottom feet. --- files/Ultimate_Box.scad | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/files/Ultimate_Box.scad b/files/Ultimate_Box.scad index 0c17d93..07654d3 100644 --- a/files/Ultimate_Box.scad +++ b/files/Ultimate_Box.scad @@ -589,12 +589,24 @@ module foot() { } if (Screwless && !top) { // Remove around peg translate([FootHole/2 - PartMargin, FootHeight]) { - square([FootDia/2, PCBThick*3]); + polygon([[0, 0], + [FootDia/2, 0], + [FootDia/2, PCBThick*3], + [-FootHole/3, PCBThick*3], + [0, PCBThick] + ] + ); } } if (Screwless && top) { // Remove hole for peg translate([-FootHole/2, TopMargin - PCBThick, 0]) { - square([(FootHole + CutoutMargin), PCBThick*2]); + polygon([[0, 0], + [(FootHole*5/6 + CutoutMargin), 0], + [(FootHole + CutoutMargin), PCBThick], + [(FootHole + CutoutMargin), PCBThick*2], + [0, PCBThick*2], + ] + ); } } From 81ccd4568598d58fe50ea26ecff061f7f69ab801 Mon Sep 17 00:00:00 2001 From: Joel Ebel Date: Fri, 27 Jul 2018 00:28:36 -0400 Subject: [PATCH 4/5] Adjust filet on square holes by CutoutMargin If you have a cutout margin, the filet on square holes must be adjusted by that amount if you want to achieve the desired filet. --- files/Ultimate_Box.scad | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/files/Ultimate_Box.scad b/files/Ultimate_Box.scad index 07654d3..1a6bbcd 100644 --- a/files/Ultimate_Box.scad +++ b/files/Ultimate_Box.scad @@ -741,11 +741,12 @@ module CylinderHole(OnOff, Cx, Cy, Cdia) { */ module SquareHole(OnOff, Sx, Sy, Sl, Sw, Filet) { if (OnOff) { + Offset = Filet + CutoutMargin; echo("SquareHole:", Sx=Sx - CutoutMargin, Sy=Sy - CutoutMargin, - Sl=Sl + CutoutMargin*2, Sw=Sw + CutoutMargin*2, Filet=Filet); - translate([Sx + Filet - CutoutMargin, Sy + Filet - CutoutMargin, 0]) { - offset(r=Filet, $fn=Resolution) { - square([Sl + CutoutMargin*2 - Filet*2, Sw + CutoutMargin*2 - Filet*2]); + Sl=Sl + CutoutMargin*2, Sw=Sw + CutoutMargin*2, Filet=Offset); + translate([Sx + Filet, Sy + Filet, 0]) { + offset(r=Offset, $fn=Resolution) { + square([Sl - Filet*2, Sw - Filet*2]); } } } From 9b22604d3e898465df1904e1d2ecab876c38bf94 Mon Sep 17 00:00:00 2001 From: Joel Ebel Date: Thu, 11 Apr 2019 13:21:35 -0400 Subject: [PATCH 5/5] Add missing parameters to fix warnings --- files/Ultimate_Box.scad | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/Ultimate_Box.scad b/files/Ultimate_Box.scad index 1a6bbcd..33dc7fd 100644 --- a/files/Ultimate_Box.scad +++ b/files/Ultimate_Box.scad @@ -565,7 +565,7 @@ module PCB() { Produces a single foot for PCB mounting. */ -module foot() { +module foot(top=0) { color(Couleur1) { rotate_extrude($fn=100) { difference() { @@ -682,7 +682,7 @@ module BottomShell() { Coque(); Tabs(); if (PCBFeet) { - Feet(); + Feet(top=0); } } Holes();