bare/claude-opus-5 / tier-2-offset-handle-mug
success tier 2
bare (claude opus 5)
render
// ===== Mug with oriented D-shaped handle (+X side only) =====
$fn = 96;
// ---- Body parameters ----
outer_d = 80; // 外径
inner_d = 70; // 内径 (肉厚 5mm)
height = 90; // 全高
bottom_th = 6; // 底面厚み
outer_r = outer_d / 2; // 40
inner_r = inner_d / 2; // 35
// ---- Handle parameters ----
h_open_h = 30; // 取手内側の空間 高さ
h_open_w = 25; // 取手内側の空間 幅 (径方向)
h_thick = 8; // 取手の太さ(上下バー・外側部の厚み)
h_width = 12; // 取手の幅 (Y方向)
h_embed = 4; // 本体外周へのめり込み量(確実に union するため)
// 取手の高さ方向中心(マグ中央付近)
h_center_z = bottom_th + (height - bottom_th) / 2;
// ---- Body ----
module mug_body() {
difference() {
cylinder(h = height, r = outer_r);
translate([0, 0, bottom_th])
cylinder(h = height - bottom_th + 1, r = inner_r);
}
}
// ---- Handle : D shape (flat on body side, round outside) ----
// 2D プロファイルを XZ 平面で作り、Y 方向に押し出す
module handle_profile() {
// 内側の穴の開始 X(本体外周からわずかに内側へ食い込ませる)
x0 = outer_r - h_embed; // 本体に埋まる側の面
x1 = x0 + h_thick; // 穴の内側端(手前)
x2 = x1 + h_open_w; // 穴の外側端
x3 = x2 + h_thick; // 取手の外端
difference() {
// 外形:D 字(本体側は直線、外側は半円)
hull() {
translate([x0, -(h_open_h / 2 + h_thick)])
square([1, h_open_h + 2 * h_thick]);
translate([x2, -(h_open_h / 2)])
circle(r = h_thick);
translate([x2, (h_open_h / 2)])
circle(r = h_thick);
}
// 内側の空間 30(高さ) x 25(幅)
translate([x1, -h_open_h / 2])
square([h_open_w, h_open_h]);
}
}
module handle() {
translate([0, h_width / 2, 0])
rotate([90, 0, 0])
linear_extrude(height = h_width)
handle_profile();
}
// ---- Assembly ----
union() {
mug_body();
translate([0, 0, h_center_z])
handle();
} パラメータ (9) —
スライダを動かすと openscad-wasm で再レンダリング
prompt
OpenSCAD で、向きが指定されたマグカップを作ってください。 本体: - 外径 80mm、内径 70mm(肉厚 5mm)、高さ 90mm の円筒形マグ - 底面の厚みは 6mm - 内側は飲み物を入れられるよう中空 取手(handle): - マグの **+X 軸方向の側面のみ** に付ける(他の方向には付けない) - 取手は D 字形状(外側が半円、本体側が直線)で、本体外周にしっかり接続する - 取手の内側の空間は高さ 30mm × 幅 25mm(指 3 本ぐらい入る) - 取手はマグの高さ方向の中央付近に付ける - 本体と取手は確実に union され、マニフォールド(隙間や宙吊りなし)を保つ 完成したコード全体を ```openscad ... ``` のフェンスで囲んで出力してください。コードのみで、追加の説明は不要です。