101.6s
· 1457/8186t · $0.0376
diff vs bare: +46/-29
- // mug with specified handle on +X side
- outer_d = 80;
- inner_d = 70;
- height = 90;
- bottom_thickness = 6;
- opening_width = 25;
- opening_height = 30;
- handle_thickness = 15;
- $fn = 100;
+ // mug with D‐shaped handle on +X side
+ outer_d = 80; // outer diameter of mug
+ inner_d = 70; // inner diameter of mug
+ height = 90; // total mug height
+ bottom_thick = 6; // bottom thickness
+ open_w = 25; // finger‐hole width
+ open_h = 30; // finger‐hole height
+ h_thick = 15; // handle wall thickness (radius of outer arc)
+ $fn = 100; // resolution
- union() {
- // mug body
+ module mug() {
difference() {
- cylinder(d = outer_d, h = height);
- translate([0, 0, bottom_thickness])
- cylinder(d = inner_d, h = height - bottom_thickness);
+ // outer shell
+ cylinder(d = outer_d, h = height, $fn = $fn);
+ // hollow interior
+ translate([0,0,bottom_thick])
+ cylinder(d = inner_d, h = height - bottom_thick, $fn = $fn);
}
- // handle
- translate([0, 0, height/2 - opening_height/2])
- linear_extrude(height = opening_height)
- union() {
- // flat side of D
- translate([outer_d/2 + opening_width, -handle_thickness])
- square([handle_thickness, 2*handle_thickness]);
- // semicircular outer side
- intersection() {
- translate([outer_d/2 + opening_width + handle_thickness, 0])
- circle(r = handle_thickness);
- translate([outer_d/2 + opening_width + handle_thickness/2, 0])
- square([handle_thickness, 2*handle_thickness], center = true);
- }
- }
+ }
+
+ module handle2d() {
+ // 2D profile of the D‐shape (in the X–Y plane)
+ inner_x = outer_d/2; // flat‐face at mug outer
+ arc_cx = inner_x + open_w; // center of semicircle
+ union() {
+ // rectangular segment from flat face to start of arc
+ translate([inner_x, -h_thick])
+ square([open_w, 2*h_thick], center = false);
+ // outer semicircle (right half of a full circle)
+ intersection() {
+ translate([arc_cx, 0])
+ circle(r = h_thick, $fn = $fn);
+ // clip to x >= arc_cx (to keep only the right half)
+ translate([arc_cx, -100])
+ square([h_thick, 200], center = false);
+ }
+ }
+ }
+
+ module handle() {
+ // place handle at mid‐height, extrude the 2D D‐profile by open_h
+ translate([0, 0, height/2 - open_h/2])
+ linear_extrude(height = open_h)
+ handle2d();
+ }
+
+ union() {
+ mug();
+ handle();
}
SCAD (50 lines)
// mug with D‐shaped handle on +X side
outer_d = 80; // outer diameter of mug
inner_d = 70; // inner diameter of mug
height = 90; // total mug height
bottom_thick = 6; // bottom thickness
open_w = 25; // finger‐hole width
open_h = 30; // finger‐hole height
h_thick = 15; // handle wall thickness (radius of outer arc)
$fn = 100; // resolution
module mug() {
difference() {
// outer shell
cylinder(d = outer_d, h = height, $fn = $fn);
// hollow interior
translate([0,0,bottom_thick])
cylinder(d = inner_d, h = height - bottom_thick, $fn = $fn);
}
}
module handle2d() {
// 2D profile of the D‐shape (in the X–Y plane)
inner_x = outer_d/2; // flat‐face at mug outer
arc_cx = inner_x + open_w; // center of semicircle
union() {
// rectangular segment from flat face to start of arc
translate([inner_x, -h_thick])
square([open_w, 2*h_thick], center = false);
// outer semicircle (right half of a full circle)
intersection() {
translate([arc_cx, 0])
circle(r = h_thick, $fn = $fn);
// clip to x >= arc_cx (to keep only the right half)
translate([arc_cx, -100])
square([h_thick, 200], center = false);
}
}
}
module handle() {
// place handle at mid‐height, extrude the 2D D‐profile by open_h
translate([0, 0, height/2 - open_h/2])
linear_extrude(height = open_h)
handle2d();
}
union() {
mug();
handle();
}
60.0s
· 1650/5157t · $0.0245
diff vs i1: +2/-2
// mug with D‐shaped handle on +X side
outer_d = 80; // outer diameter of mug
inner_d = 70; // inner diameter of mug
height = 90; // total mug height
bottom_thick = 6; // bottom thickness
open_w = 25; // finger‐hole width
open_h = 30; // finger‐hole height
- h_thick = 15; // handle wall thickness (radius of outer arc)
+ h_thick = open_h/2; // half the hole height for D‐shape radius
$fn = 100; // resolution
module mug() {
difference() {
// outer shell
cylinder(d = outer_d, h = height, $fn = $fn);
// hollow interior
- translate([0,0,bottom_thick])
+ translate([0, 0, bottom_thick])
cylinder(d = inner_d, h = height - bottom_thick, $fn = $fn);
}
}
module handle2d() {
// 2D profile of the D‐shape (in the X–Y plane)
inner_x = outer_d/2; // flat‐face at mug outer
arc_cx = inner_x + open_w; // center of semicircle
union() {
// rectangular segment from flat face to start of arc
translate([inner_x, -h_thick])
square([open_w, 2*h_thick], center = false);
// outer semicircle (right half of a full circle)
intersection() {
translate([arc_cx, 0])
circle(r = h_thick, $fn = $fn);
// clip to x >= arc_cx (to keep only the right half)
translate([arc_cx, -100])
square([h_thick, 200], center = false);
}
}
}
module handle() {
// place handle at mid‐height, extrude the 2D D‐profile by open_h
translate([0, 0, height/2 - open_h/2])
linear_extrude(height = open_h)
handle2d();
}
union() {
mug();
handle();
}
SCAD (50 lines)
// mug with D‐shaped handle on +X side
outer_d = 80; // outer diameter of mug
inner_d = 70; // inner diameter of mug
height = 90; // total mug height
bottom_thick = 6; // bottom thickness
open_w = 25; // finger‐hole width
open_h = 30; // finger‐hole height
h_thick = open_h/2; // half the hole height for D‐shape radius
$fn = 100; // resolution
module mug() {
difference() {
// outer shell
cylinder(d = outer_d, h = height, $fn = $fn);
// hollow interior
translate([0, 0, bottom_thick])
cylinder(d = inner_d, h = height - bottom_thick, $fn = $fn);
}
}
module handle2d() {
// 2D profile of the D‐shape (in the X–Y plane)
inner_x = outer_d/2; // flat‐face at mug outer
arc_cx = inner_x + open_w; // center of semicircle
union() {
// rectangular segment from flat face to start of arc
translate([inner_x, -h_thick])
square([open_w, 2*h_thick], center = false);
// outer semicircle (right half of a full circle)
intersection() {
translate([arc_cx, 0])
circle(r = h_thick, $fn = $fn);
// clip to x >= arc_cx (to keep only the right half)
translate([arc_cx, -100])
square([h_thick, 200], center = false);
}
}
}
module handle() {
// place handle at mid‐height, extrude the 2D D‐profile by open_h
translate([0, 0, height/2 - open_h/2])
linear_extrude(height = open_h)
handle2d();
}
union() {
mug();
handle();
}
44.6s
· 1654/4161t · $0.0201
diff vs i2: +0/-0
// mug with D‐shaped handle on +X side
outer_d = 80; // outer diameter of mug
inner_d = 70; // inner diameter of mug
height = 90; // total mug height
bottom_thick = 6; // bottom thickness
open_w = 25; // finger‐hole width
open_h = 30; // finger‐hole height
h_thick = open_h/2; // half the hole height for D‐shape radius
$fn = 100; // resolution
module mug() {
difference() {
// outer shell
cylinder(d = outer_d, h = height, $fn = $fn);
// hollow interior
translate([0, 0, bottom_thick])
cylinder(d = inner_d, h = height - bottom_thick, $fn = $fn);
}
}
module handle2d() {
// 2D profile of the D‐shape (in the X–Y plane)
inner_x = outer_d/2; // flat‐face at mug outer
arc_cx = inner_x + open_w; // center of semicircle
union() {
// rectangular segment from flat face to start of arc
translate([inner_x, -h_thick])
square([open_w, 2*h_thick], center = false);
// outer semicircle (right half of a full circle)
intersection() {
translate([arc_cx, 0])
circle(r = h_thick, $fn = $fn);
// clip to x >= arc_cx (to keep only the right half)
translate([arc_cx, -100])
square([h_thick, 200], center = false);
}
}
}
module handle() {
// place handle at mid‐height, extrude the 2D D‐profile by open_h
translate([0, 0, height/2 - open_h/2])
linear_extrude(height = open_h)
handle2d();
}
union() {
mug();
handle();
}
SCAD (50 lines)
// mug with D‐shaped handle on +X side
outer_d = 80; // outer diameter of mug
inner_d = 70; // inner diameter of mug
height = 90; // total mug height
bottom_thick = 6; // bottom thickness
open_w = 25; // finger‐hole width
open_h = 30; // finger‐hole height
h_thick = open_h/2; // half the hole height for D‐shape radius
$fn = 100; // resolution
module mug() {
difference() {
// outer shell
cylinder(d = outer_d, h = height, $fn = $fn);
// hollow interior
translate([0, 0, bottom_thick])
cylinder(d = inner_d, h = height - bottom_thick, $fn = $fn);
}
}
module handle2d() {
// 2D profile of the D‐shape (in the X–Y plane)
inner_x = outer_d/2; // flat‐face at mug outer
arc_cx = inner_x + open_w; // center of semicircle
union() {
// rectangular segment from flat face to start of arc
translate([inner_x, -h_thick])
square([open_w, 2*h_thick], center = false);
// outer semicircle (right half of a full circle)
intersection() {
translate([arc_cx, 0])
circle(r = h_thick, $fn = $fn);
// clip to x >= arc_cx (to keep only the right half)
translate([arc_cx, -100])
square([h_thick, 200], center = false);
}
}
}
module handle() {
// place handle at mid‐height, extrude the 2D D‐profile by open_h
translate([0, 0, height/2 - open_h/2])
linear_extrude(height = open_h)
handle2d();
}
union() {
mug();
handle();
}