Moved edge modification code into separate file.
This commit is contained in:
parent
830fef7f9c
commit
a71fbce611
3 changed files with 55 additions and 63 deletions
35
back.scad
35
back.scad
|
@ -7,6 +7,7 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
include <colors.scad>;
|
include <colors.scad>;
|
||||||
|
include <edge.scad>;
|
||||||
|
|
||||||
/* Höhe wichtiger Bauteile:
|
/* Höhe wichtiger Bauteile:
|
||||||
*
|
*
|
||||||
|
@ -73,10 +74,10 @@ button_support = true;
|
||||||
// Strukturen zur Stützung der Analog Sticks.
|
// Strukturen zur Stützung der Analog Sticks.
|
||||||
stick_support = true;
|
stick_support = true;
|
||||||
|
|
||||||
// Öffnung für den I²C-Anschluss.
|
// Öffnung über dem I²C-Anschluss.
|
||||||
i2c_port = true;
|
i2c_port = true;
|
||||||
|
|
||||||
// Wird ein Gewindeeinsatz verwendet?
|
// Gewindeeinsatz statt Mutter.
|
||||||
threaded_insert = false;
|
threaded_insert = false;
|
||||||
|
|
||||||
// Dicke der Decke.
|
// Dicke der Decke.
|
||||||
|
@ -435,29 +436,6 @@ module outer() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Maske, um abgerundete oder abgeschrägte Außenkanten zu schneiden.
|
|
||||||
module edge_cut() {
|
|
||||||
minkowski() {
|
|
||||||
linear_extrude(height=0.1) {
|
|
||||||
import("./svg/back outline.svg");
|
|
||||||
}
|
|
||||||
|
|
||||||
$fn = $preview ? 4 : 16;
|
|
||||||
if (beveled_edges) {
|
|
||||||
// Abgeschrägte Kanten.
|
|
||||||
cylinder(h=4, r1=1.5, r2=0);
|
|
||||||
} else {
|
|
||||||
// Abgerundete Kanten.
|
|
||||||
// Dafür generieren wir im folgenden einen konkaven Kegel.
|
|
||||||
curve = [1.34, 1.07, 0.84, 0.63, 0.46, 0.32, 0.2, 0.11, 0.05, 0.01, 0];
|
|
||||||
for (i = [0:len(curve)-2]) {
|
|
||||||
translate([0, 0, i*0.5])
|
|
||||||
cylinder(h=0.5, r1=curve[i], r2=curve[i+1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* Die Hülle. *
|
* Die Hülle. *
|
||||||
|
@ -465,14 +443,9 @@ module edge_cut() {
|
||||||
|
|
||||||
module body_back() {
|
module body_back() {
|
||||||
if (rounded_edges || beveled_edges) {
|
if (rounded_edges || beveled_edges) {
|
||||||
difference() {
|
edge_modifier(beveled_edges, "./svg/back outline.svg") {
|
||||||
union () {
|
|
||||||
outer();
|
outer();
|
||||||
}
|
}
|
||||||
|
|
||||||
translate([0, 0, -0.1])
|
|
||||||
edge_cut();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
outer();
|
outer();
|
||||||
}
|
}
|
||||||
|
|
46
edge.scad
Normal file
46
edge.scad
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
/*************************************************************************
|
||||||
|
* Hülle für die u23-Spielekonsole. *
|
||||||
|
* Funktionen zur Modifikation der Außenkanten. *
|
||||||
|
* *
|
||||||
|
* Author: Shy *
|
||||||
|
* License: CC0 *
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
// Objekt, um abgerundete oder abgeschrägte Außenkanten zu "schneiden".
|
||||||
|
module edge_cutter(beveled, outline) {
|
||||||
|
minkowski() {
|
||||||
|
linear_extrude(height=0.1) {
|
||||||
|
import(outline);
|
||||||
|
}
|
||||||
|
|
||||||
|
$fn = $preview ? 4 : 16;
|
||||||
|
if (beveled) {
|
||||||
|
// Abgeschrägte Kanten.
|
||||||
|
cylinder(h=4, r1=1.5, r2=0);
|
||||||
|
} else {
|
||||||
|
// Abgerundete Kanten. Dafür generieren wir einen konkaven Kegel.
|
||||||
|
// Kurve der Kegelseite.
|
||||||
|
curve = $preview
|
||||||
|
? [1.34, 0.84, 0.46, 0.2, 0.05, 0]
|
||||||
|
: [1.34, 1.07, 0.84, 0.63, 0.46, 0.32, 0.2, 0.11, 0.05, 0.01, 0];
|
||||||
|
// Vertikale Auflösung.
|
||||||
|
v_step = $preview ? 1 : 0.5;
|
||||||
|
|
||||||
|
for (i = [0:len(curve)-2]) {
|
||||||
|
translate([0, 0, i*v_step])
|
||||||
|
cylinder(h=v_step, r1=curve[i], r2=curve[i+1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Erzeugt abgerundete oder abgeschrägte Außenkanten.
|
||||||
|
module edge_modifier(beveled, outline) {
|
||||||
|
difference() {
|
||||||
|
children();
|
||||||
|
|
||||||
|
translate([0, 0, -0.1])
|
||||||
|
edge_cutter(beveled_edges, outline);
|
||||||
|
}
|
||||||
|
}
|
31
front.scad
31
front.scad
|
@ -7,6 +7,7 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
include <colors.scad>;
|
include <colors.scad>;
|
||||||
|
include <edge.scad>;
|
||||||
|
|
||||||
/* Höhe wichtiger Bauteile:
|
/* Höhe wichtiger Bauteile:
|
||||||
*
|
*
|
||||||
|
@ -326,29 +327,6 @@ module outer() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Maske, um abgerundete oder abgeschrägte Außenkanten zu schneiden.
|
|
||||||
module edge_cut() {
|
|
||||||
minkowski() {
|
|
||||||
linear_extrude(height=0.1) {
|
|
||||||
import("./svg/front outline.svg");
|
|
||||||
}
|
|
||||||
|
|
||||||
$fn = $preview ? 4 : 16;
|
|
||||||
if (beveled_edges) {
|
|
||||||
// Abgeschrägte Kanten.
|
|
||||||
cylinder(h=4, r1=1.5, r2=0);
|
|
||||||
} else {
|
|
||||||
// Abgerundete Kanten.
|
|
||||||
// Dafür generieren wir im folgenden einen konkaven Kegel.
|
|
||||||
curve = [1.34, 1.07, 0.84, 0.63, 0.46, 0.32, 0.2, 0.11, 0.05, 0.01, 0];
|
|
||||||
for (i = [0:len(curve)-2]) {
|
|
||||||
translate([0, 0, i*0.5])
|
|
||||||
cylinder(h=0.5, r1=curve[i], r2=curve[i+1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* Die Hülle. *
|
* Die Hülle. *
|
||||||
|
@ -357,14 +335,9 @@ module edge_cut() {
|
||||||
module casing_front() {
|
module casing_front() {
|
||||||
difference() {
|
difference() {
|
||||||
if (rounded_edges || beveled_edges) {
|
if (rounded_edges || beveled_edges) {
|
||||||
difference() {
|
edge_modifier(beveled_edges, "./svg/front outline.svg"){
|
||||||
union () {
|
|
||||||
outer();
|
outer();
|
||||||
}
|
}
|
||||||
|
|
||||||
translate([0, 0, -0.1])
|
|
||||||
edge_cut();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
outer();
|
outer();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue