Renamed some variables.

This commit is contained in:
Shy 2023-12-19 15:20:12 +01:00
parent eb00a2b5f8
commit 054edef194
3 changed files with 51 additions and 51 deletions

View file

@ -62,10 +62,10 @@
support = false;
// Abgerundete Kanten (aufwendig).
rounded_corners = true;
rounded_edges = true;
// Dicke der Decke.
thickness = 1;
top = 1;
// Höhe des Innenraumes.
space = 8;
@ -77,7 +77,7 @@ border_height = 4;
struts = 2;
// Dicke der Aufhängungen an der Vorderkante.
loop_thickness = 3.5;
loop_strength = 3.5;
// Durchmesser der Bohrungen.
drill = 3.4;
@ -143,7 +143,7 @@ if ((space - border_height) < limit_usb) {
if ($preview) {
// Zeige den Platz, den der USB-Port braucht.
color(color_warning)
translate([40, 92.35, space + thickness - limit_usb])
translate([40, 92.35, space + top - limit_usb])
cube([9, 8, limit_usb]);
} else {
assert((space - border_height) >= limit_usb,
@ -155,7 +155,7 @@ if (nrf_module && (space < limit_nrf)) {
if ($preview) {
// Zeige den Platz, den das nRF24-Modul braucht.
color(color_warning)
translate([101.25, 81.75, thickness])
translate([101.25, 81.75, top])
cube([29.5, 15.75, limit_nrf]);
} else {
assert(space >= limit_nrf,
@ -213,24 +213,24 @@ module led_reflector() {
// Schaft für die Schrauben.
module screw_shaft() {
translate([0, 0, thickness])
translate([0, 0, top])
cylinder(h = space, r = drill_shaft/2, $fn=32);
// Verdickung, um die Versenkung zu kompensieren.
if(nut_sink > 0 && !threaded_insert) {
translate([0, 0, thickness])
translate([0, 0, top])
cylinder(h = nut_sink, r = (nut_size + drill_shaft - drill)/2, $fn=32);
intersection() {
translate([0, 0, thickness + nut_sink])
translate([0, 0, top + nut_sink])
cylinder((nut_size + drill_shaft - drill)/2, (nut_size + drill_shaft - drill)/2, 0, $fn=32);
// Begrenzt die Höhe.
cylinder(r = (nut_size + drill_shaft - drill)/2, h = thickness + space, $fn=32);
cylinder(r = (nut_size + drill_shaft - drill)/2, h = top + space, $fn=32);
}
}
}
// Bohrung für die Schrauben.
module screw_drill() {
cylinder(h=space + thickness, r=drill/2, $fn=24);
cylinder(h=space + top, r=drill/2, $fn=24);
// Versenkung für die Mutter.
if(nut_sink > 0 && !threaded_insert) {
cylinder(h=nut_sink, r=nut_size/2, $fn=6);
@ -381,12 +381,12 @@ module border_cutouts() {
module outer() {
// Decke.
color(color_top)
linear_extrude(height=thickness) {
linear_extrude(height=top) {
import("./svg/back top.svg");
}
// Rand.
translate([0, 0, thickness]) {
translate([0, 0, top]) {
// Schneide Aussparungen aus dem Rand.
difference() {
union() {
@ -410,7 +410,7 @@ module outer() {
// Verstrebungen.
color(color_struts)
translate([0, 0, thickness]) {
translate([0, 0, top]) {
linear_extrude(height=struts) {
import("./svg/back struts.svg");
}
@ -419,7 +419,7 @@ module outer() {
// Aufhängungen.
color(color_special)
translate([0, 0, 0]) {
linear_extrude(height=max(loop_thickness, thickness)) {
linear_extrude(height=max(loop_strength, top)) {
import("./svg/back loops.svg");
}
}
@ -431,7 +431,7 @@ module outer() {
*************************************************************************/
module body_back() {
if (rounded_corners) {
if (rounded_edges) {
intersection() {
union () {
outer();
@ -446,7 +446,7 @@ module body_back() {
$fn = $preview ? 4 : 16;
for (i = [1:5]) {
translate([0, 0, i - 1])
cylinder(r=sin(i * (90/5)) * 2, h=thickness + space);
cylinder(r=sin(i * (90/5)) * 2, h=top + space);
}
}
}
@ -458,14 +458,14 @@ module body_back() {
// Stützen für die Buttons.
if (button_support) {
color(color_struts)
translate([0, 0, thickness]) {
translate([0, 0, top]) {
linear_extrude(height=struts) {
import("./svg/back pillars struts.svg");
}
}
color(color_special)
translate([0, 0, thickness]) {
translate([0, 0, top]) {
linear_extrude(height=space) {
import("./svg/back pillars.svg");
}
@ -475,21 +475,21 @@ module body_back() {
// Stützen für die Analog sticks.
if (stick_support) {
color(color_struts)
translate([0, 0, thickness]) {
translate([0, 0, top]) {
linear_extrude(height=struts) {
import("./svg/back sticks struts.svg");
}
}
color(color_special)
translate([0, 0, thickness]) {
translate([0, 0, top]) {
linear_extrude(height=space - 2) {
import("./svg/back sticks pillars.svg");
}
}
color(color_special)
translate([0, 0, thickness + space - 2]) {
translate([0, 0, top + space - 2]) {
linear_extrude(height=2) {
import("./svg/back sticks pillars top.svg");
}
@ -506,9 +506,9 @@ module body_back() {
// LED-Reflektoren.
color(color_special)
if (led_reflectors) {
translate([9, 84, thickness])
translate([9, 84, top])
led_reflector();
translate([141, 84, thickness])
translate([141, 84, top])
mirror([1, 0, 0])
led_reflector();
}
@ -519,7 +519,7 @@ difference() {
body_back();
union() {
// Bei einem Gewindeeinsatz wird die Decke nicht durchbohrt.
floor = threaded_insert ? thickness : 0;
floor = threaded_insert ? top : 0;
for (i = [0:3]) {
translate([drill_pos[i][0], drill_pos[i][1], floor])
screw_drill();

View file

@ -49,10 +49,10 @@ button_trigger_clearance = 0.25;
button_trigger_rail = space - 4.4 - button_trigger_clearance;
// Gesamthöhe der Systembuttons.
system_height = space - button_system_size - button_clearance + thickness + protrusion;
system_height = space - button_system_size - button_clearance + top + protrusion;
// Gesamthöhe der Aktionsbuttons.
action_height = space - button_action_size - button_clearance + thickness + protrusion;
action_height = space - button_action_size - button_clearance + top + protrusion;
/**************************************************************************

View file

@ -47,10 +47,10 @@ include <colors.scad>;
*/
// Abgerundete Kanten (aufwendig).
rounded_corners = true;
rounded_edges = true;
// Dicke der Decke.
thickness = 1.0;
top = 1.0;
// Höhe des Innenraumes.
space = 7;
@ -122,32 +122,32 @@ analog_sticks = true;
module top_cutouts() {
// LEDs am unteren Rand.
if (led_bottom) {
linear_extrude(height=thickness) {
linear_extrude(height=top) {
import("./svg/front led bottom.svg");
}
}
// LED-Pegel.
if (led_gauge) {
linear_extrude(height=thickness) {
linear_extrude(height=top) {
import("./svg/front led gauge.svg");
}
}
// Y-LED.
if (led_y) {
linear_extrude(height=thickness) {
linear_extrude(height=top) {
import("./svg/front led y.svg");
}
}
// Power LED.
if (led_logo) {
linear_extrude(height=thickness) {
linear_extrude(height=top) {
import("./svg/front led power logo.svg");
}
} else {
linear_extrude(height=thickness) {
linear_extrude(height=top) {
import("./svg/front led power.svg");
}
}
@ -155,19 +155,19 @@ module top_cutouts() {
// Schaft für die Schrauben.
module screw_shaft() {
translate([0, 0, thickness])
translate([0, 0, top])
cylinder(h = space, r = drill_shaft/2, $fn=32);
}
// Platzsparendere Stützen für die Bohrungen am oberen Rand.
module screw_support(width, length) {
translate([0, 0, thickness + (space / 2)])
translate([0, 0, top + (space / 2)])
cube([width, length, space], center=true);
}
// Bohrung für die Schrauben.
module screw_drill() {
cylinder(h=space + thickness, r=drill/2, $fn=24);
cylinder(h=space + top, r=drill/2, $fn=24);
}
// Maske für Stellen, an denen der Rand nicht ganz auf der Platine aufliegen
@ -186,13 +186,13 @@ module border_pcb_cutouts() {
module outer() {
// Decke.
color(color_top)
linear_extrude(height=thickness) {
linear_extrude(height=top) {
import("./svg/front top.svg");
}
// Oberer Rand.
color(color_border1)
translate([0, 0, thickness]) {
translate([0, 0, top]) {
linear_extrude(height = border_height) {
import("./svg/front borders.svg");
}
@ -200,7 +200,7 @@ module outer() {
// Unterer Rand.
color(color_border2)
translate([0, 0, thickness + border_height]) {
translate([0, 0, top + border_height]) {
difference() {
linear_extrude(height=space - border_height) {
import("./svg/front borders lower.svg");
@ -214,7 +214,7 @@ module outer() {
// Verstrebungen.
color(color_struts)
translate([0, 0, thickness]) {
translate([0, 0, top]) {
linear_extrude(height=struts) {
import("./svg/front struts.svg");
}
@ -251,7 +251,7 @@ module border_strut(width, length, height) {
module casing_front() {
difference() {
if (rounded_corners) {
if (rounded_edges) {
intersection() {
union () {
outer();
@ -266,7 +266,7 @@ module casing_front() {
$fn = $preview ? 4 : 16;
for (i = [1:5]) {
translate([0, 0, i - 1])
cylinder(r=sin(i * (90/5)) * 2, h=thickness + space);
cylinder(r=sin(i * (90/5)) * 2, h=top + space);
}
}
}
@ -279,7 +279,7 @@ module casing_front() {
// Vergrößere das zu substrahierende Objekt, um Darstellungsfehler
// in der Voransicht zu vermeiden.
translate([0, 0, -0.1])
resize([0, 0, thickness + 0.2])
resize([0, 0, top + 0.2])
top_cutouts();
} else {
top_cutouts();
@ -287,7 +287,7 @@ module casing_front() {
}
// Zusätzliche Verstrebungen zwischen Decke und Rand.
if (rounded_corners) {
if (rounded_edges) {
color(color_struts)
for (pos = [
// [x, y, rotation, länge]
@ -318,7 +318,7 @@ module casing_front() {
[2.5, 66, 90, 3],
[2.5, 84, 90, 3],
]) {
translate([pos[0], pos[1], thickness])
translate([pos[0], pos[1], top])
rotate([0, 0, pos[2]])
border_strut(1.6, pos[3], pos[3]);
}
@ -327,7 +327,7 @@ module casing_front() {
// Halterungen für die Aktionsbuttons.
// Begrenzung nach oben.
color(color_buttons)
translate([0, 0, thickness]) {
translate([0, 0, top]) {
linear_extrude(height = space - button_action_size - button_action_base - button_clearance) {
import("./svg/front button action upper.svg");
}
@ -335,7 +335,7 @@ module casing_front() {
// Führung für die Aktionsbuttons.
color(color_buttons)
translate([0, 0, thickness]) {
translate([0, 0, top]) {
// Wir ziehen die Führungen zwei Millimeter tiefer, um auf der sicheren
// Seite zu sein.
linear_extrude(height = space - button_action_size + 2) {
@ -346,7 +346,7 @@ module casing_front() {
// Halterungen für die Systembuttons.
// Begrenzung nach oben.
color(color_buttons)
translate([0, 0, thickness]) {
translate([0, 0, top]) {
linear_extrude(height = space - button_system_size - button_system_base - button_clearance) {
import("./svg/front button system upper.svg");
}
@ -354,7 +354,7 @@ module casing_front() {
// Führung für die Systembuttons.
color(color_buttons)
translate([0, 0, thickness]) {
translate([0, 0, top]) {
linear_extrude(height = space - button_system_size) {
import("./svg/front button system lower.svg");
}
@ -386,7 +386,7 @@ module casing_front() {
// Schacht für den Lichtsensor.
color(color_struts)
translate([0, 0, thickness]) {
translate([0, 0, top]) {
linear_extrude(height = space) {
import("./svg/front well.svg");
}
@ -395,7 +395,7 @@ module casing_front() {
// Verstärkungen für die Analog-Sticks.
if (analog_sticks) {
color(color_struts)
translate([0, 0, thickness]) {
translate([0, 0, top]) {
linear_extrude(height = struts) {
import("./svg/front analog sticks struts.svg");
}