From c4cc362d79108fe624f285c2ceeeb87bd6df23b6 Mon Sep 17 00:00:00 2001 From: Joel Ebel Date: Tue, 22 May 2018 23:56:59 -0400 Subject: [PATCH] Put top shell and bottom shell in separate modules Make the Coque module generic, adding specific changes to a separate TopShell and BottomShell module. The color() function is moved to Coque to prevent coloring the PCB model. I left the legs and holes in the separate modules to prepare for more customization of them for top and bottom. --- files/U_Box_V104_Test_Cleaned.scad | 99 +++++++++++++++++++----------- 1 file changed, 64 insertions(+), 35 deletions(-) diff --git a/files/U_Box_V104_Test_Cleaned.scad b/files/U_Box_V104_Test_Cleaned.scad index 40c9fe7..beef7f2 100644 --- a/files/U_Box_V104_Test_Cleaned.scad +++ b/files/U_Box_V104_Test_Cleaned.scad @@ -251,6 +251,22 @@ module Decorations() { } +/* Coque: Shell module + + This module takes no arguments, but produces a box shell. This is half the box, + including slots for end panels, rounded corners according to Filet and Resolution, + and vents/decorations according to parameters. +*/ +module Coque() { //Coque - Shell + color(Couleur1) { + difference() { + MainBox(); + Decorations(); + } + } +} + + /* leg: leg module Produces a single box fixation leg with screw hole. @@ -286,11 +302,13 @@ module leg() { This module produces the wall fixation box legs. */ module Legs() { - translate([MountInset, 0, 0]) { - leg(); - } - translate([Length - MountInset, 0, 0]) { - leg(); + color(Couleur1) { + translate([MountInset, 0, 0]) { + leg(); + } + translate([Length - MountInset, 0, 0]) { + leg(); + } } } @@ -317,26 +335,6 @@ module Holes() { } -/* Coque: Shell module - - This module takes no arguments, but produces a box shell. This is half the box, - including slots for end panels, rounded corners according to Filet and Resolution, - wall fixation legs and holes, and vents/decorations according to parameters. -*/ -module Coque() { //Coque - Shell - color(Couleur1) { - difference() { - union() { - MainBox(); - Legs(); - } - Decorations(); - Holes(); - } - } -} - - /* foot module Produces a single foot for PCB mounting. @@ -398,6 +396,45 @@ module Feet() { } // Fin du module Feet +/* TopShell: top shell module + + Produces the top shell, including requested fixation legs and holes + Model is rotated and translated to the appropriate position. +*/ +module TopShell() { + translate([0, Width, Height + 0.2]) { + rotate([180, 0, 0]) { + difference() { + union() { + Coque(); + Legs(); + } + Holes(); + } + } + } +} + + +/* BottomShell: bottom shell module + + Produces the bottom shell, including requested fixation legs, holes, + and PCB feet. +*/ +module BottomShell() { + difference() { + union() { + Coque(); + Legs(); + if (PCBFeet == 1) { + Feet(); + } + } + Holes(); + } +} + + //////////////////////////////////////////////////////////////////////// ////////////////////// <- Holes Panel Manager -> /////////////////////// //////////////////////////////////////////////////////////////////////// @@ -599,20 +636,12 @@ module BPanL() { if (TShell == 1) { // Coque haut - Top Shell - translate([0, Width, Height + 0.2]) { - rotate([180, 0, 0]) { - Coque(); - } - } + TopShell(); } if (BShell == 1) { // Coque bas - Bottom shell - Coque(); - // Pied support PCB - PCB feet - if (PCBFeet == 1) { - Feet(); - } + BottomShell(); } // Panneau avant - Front panel