Simplify Decorations module
split a single decoration into its own module, and give it a most generic translation. This makes the Decorations module cleaner and easier to understand, because you can easily see exactly how much you are translating each decoration. Rather than translating the decoration to make it fit the other side of the box, rotate it. It makes the translation cleaner, and it's a little easier to understand. The decorations are the same on each side, just rotated 180 degrees from one another. I might still make all the left side decorations and rotate that 180 degrees for the right side.
This commit is contained in:
parent
3754009a43
commit
9ddb6d7516
@ -129,6 +129,8 @@ TextColor = "White";
|
||||
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 + PanelGap + Dec_Spacing - Vent_width/2;
|
||||
|
||||
// Resolution based on Round parameter
|
||||
Resolution = Round ? 100: 4;
|
||||
@ -207,26 +209,35 @@ module MainBox() {
|
||||
}
|
||||
|
||||
|
||||
/* Decoration: a single box decoration
|
||||
*/
|
||||
module decoration() {
|
||||
translate([-Vent_width/2, -Thick, -Thick]) {
|
||||
cube([Vent_width, Dec_Thick + Thick, Height/4 + Thick]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Decorations: decorations module
|
||||
|
||||
This module produces the box vents or decorations.
|
||||
*/
|
||||
module Decorations() {
|
||||
union() {
|
||||
// X offset to center of first vent
|
||||
DecOffset = Thick*2 + PanelThick + PanelGap + Dec_Spacing - Vent_width/2;
|
||||
for (i=[0 : Dec_Spacing : Length/4]) {
|
||||
translate([DecOffset + i - Vent_width/2, -1, -1]) {
|
||||
cube([Vent_width, Dec_Thick + 1, Height/4 + 1]);
|
||||
translate([Dec_Offset + i, 0, 0]) {
|
||||
decoration();
|
||||
}
|
||||
translate([Length - DecOffset - i - Vent_width/2, -1, -1]) {
|
||||
cube([Vent_width, Dec_Thick + 1, Height/4 + 1]);
|
||||
translate([Length - Dec_Offset - i, 0, 0]) {
|
||||
decoration();
|
||||
}
|
||||
translate([Length - DecOffset - i - Vent_width/2, Width - Dec_Thick, -1]) {
|
||||
cube([Vent_width, Dec_Thick + 1, Height/4 + 1]);
|
||||
translate([Length - Dec_Offset - i, Width, 0]) {
|
||||
rotate([0, 0, 180]) {
|
||||
decoration();
|
||||
}
|
||||
translate([DecOffset + i - Vent_width/2, Width - Dec_Thick, -1]) {
|
||||
cube([Vent_width, Dec_Thick + 1, Height/4 + 1]);
|
||||
}
|
||||
translate([Dec_Offset + i, Width, 0]) {
|
||||
rotate([0, 0, 180]) {
|
||||
decoration();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user