Form panel and cutouts in 2D then extrude
Panel and Holes are all in 2D. Leave the LinearExtrude to the PanL modules just before adding text. Perform all translating in the PanL modules, rather than the top level code.
This commit is contained in:
parent
0a8234aafa
commit
ffb35824ec
@ -408,13 +408,9 @@ module Feet() {
|
|||||||
*/
|
*/
|
||||||
module Panel() {
|
module Panel() {
|
||||||
echo("Panel:", Thick=PanelThick, PanelWidth=PanelWidth, PanelHeight=PanelHeight);
|
echo("Panel:", Thick=PanelThick, PanelWidth=PanelWidth, PanelHeight=PanelHeight);
|
||||||
rotate([90, 0, 90]) {
|
translate([Filet, Filet, 0]) {
|
||||||
linear_extrude(height=PanelThick) {
|
offset(r=Filet, $fn=Resolution) {
|
||||||
translate([Filet, Filet, 0]) {
|
square([PanelWidth - Filet*2, PanelHeight - Filet*2]);
|
||||||
offset(r=Filet, $fn=Resolution) {
|
|
||||||
square([PanelWidth - Filet*2, PanelHeight - Filet*2]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -433,8 +429,8 @@ module Panel() {
|
|||||||
module CylinderHole(OnOff, Cx, Cy, Cdia) {
|
module CylinderHole(OnOff, Cx, Cy, Cdia) {
|
||||||
if (OnOff == 1) {
|
if (OnOff == 1) {
|
||||||
echo("CylinderHole:", Cx=Cx, Cy=Cy, Cdia=Cdia + CutoutMargin);
|
echo("CylinderHole:", Cx=Cx, Cy=Cy, Cdia=Cdia + CutoutMargin);
|
||||||
translate([Cx, Cy, -PanelThick/2]) {
|
translate([Cx, Cy, 0]) {
|
||||||
cylinder(PanelThick*2, d=Cdia + CutoutMargin, $fn=100);
|
circle(d=Cdia + CutoutMargin, $fn=100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -456,11 +452,9 @@ module SquareHole(OnOff, Sx, Sy, Sl, Sw, Filet) {
|
|||||||
if (OnOff == 1) {
|
if (OnOff == 1) {
|
||||||
echo("SquareHole:", Sx=Sx - CutoutMargin/2, Sy=Sy - CutoutMargin/2,
|
echo("SquareHole:", Sx=Sx - CutoutMargin/2, Sy=Sy - CutoutMargin/2,
|
||||||
Sl=Sl + CutoutMargin, Sw=Sw + CutoutMargin, Filet=Filet);
|
Sl=Sl + CutoutMargin, Sw=Sw + CutoutMargin, Filet=Filet);
|
||||||
translate([Sx + Filet - CutoutMargin/2, Sy + Filet - CutoutMargin/2, -PanelThick/2]) {
|
translate([Sx + Filet - CutoutMargin/2, Sy + Filet - CutoutMargin/2, 0]) {
|
||||||
linear_extrude(height=PanelThick*2) {
|
offset(r=Filet, $fn=Resolution) {
|
||||||
offset(r=Filet, $fn=Resolution) {
|
square([Sl + CutoutMargin - Filet*2, Sw + CutoutMargin - Filet*2]);
|
||||||
square([Sl + CutoutMargin - Filet*2, Sw + CutoutMargin - Filet*2]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -534,42 +528,41 @@ module CText(OnOff, Tx, Ty, Font, Size, TxtRadius, Angl, Turn, Content) {
|
|||||||
edited to produce holes and text for your box.
|
edited to produce holes and text for your box.
|
||||||
*/
|
*/
|
||||||
module FPanL() {
|
module FPanL() {
|
||||||
difference() {
|
translate([Length - (Thick + PanelGap/2 + PanelThick),
|
||||||
color(Couleur2) {
|
Thick + PanelGap/2,
|
||||||
Panel();
|
Thick + PanelGap/2]) {
|
||||||
}
|
|
||||||
rotate([90, 0, 90]) {
|
rotate([90, 0, 90]) {
|
||||||
color(Couleur2) {
|
color(Couleur2) {
|
||||||
// <- Cutting shapes from here ->
|
linear_extrude(height=PanelThick) {
|
||||||
//(On/Off, Xpos,Ypos,Length,Width,Filet)
|
difference() {
|
||||||
SquareHole(1, 20, 20, 15, 10, 1);
|
Panel();
|
||||||
SquareHole(1, 40, 20, 15, 10, 1);
|
// Add panel hole modules here.
|
||||||
SquareHole(1, 60, 20, 15, 10, 1);
|
// SquareHole(On/Off, Xpos,Ypos,Length,Width,Filet)
|
||||||
//(On/Off, Xpos, Ypos, Diameter)
|
SquareHole(1, 20, 20, 15, 10, 1);
|
||||||
CylinderHole(1, 27, 40, 8);
|
SquareHole(1, 40, 20, 15, 10, 1);
|
||||||
CylinderHole(1, 47, 40, 8);
|
SquareHole(1, 60, 20, 15, 10, 1);
|
||||||
CylinderHole(1, 67, 40, 8);
|
// CylinderHole(On/Off, Xpos, Ypos, Diameter)
|
||||||
SquareHole(1, 20, 50, 80, 30, 3);
|
CylinderHole(1, 27, 40, 8);
|
||||||
CylinderHole(1, 93, 30, 10);
|
CylinderHole(1, 47, 40, 8);
|
||||||
SquareHole(1, 120, 20, 30, 60, 3);
|
CylinderHole(1, 67, 40, 8);
|
||||||
// <- To here ->
|
SquareHole(1, 20, 50, 80, 30, 3);
|
||||||
|
CylinderHole(1, 93, 30, 10);
|
||||||
|
SquareHole(1, 120, 20, 30, 60, 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
color(TextColor) {
|
||||||
|
// Add text modules here.
|
||||||
|
// LText(On/Off, Xpos, Ypos, "Font", Size, "Text", "HAlign", "VAlign")
|
||||||
|
LText(1, 20, 83, "Arial Black", 4, "Digital Screen", HAlign="left");
|
||||||
|
LText(1, 120, 83, "Arial Black", 4, "Level", HAlign="left");
|
||||||
|
LText(1, 20, 11, "Arial Black", 6, " 1 2 3", HAlign="left");
|
||||||
|
// CText(On/Off, Xpos, Ypos, "Font", Size, Diameter, Arc(Deg), Starting Angle(Deg),"Text")
|
||||||
|
CText(1, 93, 29, "Arial Black", 4, 10, 180, 0, ["1", "." , "3", "." , "5", "." , "7", "." , "9", "." , "11"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
color(TextColor) {
|
|
||||||
rotate([90, 0, 90]) {
|
|
||||||
// <- Adding text from here ->
|
|
||||||
//(On/Off, Xpos, Ypos, "Font", Size, "Text", "HAlign", "VAlign")
|
|
||||||
LText(1, 20, 83, "Arial Black", 4, "Digital Screen", HAlign="left");
|
|
||||||
LText(1, 120, 83, "Arial Black", 4, "Level", HAlign="left");
|
|
||||||
LText(1, 20, 11, "Arial Black", 6, " 1 2 3", HAlign="left");
|
|
||||||
//(On/Off, Xpos, Ypos, "Font", Size, Diameter, Arc(Deg), Starting Angle(Deg),"Text")
|
|
||||||
CText(1, 93, 29, "Arial Black", 4, 10, 180, 0, ["1", "." , "3", "." , "5", "." , "7", "." , "9", "." , "11"]);
|
|
||||||
// <- To here ->
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // End FPanL
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////// <- New module Panel -> //////////////////////
|
////////////////////// <- New module Panel -> //////////////////////
|
||||||
@ -579,31 +572,24 @@ module FPanL() {
|
|||||||
edited to produce holes and text for your box.
|
edited to produce holes and text for your box.
|
||||||
*/
|
*/
|
||||||
module BPanL() {
|
module BPanL() {
|
||||||
translate([PanelThick, PanelWidth, 0]) {
|
translate([Thick + PanelGap/2 + PanelThick,
|
||||||
rotate([0, 0, 180]) {
|
Thick + PanelGap/2 + PanelWidth,
|
||||||
difference() {
|
Thick + PanelGap/2]) {
|
||||||
color(Couleur2) {
|
rotate([90, 0, 270]) {
|
||||||
Panel();
|
color(Couleur2) {
|
||||||
}
|
linear_extrude(height=PanelThick) {
|
||||||
rotate([90, 0, 90]) {
|
difference() {
|
||||||
color(Couleur2) {
|
Panel();
|
||||||
// <- Cutting shapes from here ->
|
// Add panel hole modules here.
|
||||||
|
|
||||||
// <- To here ->
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
color(TextColor) {
|
color(TextColor) {
|
||||||
rotate([90, 0, 90]) {
|
// Add text modules here.
|
||||||
// <- Adding text from here ->
|
|
||||||
|
|
||||||
// <- To here ->
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} // End 180 degree rotate
|
}
|
||||||
}
|
}
|
||||||
} // End BPanL
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////// <- Main part -> /////////////////////////
|
/////////////////////////// <- Main part -> /////////////////////////
|
||||||
@ -632,14 +618,10 @@ if (BShell == 1) {
|
|||||||
|
|
||||||
// Panneau avant - Front panel
|
// Panneau avant - Front panel
|
||||||
if (FPanL == 1) {
|
if (FPanL == 1) {
|
||||||
translate([Length - (Thick + PanelThick + PanelGap/2), Thick + PanelGap/2, Thick + PanelGap/2]) {
|
FPanL();
|
||||||
FPanL();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Panneau arrière - Back panel
|
//Panneau arrière - Back panel
|
||||||
if (BPanL == 1) {
|
if (BPanL == 1) {
|
||||||
translate([Thick + PanelGap/2, Thick + PanelGap/2, Thick + PanelGap/2]) {
|
BPanL();
|
||||||
BPanL();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user