Make variables readable in 2in_core

Makes the script more readable, spells out purpose of variables.
This commit is contained in:
Matt 2015-07-15 15:41:01 -04:00
parent 01af3a4a3e
commit a1f9d20ebb
1 changed files with 15 additions and 15 deletions

View File

@ -1,8 +1,8 @@
module core (oW, decoy = false) {
module core (outerWidth) {
coreH = 16;
iW = 15.3;
oW = oW / 2;
$fn = 100;
innerWidth = 15.3;
outerWidth = outerWidth / 2;
$fn = 100;
module cyl (R) {
cylinder(r = R, h = coreH, center = true);
@ -19,12 +19,12 @@ module core (oW, decoy = false) {
module inner_core () {
difference () {
inner_core_shape(iW, iW + .5, 6, 7);
inner_core_shape(iW - 2, iW - .5, 4, 4);
inner_core_shape(innerWidth, innerWidth + .5, 6, 7);
inner_core_shape(innerWidth - 2, innerWidth - .5, 4, 4);
}
}
module clip () {
translate([oW - 2, 0, 0]) {
translate([outerWidth - 2, 0, 0]) {
rotate(45, [0, 0, 1]){
cube([6, 1, coreH], center = true);
}
@ -32,7 +32,7 @@ module core (oW, decoy = false) {
}
module outer_clip () {
translate([oW - 2, 0, 0]) {
translate([outerWidth - 2, 0, 0]) {
difference() {
rotate(45, [0, 0, 1]){
cube([8, 4, coreH], center = true);
@ -48,8 +48,8 @@ module core (oW, decoy = false) {
difference () {
union () {
difference () {
cyl(oW);
cyl(oW - 2);
cyl(outerWidth);
cyl(outerWidth - 2);
}
outer_clip();
}
@ -61,12 +61,12 @@ module core (oW, decoy = false) {
for (i = [0 : x]) {
rotate ([0, 0, i * 360 / (x + 1)]) {
if (i == 0) {
translate ([iW + ((oW - iW) / 2) - 1, 0, 0]) {
cube([oW - iW - 5.7, 2, coreH] ,center = true);
translate ([innerWidth + ((outerWidth - innerWidth) / 2) - 1, 0, 0]) {
cube([outerWidth - innerWidth - 5.7, 2, coreH] ,center = true);
}
} else {
translate ([iW + ((oW - iW) / 2) - 1, 0, 0]) {
cube([oW - iW - 1, 2, coreH] ,center = true);
translate ([innerWidth + ((outerWidth - innerWidth) / 2) - 1, 0, 0]) {
cube([outerWidth - innerWidth - 1, 2, coreH] ,center = true);
}
}
}
@ -80,4 +80,4 @@ module core (oW, decoy = false) {
}
}
core(50, true);
core(50);