1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-31 18:22:08 +02:00

use box_extrude to refactor

This commit is contained in:
Justin Lin
2019-10-02 09:04:08 +08:00
parent 19185c677a
commit 5fcd2c473e

View File

@@ -1,4 +1,4 @@
include <hollow_out.scad>; include <box_extrude.scad>;
/* [Basic] */ /* [Basic] */
@@ -15,36 +15,27 @@ twist = 180;
slices = 200; slices = 200;
module twist_bottle(model, height, thickness, twist, spacing, convexity, slices) { module twist_bottle(model, height, thickness, twist, spacing, slices) {
$fn = 48; $fn = 48;
module outer_container() { module bottle() {
translate([0, 0, thickness]) box_extrude(height = height + thickness, shell_thickness = thickness, twist = twist, slices = slices)
linear_extrude(height = height, twist = twist, slices = slices)
hollow_out(thickness) children();
linear_extrude(thickness)
children(); children();
} }
module inner_container() { module inner_container() {
linear_extrude(height = height, twist = twist, slices = slices) bottle()
hollow_out(thickness)
offset(r = -thickness - spacing) offset(r = -thickness - spacing)
children(); children();
translate([0, 0, height])
rotate(twist)
linear_extrude(thickness) linear_extrude(thickness)
children(); children();
} }
if(model == "Outer") { if(model == "Outer") {
outer_container() bottle()
children(); children();
} else if(model == "Inner") { } else if(model == "Inner") {
translate([0, 0, height + thickness])
rotate([180, 0, 0])
inner_container() inner_container()
children(); children();
} }
@@ -77,7 +68,8 @@ module heart(radius, center = false) {
} }
if(shape == "Flower") { 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]) { for(i = [0:3]) {
rotate(90 * i) rotate(90 * i)
translate([radius * 0.5, 0, 0]) translate([radius * 0.5, 0, 0])