Calculate dimensions from PCB and margins
Add parameters for PCB size and margins on all sides. Generate the box dimensions from these sizes. Place the PCB appropriately based on the margins. This has a change in definition, as the previous PCB size was the size of the square made by the mounting holes. Now it is the size of the actual PCB. Holes are still mounted 5mm inside the edges. Hole positioning will come soon.
This commit is contained in:
parent
f5c3339696
commit
e429ccf09a
@ -26,18 +26,10 @@
|
|||||||
////////// - Paramètres de la boite - Box parameters - /////////////
|
////////// - Paramètres de la boite - Box parameters - /////////////
|
||||||
|
|
||||||
|
|
||||||
/* [Box dimensions] */
|
|
||||||
// - Longueur - Length
|
|
||||||
Length = 160;
|
|
||||||
// - Largeur - Width
|
|
||||||
Width = 170;
|
|
||||||
// - Hauteur - Height
|
|
||||||
Height = 100;
|
|
||||||
// - Epaisseur - Wall thickness
|
|
||||||
Thick = 2; //[2:5]
|
|
||||||
|
|
||||||
|
|
||||||
/* [Box options] */
|
/* [Box options] */
|
||||||
|
// - Epaisseur - Wall thickness
|
||||||
|
Thick = 2; //[2:5]
|
||||||
// - Diamètre Coin arrondi - Filet diameter
|
// - Diamètre Coin arrondi - Filet diameter
|
||||||
Filet = 2; //[0.1:12]
|
Filet = 2; //[0.1:12]
|
||||||
// - lissage de l'arrondi - Filet smoothness
|
// - lissage de l'arrondi - Filet smoothness
|
||||||
@ -51,17 +43,26 @@ Vent = 1; // [0:No, 1:Yes]
|
|||||||
// - Decoration-Holes width (in mm)
|
// - Decoration-Holes width (in mm)
|
||||||
Vent_width = 1.5;
|
Vent_width = 1.5;
|
||||||
|
|
||||||
|
/* [PCB options] */
|
||||||
|
// - Longueur PCB - PCB Length
|
||||||
|
PCBLength = 80;
|
||||||
|
// - Largeur PCB - PCB Width
|
||||||
|
PCBWidth = 60;
|
||||||
|
// You likely need to maintain |Thick| margin on the left and right for tabs
|
||||||
|
// and whatnot.
|
||||||
|
// - Margin between front panel and PCB
|
||||||
|
FrontEdgeMargin = 60;
|
||||||
|
// - Margin between back panel and PCB
|
||||||
|
BackEdgeMargin = 10;
|
||||||
|
// - Margin between left wall and PCB
|
||||||
|
LeftEdgeMargin = 11;
|
||||||
|
// - Margin between right wall and PCB
|
||||||
|
RightEdgeMargin = 95;
|
||||||
|
// - Margin between top of PCB foot and box top.
|
||||||
|
TopMargin = 86;
|
||||||
|
|
||||||
/* [PCB_Feet] */
|
/* [PCB_Feet] */
|
||||||
//All dimensions are from the center foot axis
|
//All dimensions are from the center foot axis
|
||||||
// - Coin bas gauche - Low left corner X position
|
|
||||||
PCBPosX = 7;
|
|
||||||
// - Coin bas gauche - Low left corner Y position
|
|
||||||
PCBPosY = 6;
|
|
||||||
// - Longueur PCB - PCB Length
|
|
||||||
PCBLength = 70;
|
|
||||||
// - Largeur PCB - PCB Width
|
|
||||||
PCBWidth = 50;
|
|
||||||
// - Heuteur pied - Feet height
|
// - Heuteur pied - Feet height
|
||||||
FootHeight = 10;
|
FootHeight = 10;
|
||||||
// - Diamètre pied - Foot diameter
|
// - Diamètre pied - Foot diameter
|
||||||
@ -94,6 +95,12 @@ Dec_Thick = Vent ? Thick*2 : Thick;
|
|||||||
Dec_size = Vent ? Thick*2 : 0.8;
|
Dec_size = Vent ? Thick*2 : 0.8;
|
||||||
|
|
||||||
|
|
||||||
|
// Calculate box dimensions from PCB.
|
||||||
|
Length = PCBLength + FrontEdgeMargin + BackEdgeMargin + ((Thick*2 + m)*2);
|
||||||
|
Width = PCBWidth + LeftEdgeMargin + RightEdgeMargin + Thick*2;
|
||||||
|
Height = FootHeight + TopMargin + Thick*2;
|
||||||
|
echo("Box: ", Length=Length, Width=Width, Height=Height);
|
||||||
|
|
||||||
// Calculate panel dimensions from box dimensions.
|
// Calculate panel dimensions from box dimensions.
|
||||||
PanelWidth = Width - (Thick*2) - m;
|
PanelWidth = Width - (Thick*2) - m;
|
||||||
PanelHeight = Height - (Thick*2) - m;
|
PanelHeight = Height - (Thick*2) - m;
|
||||||
@ -274,30 +281,31 @@ module foot(FootDia, FootHole, FootHeight) {
|
|||||||
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() {
|
module Feet() {
|
||||||
//////////////////// - PCB only visible in the preview mode - /////////////////////
|
translate([BackEdgeMargin + Thick*2 + m, LeftEdgeMargin + Thick, 0]) {
|
||||||
translate([(3*Thick + 2), Thick + 5, (FootHeight + Thick/2 - 0.5)]) {
|
//////////////////// - PCB only visible in the preview mode - /////////////////////
|
||||||
%square([PCBLength + 10, PCBWidth + 10]);
|
translate([0, 0, (FootHeight + Thick/2 - 0.5)]) {
|
||||||
translate([PCBLength/2, PCBWidth/2, 0.5]) {
|
%square([PCBLength, PCBWidth]);
|
||||||
color("Olive") {
|
translate([PCBLength/2, PCBWidth/2, 0.5]) {
|
||||||
%text("PCB", halign="center", valign="center", font="Arial black");
|
color("Olive") {
|
||||||
|
%text("PCB", halign="center", valign="center", font="Arial black");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} // Fin PCB
|
||||||
|
|
||||||
|
////////////////////////////// - 4 Feet - //////////////////////////////////////////
|
||||||
|
translate([5, 5, Thick/2]) {
|
||||||
|
foot(FootDia, FootHole, FootHeight);
|
||||||
}
|
}
|
||||||
} // Fin PCB
|
translate([(PCBLength - 5), 5, Thick/2]) {
|
||||||
|
foot(FootDia, FootHole, FootHeight);
|
||||||
////////////////////////////// - 4 Feet - //////////////////////////////////////////
|
}
|
||||||
translate([3*Thick + 7, Thick + 10, Thick/2]) {
|
translate([PCBLength - 5, PCBWidth - 5, Thick/2]) {
|
||||||
foot(FootDia, FootHole, FootHeight);
|
foot(FootDia, FootHole, FootHeight);
|
||||||
}
|
}
|
||||||
translate([(3*Thick + PCBLength + 7), Thick + 10, Thick/2]) {
|
translate([5, PCBWidth - 5, Thick/2]) {
|
||||||
foot(FootDia, FootHole, FootHeight);
|
foot(FootDia, FootHole, FootHeight);
|
||||||
}
|
}
|
||||||
translate([3*Thick + PCBLength + 7, Thick + PCBWidth + 10, Thick/2]) {
|
} // End main translate
|
||||||
foot(FootDia, FootHole, FootHeight);
|
|
||||||
}
|
|
||||||
translate([3*Thick + 7, Thick + PCBWidth + 10, Thick/2]) {
|
|
||||||
foot(FootDia, FootHole, FootHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // Fin du module Feet
|
} // Fin du module Feet
|
||||||
|
|
||||||
|
|
||||||
@ -533,10 +541,7 @@ if (BShell == 1) {
|
|||||||
|
|
||||||
// Pied support PCB - PCB feet
|
// Pied support PCB - PCB feet
|
||||||
if (PCBFeet == 1) {
|
if (PCBFeet == 1) {
|
||||||
// Feet
|
Feet();
|
||||||
translate([PCBPosX, PCBPosY, 0]) {
|
|
||||||
Feet();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Panneau avant - Front panel
|
// Panneau avant - Front panel
|
||||||
|
Loading…
Reference in New Issue
Block a user