Files
DoorWhat/3d/deckel.scad
2025-07-20 11:38:24 +02:00

56 lines
1.6 KiB
OpenSCAD
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Parameter
deckel_laenge = 100;
deckel_breite = 68;
deckel_hoehe = 5;
eckradius = 5;
wandstaerke = 2;
loch_rect_x = 50;
loch_rect_y = 25;
loch_rund_d = 20;
abstand_rund_von_rect = 20; // Abstand mittig unter dem Rechteck
schraubloch_d = 3.5; // Durchmesser für Schrauben (z.B. M3)
schraub_abstand_von_rand = 3; // Abstand vom Rand zur Lochmitte
$fn = 60; // Feinheit für Rundungen
// Hauptkörper mit abgerundeten Ecken
difference() {
// Abgerundeter Deckel
rounded_box(deckel_laenge, deckel_breite, deckel_hoehe, eckradius);
// Rechteckiges Loch oben (zentriert)
translate([
(deckel_laenge - loch_rect_x)/2,
(deckel_breite - loch_rect_y)/2 + 10,
-1
])
cube([loch_rect_x, loch_rect_y, deckel_hoehe + 2]);
// Rundes Loch unter dem Rechteck (zentriert darunter)
translate([
deckel_laenge / 2,
(deckel_breite / 2) - abstand_rund_von_rect,
-1
])
cylinder(h = deckel_hoehe + 2, d = loch_rund_d);
// Schraublöcher korrekt an den vier Ecken platzieren
offset = eckradius - 0.01; // Minkowski erweitert die Ecken nach außen
for (x = [schraub_abstand_von_rand, deckel_laenge - offset - schraub_abstand_von_rand])
for (y = [ schraub_abstand_von_rand, deckel_breite - offset - schraub_abstand_von_rand])
translate([x, y, -1])
cylinder(h = deckel_hoehe + 2, d = schraubloch_d);
}
// Funktion: Rechteck mit abgerundeten Ecken
module rounded_box(l, b, h, r) {
minkowski() {
cube([l - 2*r, b - 2*r, h]);
cylinder(r=r, h=0.01);
}
}