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
Produces a single box fixation leg with screw hole.
@ -286,6 +302,7 @@ module leg() {
This module produces the wall fixation box legs.
*/
module Legs() {
color(Couleur1) {
translate([MountInset, 0, 0]) {
leg();
}
@ -293,6 +310,7 @@ module Legs() {
leg();
}
}
}
/* Holes: holes module
@ -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