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,16 +408,12 @@ module Feet() {
|
||||
*/
|
||||
module Panel() {
|
||||
echo("Panel:", Thick=PanelThick, PanelWidth=PanelWidth, PanelHeight=PanelHeight);
|
||||
rotate([90, 0, 90]) {
|
||||
linear_extrude(height=PanelThick) {
|
||||
translate([Filet, Filet, 0]) {
|
||||
offset(r=Filet, $fn=Resolution) {
|
||||
square([PanelWidth - Filet*2, PanelHeight - Filet*2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Cylinder Hole module
|
||||
@ -433,8 +429,8 @@ module Panel() {
|
||||
module CylinderHole(OnOff, Cx, Cy, Cdia) {
|
||||
if (OnOff == 1) {
|
||||
echo("CylinderHole:", Cx=Cx, Cy=Cy, Cdia=Cdia + CutoutMargin);
|
||||
translate([Cx, Cy, -PanelThick/2]) {
|
||||
cylinder(PanelThick*2, d=Cdia + CutoutMargin, $fn=100);
|
||||
translate([Cx, Cy, 0]) {
|
||||
circle(d=Cdia + CutoutMargin, $fn=100);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -456,15 +452,13 @@ module SquareHole(OnOff, Sx, Sy, Sl, Sw, Filet) {
|
||||
if (OnOff == 1) {
|
||||
echo("SquareHole:", Sx=Sx - CutoutMargin/2, Sy=Sy - CutoutMargin/2,
|
||||
Sl=Sl + CutoutMargin, Sw=Sw + CutoutMargin, Filet=Filet);
|
||||
translate([Sx + Filet - CutoutMargin/2, Sy + Filet - CutoutMargin/2, -PanelThick/2]) {
|
||||
linear_extrude(height=PanelThick*2) {
|
||||
translate([Sx + Filet - CutoutMargin/2, Sy + Filet - CutoutMargin/2, 0]) {
|
||||
offset(r=Filet, $fn=Resolution) {
|
||||
square([Sl + CutoutMargin - Filet*2, Sw + CutoutMargin - Filet*2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* LText module
|
||||
@ -534,42 +528,41 @@ module CText(OnOff, Tx, Ty, Font, Size, TxtRadius, Angl, Turn, Content) {
|
||||
edited to produce holes and text for your box.
|
||||
*/
|
||||
module FPanL() {
|
||||
difference() {
|
||||
color(Couleur2) {
|
||||
Panel();
|
||||
}
|
||||
translate([Length - (Thick + PanelGap/2 + PanelThick),
|
||||
Thick + PanelGap/2,
|
||||
Thick + PanelGap/2]) {
|
||||
rotate([90, 0, 90]) {
|
||||
color(Couleur2) {
|
||||
// <- Cutting shapes from here ->
|
||||
//(On/Off, Xpos,Ypos,Length,Width,Filet)
|
||||
linear_extrude(height=PanelThick) {
|
||||
difference() {
|
||||
Panel();
|
||||
// Add panel hole modules here.
|
||||
// SquareHole(On/Off, Xpos,Ypos,Length,Width,Filet)
|
||||
SquareHole(1, 20, 20, 15, 10, 1);
|
||||
SquareHole(1, 40, 20, 15, 10, 1);
|
||||
SquareHole(1, 60, 20, 15, 10, 1);
|
||||
//(On/Off, Xpos, Ypos, Diameter)
|
||||
// CylinderHole(On/Off, Xpos, Ypos, Diameter)
|
||||
CylinderHole(1, 27, 40, 8);
|
||||
CylinderHole(1, 47, 40, 8);
|
||||
CylinderHole(1, 67, 40, 8);
|
||||
SquareHole(1, 20, 50, 80, 30, 3);
|
||||
CylinderHole(1, 93, 30, 10);
|
||||
SquareHole(1, 120, 20, 30, 60, 3);
|
||||
// <- To here ->
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
color(TextColor) {
|
||||
rotate([90, 0, 90]) {
|
||||
// <- Adding text from here ->
|
||||
//(On/Off, Xpos, Ypos, "Font", Size, "Text", "HAlign", "VAlign")
|
||||
// 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");
|
||||
//(On/Off, Xpos, Ypos, "Font", Size, Diameter, Arc(Deg), Starting Angle(Deg),"Text")
|
||||
// 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"]);
|
||||
// <- To here ->
|
||||
}
|
||||
}
|
||||
} // End FPanL
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////// <- New module Panel -> //////////////////////
|
||||
@ -579,31 +572,24 @@ module FPanL() {
|
||||
edited to produce holes and text for your box.
|
||||
*/
|
||||
module BPanL() {
|
||||
translate([PanelThick, PanelWidth, 0]) {
|
||||
rotate([0, 0, 180]) {
|
||||
translate([Thick + PanelGap/2 + PanelThick,
|
||||
Thick + PanelGap/2 + PanelWidth,
|
||||
Thick + PanelGap/2]) {
|
||||
rotate([90, 0, 270]) {
|
||||
color(Couleur2) {
|
||||
linear_extrude(height=PanelThick) {
|
||||
difference() {
|
||||
color(Couleur2) {
|
||||
Panel();
|
||||
}
|
||||
rotate([90, 0, 90]) {
|
||||
color(Couleur2) {
|
||||
// <- Cutting shapes from here ->
|
||||
|
||||
// <- To here ->
|
||||
// Add panel hole modules here.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
color(TextColor) {
|
||||
rotate([90, 0, 90]) {
|
||||
// <- Adding text from here ->
|
||||
|
||||
// <- To here ->
|
||||
// Add text modules here.
|
||||
}
|
||||
}
|
||||
}
|
||||
} // End 180 degree rotate
|
||||
}
|
||||
} // End BPanL
|
||||
|
||||
|
||||
/////////////////////////// <- Main part -> /////////////////////////
|
||||
@ -632,14 +618,10 @@ if (BShell == 1) {
|
||||
|
||||
// Panneau avant - Front panel
|
||||
if (FPanL == 1) {
|
||||
translate([Length - (Thick + PanelThick + PanelGap/2), Thick + PanelGap/2, Thick + PanelGap/2]) {
|
||||
FPanL();
|
||||
}
|
||||
}
|
||||
|
||||
//Panneau arrière - Back panel
|
||||
if (BPanL == 1) {
|
||||
translate([Thick + PanelGap/2, Thick + PanelGap/2, Thick + PanelGap/2]) {
|
||||
BPanL();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user