bare-low/claude-opus-5 / tier-2-offset-handle-mug
success tier 2
bare (claude opus 5)
render
// ===== Mug with D-shaped handle on +X side =====
$fn = 128;
// --- Parameters ---
outer_d = 80; // 外径
inner_d = 70; // 内径 (肉厚 5mm)
height = 90; // 全高
bottom_th = 6; // 底面厚み
hole_h = 30; // 取手内側の高さ
hole_w = 25; // 取手内側の幅 (X方向)
bar = 8; // 取手の太さ(断面)
overlap = 3; // 本体へのめり込み量
or = outer_d / 2;
ir = inner_d / 2;
// 取手の中心高さ(マグ中央)
handle_z = height / 2;
// --- 本体 ---
module body() {
difference() {
cylinder(h = height, r = or);
translate([0, 0, bottom_th])
cylinder(h = height - bottom_th + 1, r = ir);
}
}
// --- D字取手 ---
// 外形 D 形状から内側 D 形状を引く。XZ平面上の2D形状を押し出して回転配置。
module d_profile(w, h) {
// 直線部を x=0 に置き、+x 側へ張り出す D 形状
hull() {
translate([0, -h/2 + w/1e9]) square([0.001, h], center = false);
// 上下の端点を結ぶ直線部
translate([0, h/2 - 0.001]) square([0.001, 0.001]);
}
}
module handle_2d() {
difference() {
// 外形: 高さ hole_h+2*bar, 張り出し hole_w+bar
hull() {
translate([0, -(hole_h/2 + bar)]) square([0.01, hole_h + 2*bar]);
translate([hole_w + bar - (hole_h/2 + bar), 0])
circle(r = hole_h/2 + bar);
}
// 内側の穴: 高さ hole_h, 張り出し hole_w
hull() {
translate([-1, -hole_h/2]) square([1.01, hole_h]);
translate([hole_w - hole_h/2, 0]) circle(r = hole_h/2);
}
}
}
module handle() {
// 2D(X:張り出し, Y:高さ)を XZ 平面へ立てる
translate([or - overlap, 0, handle_z])
rotate([90, 0, 0])
linear_extrude(height = bar, center = true)
handle_2d();
}
// --- 合成 ---
union() {
body();
intersection() {
handle();
// 本体内部へは入り込ませない(内壁を貫通させない)
difference() {
translate([0, 0, -1]) cylinder(h = height + 2, r = or + hole_w + bar + 10);
translate([0, 0, bottom_th]) cylinder(h = height, r = ir);
}
}
} パラメータ (8) —
スライダを動かすと openscad-wasm で再レンダリング
prompt
OpenSCAD で、向きが指定されたマグカップを作ってください。 本体: - 外径 80mm、内径 70mm(肉厚 5mm)、高さ 90mm の円筒形マグ - 底面の厚みは 6mm - 内側は飲み物を入れられるよう中空 取手(handle): - マグの **+X 軸方向の側面のみ** に付ける(他の方向には付けない) - 取手は D 字形状(外側が半円、本体側が直線)で、本体外周にしっかり接続する - 取手の内側の空間は高さ 30mm × 幅 25mm(指 3 本ぐらい入る) - 取手はマグの高さ方向の中央付近に付ける - 本体と取手は確実に union され、マニフォールド(隙間や宙吊りなし)を保つ 完成したコード全体を ```openscad ... ``` のフェンスで囲んで出力してください。コードのみで、追加の説明は不要です。