From 5fcd2c473eb7a6c1ea8a54c6c969b7b4b970bab2 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Wed, 2 Oct 2019 09:04:08 +0800 Subject: [PATCH] use box_extrude to refactor --- examples/twist_bottle.scad | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/examples/twist_bottle.scad b/examples/twist_bottle.scad index 48fadf78..bc4c40bf 100644 --- a/examples/twist_bottle.scad +++ b/examples/twist_bottle.scad @@ -1,4 +1,4 @@ -include ; +include ; /* [Basic] */ @@ -15,38 +15,29 @@ twist = 180; slices = 200; -module twist_bottle(model, height, thickness, twist, spacing, convexity, slices) { +module twist_bottle(model, height, thickness, twist, spacing, slices) { $fn = 48; - module outer_container() { - translate([0, 0, thickness]) - linear_extrude(height = height, twist = twist, slices = slices) - hollow_out(thickness) children(); - - linear_extrude(thickness) - children(); + module bottle() { + box_extrude(height = height + thickness, shell_thickness = thickness, twist = twist, slices = slices) + children(); } module inner_container() { - linear_extrude(height = height, twist = twist, slices = slices) - hollow_out(thickness) - offset(r = -thickness - spacing) - children(); - - translate([0, 0, height]) - rotate(twist) + bottle() + offset(r = -thickness - spacing) + children(); + linear_extrude(thickness) - children(); + children(); } if(model == "Outer") { - outer_container() + bottle() children(); } else if(model == "Inner") { - translate([0, 0, height + thickness]) - rotate([180, 0, 0]) inner_container() - children(); + children(); } } @@ -77,7 +68,8 @@ module heart(radius, center = false) { } if(shape == "Flower") { - twist_bottle(model, height, thickness, twist, spacing, slices) union() { + twist_bottle(model, height, thickness, twist, spacing, slices) + union() { for(i = [0:3]) { rotate(90 * i) translate([radius * 0.5, 0, 0])