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.
This commit is contained in:
Joel Ebel 2018-05-22 23:56:59 -04:00
parent ec4ccde941
commit c4cc362d79

View File

@ -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 /* leg: leg module
Produces a single box fixation leg with screw hole. Produces a single box fixation leg with screw hole.
@ -286,11 +302,13 @@ module leg() {
This module produces the wall fixation box legs. This module produces the wall fixation box legs.
*/ */
module Legs() { module Legs() {
translate([MountInset, 0, 0]) { color(Couleur1) {
leg(); translate([MountInset, 0, 0]) {
} leg();
translate([Length - 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 /* foot module
Produces a single foot for PCB mounting. Produces a single foot for PCB mounting.
@ -398,6 +396,45 @@ module Feet() {
} // Fin du 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 -> /////////////////////// ////////////////////// <- Holes Panel Manager -> ///////////////////////
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
@ -599,20 +636,12 @@ module BPanL() {
if (TShell == 1) { if (TShell == 1) {
// Coque haut - Top Shell // Coque haut - Top Shell
translate([0, Width, Height + 0.2]) { TopShell();
rotate([180, 0, 0]) {
Coque();
}
}
} }
if (BShell == 1) { if (BShell == 1) {
// Coque bas - Bottom shell // Coque bas - Bottom shell
Coque(); BottomShell();
// Pied support PCB - PCB feet
if (PCBFeet == 1) {
Feet();
}
} }
// Panneau avant - Front panel // Panneau avant - Front panel