From 0b34bf6834f9bbf2aeffac6e9004ea539a9488fd Mon Sep 17 00:00:00 2001 From: Rock Storm Date: Thu, 18 Oct 2018 18:55:32 +0100 Subject: [PATCH] regular_shapes: Simplify hexagon modules - Alleviate the hexagon_prism module by letting 'hexagon' do the selection between the inputs. - Aggregate input selection to avoid overwriting other inputs. --- regular_shapes.scad | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/regular_shapes.scad b/regular_shapes.scad index f744022..63b8481 100644 --- a/regular_shapes.scad +++ b/regular_shapes.scad @@ -43,9 +43,7 @@ module pentagon(radius) module hexagon(radius, diameter, across_flats) { - r = radius; - r = diameter ? diameter/2 : radius; - r = across_flats ? across_flats/2/cos(30) : radius; + r = across_flats ? across_flats/2/cos(30) : diameter ? diameter/2 : radius; reg_polygon(6,r); } @@ -159,9 +157,8 @@ module pentagon_tube(height,radius,wall) module hexagon_prism(height, radius, across_flats) { - r = radius; - r = across_flats ? across_flats/2/cos(30) : radius; - linear_extrude(height=height) hexagon(r); + linear_extrude(height=height) + hexagon(radius=radius, across_flats=across_flats); } module hexagon_tube(height,radius,wall)