Optimizations and bug-fixes in edge modification.
This commit is contained in:
parent
0966e4eb00
commit
acdb35acaa
2 changed files with 91 additions and 82 deletions
87
back.scad
87
back.scad
|
@ -445,47 +445,6 @@ module outer() {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* Die Hülle. *
|
||||
*************************************************************************/
|
||||
|
||||
module body_back() {
|
||||
if (rounded_edges || beveled_edges) {
|
||||
difference() {
|
||||
union () {
|
||||
outer();
|
||||
}
|
||||
|
||||
color(color_top)
|
||||
translate([0, 0, -0.1])
|
||||
minkowski() {
|
||||
linear_extrude(height=0.1) {
|
||||
import("./svg/back outline.svg");
|
||||
}
|
||||
|
||||
$fn = $preview ? 4 : 8;
|
||||
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.
|
||||
union() {
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
outer();
|
||||
}
|
||||
|
||||
// Stützen für die Analog sticks.
|
||||
if (stick_support) {
|
||||
|
@ -511,6 +470,52 @@ module body_back() {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Maske, um angerundete oder abgeschrägte Außenkanten zu schneiden.
|
||||
module edge_cut() {
|
||||
minkowski() {
|
||||
linear_extrude(height=0.1) {
|
||||
import("./svg/back outline.svg");
|
||||
}
|
||||
|
||||
$fn = $preview ? 4 : 8;
|
||||
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.
|
||||
union() {
|
||||
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. *
|
||||
*************************************************************************/
|
||||
|
||||
module body_back() {
|
||||
if (rounded_edges || beveled_edges) {
|
||||
difference() {
|
||||
union () {
|
||||
outer();
|
||||
}
|
||||
|
||||
translate([0, 0, -0.1])
|
||||
edge_cut();
|
||||
}
|
||||
} else {
|
||||
outer();
|
||||
}
|
||||
|
||||
// Schäfte für die Bohrungen.
|
||||
color(color_drills)
|
||||
for (i = [0:3]) {
|
||||
|
|
78
front.scad
78
front.scad
|
@ -200,6 +200,28 @@ module border_pcb_cutouts() {
|
|||
cube([4, 1, 1.5]);
|
||||
}
|
||||
|
||||
// Kleine Streben zwischen Decke und Rand.
|
||||
module border_strut(width, length, height) {
|
||||
x = width/2;
|
||||
y = length/2;
|
||||
|
||||
polyhedron(points = [
|
||||
[-x, -y, 0],
|
||||
[x, -y, 0],
|
||||
[x, y, 0],
|
||||
[-x, y, 0],
|
||||
[-x, y, height],
|
||||
[x, y, height]
|
||||
], faces = [
|
||||
[0, 1, 2, 3],
|
||||
[1, 5, 2],
|
||||
[2, 5, 4, 3],
|
||||
[3, 4, 0],
|
||||
[0, 4, 5, 1]
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
// Die äußeren Teile: Front und Ränder.
|
||||
module outer() {
|
||||
// Decke.
|
||||
|
@ -306,43 +328,8 @@ module outer() {
|
|||
|
||||
}
|
||||
|
||||
// Kleine Streben zwischen Decke und Rand.
|
||||
module border_strut(width, length, height) {
|
||||
x = width/2;
|
||||
y = length/2;
|
||||
|
||||
polyhedron(points = [
|
||||
[-x, -y, 0],
|
||||
[x, -y, 0],
|
||||
[x, y, 0],
|
||||
[-x, y, 0],
|
||||
[-x, y, height],
|
||||
[x, y, height]
|
||||
], faces = [
|
||||
[0, 1, 2, 3],
|
||||
[1, 5, 2],
|
||||
[2, 5, 4, 3],
|
||||
[3, 4, 0],
|
||||
[0, 4, 5, 1]
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* Die Hülle. *
|
||||
*************************************************************************/
|
||||
|
||||
module casing_front() {
|
||||
difference() {
|
||||
if (rounded_edges || beveled_edges) {
|
||||
difference() {
|
||||
union () {
|
||||
outer();
|
||||
}
|
||||
|
||||
color(color_top)
|
||||
translate([0, 0, -0.1])
|
||||
// Maske, um angerundete oder abgeschrägte Außenkanten zu schneiden.
|
||||
module edge_cut() {
|
||||
minkowski() {
|
||||
linear_extrude(height=0.1) {
|
||||
import("./svg/front outline.svg");
|
||||
|
@ -364,6 +351,23 @@ module casing_front() {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* Die Hülle. *
|
||||
*************************************************************************/
|
||||
|
||||
module casing_front() {
|
||||
difference() {
|
||||
if (rounded_edges || beveled_edges) {
|
||||
difference() {
|
||||
union () {
|
||||
outer();
|
||||
}
|
||||
|
||||
translate([0, 0, -0.1])
|
||||
edge_cut();
|
||||
}
|
||||
} else {
|
||||
outer();
|
||||
|
|
Loading…
Reference in a new issue