bare/gpt-5 / tier-2-offset-handle-mug
success tier 2
bare (gpt 5)
render
// Parameters
$fn = 96;
mug_od = 80;
mug_id = 70;
mug_h = 90;
mug_bottom = 6;
handle_inner_w = 25; // inner D width (X) = 25 mm
handle_inner_h = 30; // inner D height (Z) = 30 mm
handle_wall_t = 5; // 2D (XZ) wall thickness around inner D
handle_depth_y = 36; // thickness along Y (tangential)
attach_eps = 0.2; // small overlap into mug for robust union
// Mug body: outer cylinder minus inner cavity (leaving 6mm bottom)
module mug_body(od, id, h, bottom) {
difference() {
cylinder(d = od, h = h);
translate([0, 0, bottom])
cylinder(d = id, h = h - bottom + 0.02); // +tiny to ensure open top
}
}
// 2D inner D shape in XY-plane: X=radial, Y=vertical (will map to Z after rotation)
// Width (X) = handle_inner_w, Height (Y) = handle_inner_h
module d2d_inner(iw, ih) {
r = ih/2; // semicircle radius
d = iw - r; // rectangle width to make D profile
intersection() {
// Clip to half-plane x >= 0 using a large square
translate([250, 0]) square([500, 500], center = true);
union() {
// rectangle from x=0..d, y=-r..r
translate([d/2, 0]) square([d, ih], center = true);
// semicircle (circle) on the right
translate([d, 0]) circle(r = r);
}
}
}
// Handle: create 3D by extruding the 2D D profile along Z, then rotate to make extrusion along Y
module handle(iw, ih, wall_t, depth_y, mug_outer_r, z_center, eps) {
// Place so outer flat of the OUTER D (which is at x = -wall_t) sinks eps into mug at x = mug_outer_r - eps
dx = mug_outer_r - eps + wall_t;
translate([dx, 0, z_center])
rotate([-90, 0, 0]) // Z(extrude) -> Y, Y(2D) -> -Z
difference() {
// Outer D: offset the inner D by wall thickness in 2D, then extrude along Z
linear_extrude(height = depth_y, center = true)
offset(delta = wall_t) d2d_inner(iw, ih);
// Subtract inner D to form the handle hole
linear_extrude(height = depth_y + 0.4, center = true) // a bit taller for clean subtraction
d2d_inner(iw, ih);
}
}
union() {
mug_body(mug_od, mug_id, mug_h, mug_bottom);
handle(handle_inner_w, handle_inner_h, handle_wall_t, handle_depth_y, mug_od/2, mug_h/2, attach_eps);
} パラメータ (9) —
スライダを動かすと openscad-wasm で再レンダリング
iteration chain
各 iteration step は独立した benchmark run です。parentRunId で前段にリンクします。
→ children (1)
prompt
OpenSCAD で、向きが指定されたマグカップを作ってください。 本体: - 外径 80mm、内径 70mm(肉厚 5mm)、高さ 90mm の円筒形マグ - 底面の厚みは 6mm - 内側は飲み物を入れられるよう中空 取手(handle): - マグの **+X 軸方向の側面のみ** に付ける(他の方向には付けない) - 取手は D 字形状(外側が半円、本体側が直線)で、本体外周にしっかり接続する - 取手の内側の空間は高さ 30mm × 幅 25mm(指 3 本ぐらい入る) - 取手はマグの高さ方向の中央付近に付ける - 本体と取手は確実に union され、マニフォールド(隙間や宙吊りなし)を保つ 完成したコード全体を ```openscad ... ``` のフェンスで囲んで出力してください。コードのみで、追加の説明は不要です。