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