From a1f9d20ebb0a3b89f2027c2cd9622d74594a0f6c Mon Sep 17 00:00:00 2001 From: Matt Date: Wed, 15 Jul 2015 15:41:01 -0400 Subject: [PATCH] Make variables readable in 2in_core Makes the script more readable, spells out purpose of variables. --- models/2in_core/2in_core.scad | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/models/2in_core/2in_core.scad b/models/2in_core/2in_core.scad index 9cbb115..2a00c85 100644 --- a/models/2in_core/2in_core.scad +++ b/models/2in_core/2in_core.scad @@ -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);