57.2s
· 1451/2615t · $0.0280
diff vs bare: +16/-7
$fn = 128;
outer_diameter = 80;
inner_diameter = 70;
mug_height = 90;
bottom_thickness = 6;
outer_radius = outer_diameter / 2;
inner_radius = inner_diameter / 2;
handle_opening_height = 30;
handle_opening_width = 25;
handle_wall = 7;
handle_depth = 16;
handle_center_z = mug_height / 2;
+
handle_opening_left_x = outer_radius + 5;
handle_attach_overlap = 2.5;
eps = 0.2;
module mug_body() {
difference() {
cylinder(h = mug_height, r = outer_radius);
translate([0, 0, bottom_thickness])
cylinder(h = mug_height - bottom_thickness + eps, r = inner_radius);
}
}
- module d_shape(x0, z0, h, w, segments = 72) {
+ module d_shape_2d(x0, z0, h, w, segments = 72) {
+ r = h / 2;
+ straight_len = max(w - r, 0);
+
polygon(
points = concat(
- [[x0, z0 - h / 2]],
[
- for (i = [1 : segments - 1])
+ [x0, z0 - r],
+ [x0 + straight_len, z0 - r]
+ ],
+ [
+ for (i = [1 : segments])
let (a = -90 + 180 * i / segments)
- [x0 + w * cos(a), z0 + (h / 2) * sin(a)]
+ [x0 + straight_len + r * cos(a), z0 + r * sin(a)]
],
- [[x0, z0 + h / 2]]
+ [
+ [x0, z0 + r]
+ ]
)
);
}
module handle_profile() {
difference() {
offset(r = handle_wall)
- d_shape(
+ d_shape_2d(
handle_opening_left_x,
handle_center_z,
handle_opening_height,
handle_opening_width
);
- d_shape(
+ d_shape_2d(
handle_opening_left_x,
handle_center_z,
handle_opening_height,
handle_opening_width
);
}
}
module handle() {
union() {
rotate([90, 0, 0])
linear_extrude(height = handle_depth, center = true, convexity = 10)
handle_profile();
translate([
outer_radius - handle_attach_overlap,
-handle_depth / 2,
handle_center_z - handle_opening_height / 2 - handle_wall
])
cube([
handle_opening_left_x - (outer_radius - handle_attach_overlap),
handle_depth,
handle_opening_height + 2 * handle_wall
]);
}
}
render(convexity = 10)
union() {
mug_body();
handle();
}
SCAD (95 lines)
$fn = 128;
outer_diameter = 80;
inner_diameter = 70;
mug_height = 90;
bottom_thickness = 6;
outer_radius = outer_diameter / 2;
inner_radius = inner_diameter / 2;
handle_opening_height = 30;
handle_opening_width = 25;
handle_wall = 7;
handle_depth = 16;
handle_center_z = mug_height / 2;
handle_opening_left_x = outer_radius + 5;
handle_attach_overlap = 2.5;
eps = 0.2;
module mug_body() {
difference() {
cylinder(h = mug_height, r = outer_radius);
translate([0, 0, bottom_thickness])
cylinder(h = mug_height - bottom_thickness + eps, r = inner_radius);
}
}
module d_shape_2d(x0, z0, h, w, segments = 72) {
r = h / 2;
straight_len = max(w - r, 0);
polygon(
points = concat(
[
[x0, z0 - r],
[x0 + straight_len, z0 - r]
],
[
for (i = [1 : segments])
let (a = -90 + 180 * i / segments)
[x0 + straight_len + r * cos(a), z0 + r * sin(a)]
],
[
[x0, z0 + r]
]
)
);
}
module handle_profile() {
difference() {
offset(r = handle_wall)
d_shape_2d(
handle_opening_left_x,
handle_center_z,
handle_opening_height,
handle_opening_width
);
d_shape_2d(
handle_opening_left_x,
handle_center_z,
handle_opening_height,
handle_opening_width
);
}
}
module handle() {
union() {
rotate([90, 0, 0])
linear_extrude(height = handle_depth, center = true, convexity = 10)
handle_profile();
translate([
outer_radius - handle_attach_overlap,
-handle_depth / 2,
handle_center_z - handle_opening_height / 2 - handle_wall
])
cube([
handle_opening_left_x - (outer_radius - handle_attach_overlap),
handle_depth,
handle_opening_height + 2 * handle_wall
]);
}
}
render(convexity = 10)
union() {
mug_body();
handle();
}
65.3s
· 1490/2864t · $0.0305
diff vs i1: +0/-0
$fn = 128;
outer_diameter = 80;
inner_diameter = 70;
mug_height = 90;
bottom_thickness = 6;
outer_radius = outer_diameter / 2;
inner_radius = inner_diameter / 2;
handle_opening_height = 30;
handle_opening_width = 25;
handle_wall = 7;
handle_depth = 16;
handle_center_z = mug_height / 2;
handle_opening_left_x = outer_radius + 5;
handle_attach_overlap = 2.5;
eps = 0.2;
module mug_body() {
difference() {
cylinder(h = mug_height, r = outer_radius);
translate([0, 0, bottom_thickness])
cylinder(h = mug_height - bottom_thickness + eps, r = inner_radius);
}
}
module d_shape_2d(x0, z0, h, w, segments = 72) {
r = h / 2;
straight_len = max(w - r, 0);
polygon(
points = concat(
[
[x0, z0 - r],
[x0 + straight_len, z0 - r]
],
[
for (i = [1 : segments])
let (a = -90 + 180 * i / segments)
[x0 + straight_len + r * cos(a), z0 + r * sin(a)]
],
[
[x0, z0 + r]
]
)
);
}
module handle_profile() {
difference() {
offset(r = handle_wall)
d_shape_2d(
handle_opening_left_x,
handle_center_z,
handle_opening_height,
handle_opening_width
);
d_shape_2d(
handle_opening_left_x,
handle_center_z,
handle_opening_height,
handle_opening_width
);
}
}
module handle() {
union() {
rotate([90, 0, 0])
linear_extrude(height = handle_depth, center = true, convexity = 10)
handle_profile();
translate([
outer_radius - handle_attach_overlap,
-handle_depth / 2,
handle_center_z - handle_opening_height / 2 - handle_wall
])
cube([
handle_opening_left_x - (outer_radius - handle_attach_overlap),
handle_depth,
handle_opening_height + 2 * handle_wall
]);
}
}
render(convexity = 10)
union() {
mug_body();
handle();
}
SCAD (95 lines)
$fn = 128;
outer_diameter = 80;
inner_diameter = 70;
mug_height = 90;
bottom_thickness = 6;
outer_radius = outer_diameter / 2;
inner_radius = inner_diameter / 2;
handle_opening_height = 30;
handle_opening_width = 25;
handle_wall = 7;
handle_depth = 16;
handle_center_z = mug_height / 2;
handle_opening_left_x = outer_radius + 5;
handle_attach_overlap = 2.5;
eps = 0.2;
module mug_body() {
difference() {
cylinder(h = mug_height, r = outer_radius);
translate([0, 0, bottom_thickness])
cylinder(h = mug_height - bottom_thickness + eps, r = inner_radius);
}
}
module d_shape_2d(x0, z0, h, w, segments = 72) {
r = h / 2;
straight_len = max(w - r, 0);
polygon(
points = concat(
[
[x0, z0 - r],
[x0 + straight_len, z0 - r]
],
[
for (i = [1 : segments])
let (a = -90 + 180 * i / segments)
[x0 + straight_len + r * cos(a), z0 + r * sin(a)]
],
[
[x0, z0 + r]
]
)
);
}
module handle_profile() {
difference() {
offset(r = handle_wall)
d_shape_2d(
handle_opening_left_x,
handle_center_z,
handle_opening_height,
handle_opening_width
);
d_shape_2d(
handle_opening_left_x,
handle_center_z,
handle_opening_height,
handle_opening_width
);
}
}
module handle() {
union() {
rotate([90, 0, 0])
linear_extrude(height = handle_depth, center = true, convexity = 10)
handle_profile();
translate([
outer_radius - handle_attach_overlap,
-handle_depth / 2,
handle_center_z - handle_opening_height / 2 - handle_wall
])
cube([
handle_opening_left_x - (outer_radius - handle_attach_overlap),
handle_depth,
handle_opening_height + 2 * handle_wall
]);
}
}
render(convexity = 10)
union() {
mug_body();
handle();
}
72.6s
· 1490/3026t · $0.0321
diff vs i2: +7/-23
$fn = 128;
outer_diameter = 80;
inner_diameter = 70;
mug_height = 90;
bottom_thickness = 6;
outer_radius = outer_diameter / 2;
inner_radius = inner_diameter / 2;
handle_opening_height = 30;
handle_opening_width = 25;
handle_wall = 7;
handle_depth = 16;
handle_center_z = mug_height / 2;
handle_opening_left_x = outer_radius + 5;
- handle_attach_overlap = 2.5;
eps = 0.2;
module mug_body() {
difference() {
cylinder(h = mug_height, r = outer_radius);
translate([0, 0, bottom_thickness])
cylinder(h = mug_height - bottom_thickness + eps, r = inner_radius);
}
}
- module d_shape_2d(x0, z0, h, w, segments = 72) {
+ module d_shape_2d(x0, z0, h, w, segments = 96) {
r = h / 2;
- straight_len = max(w - r, 0);
polygon(
points = concat(
[
- [x0, z0 - r],
- [x0 + straight_len, z0 - r]
+ [x0, z0 - r]
],
[
- for (i = [1 : segments])
+ for (i = [0 : segments])
let (a = -90 + 180 * i / segments)
- [x0 + straight_len + r * cos(a), z0 + r * sin(a)]
+ [x0 + w * cos(a), z0 + r * sin(a)]
],
[
[x0, z0 + r]
]
)
);
}
module handle_profile() {
difference() {
offset(r = handle_wall)
d_shape_2d(
handle_opening_left_x,
handle_center_z,
handle_opening_height,
handle_opening_width
);
d_shape_2d(
handle_opening_left_x,
handle_center_z,
handle_opening_height,
handle_opening_width
);
}
}
module handle() {
- union() {
- rotate([90, 0, 0])
- linear_extrude(height = handle_depth, center = true, convexity = 10)
- handle_profile();
-
- translate([
- outer_radius - handle_attach_overlap,
- -handle_depth / 2,
- handle_center_z - handle_opening_height / 2 - handle_wall
- ])
- cube([
- handle_opening_left_x - (outer_radius - handle_attach_overlap),
- handle_depth,
- handle_opening_height + 2 * handle_wall
- ]);
- }
+ rotate([90, 0, 0])
+ linear_extrude(height = handle_depth, center = true, convexity = 10)
+ handle_profile();
}
render(convexity = 10)
union() {
mug_body();
handle();
}
SCAD (79 lines)
$fn = 128;
outer_diameter = 80;
inner_diameter = 70;
mug_height = 90;
bottom_thickness = 6;
outer_radius = outer_diameter / 2;
inner_radius = inner_diameter / 2;
handle_opening_height = 30;
handle_opening_width = 25;
handle_wall = 7;
handle_depth = 16;
handle_center_z = mug_height / 2;
handle_opening_left_x = outer_radius + 5;
eps = 0.2;
module mug_body() {
difference() {
cylinder(h = mug_height, r = outer_radius);
translate([0, 0, bottom_thickness])
cylinder(h = mug_height - bottom_thickness + eps, r = inner_radius);
}
}
module d_shape_2d(x0, z0, h, w, segments = 96) {
r = h / 2;
polygon(
points = concat(
[
[x0, z0 - r]
],
[
for (i = [0 : segments])
let (a = -90 + 180 * i / segments)
[x0 + w * cos(a), z0 + r * sin(a)]
],
[
[x0, z0 + r]
]
)
);
}
module handle_profile() {
difference() {
offset(r = handle_wall)
d_shape_2d(
handle_opening_left_x,
handle_center_z,
handle_opening_height,
handle_opening_width
);
d_shape_2d(
handle_opening_left_x,
handle_center_z,
handle_opening_height,
handle_opening_width
);
}
}
module handle() {
rotate([90, 0, 0])
linear_extrude(height = handle_depth, center = true, convexity = 10)
handle_profile();
}
render(convexity = 10)
union() {
mug_body();
handle();
}