vibe-openscad

bare-max/claude-opus-4-8 / tier-2-offset-handle-mug

success tier 2

bare (claude opus 4.8)

render
bare render of tier-2-offset-handle-mug
loading STL…
success 49.2s · 341/3620t · $0.0922
SCAD (66 lines)
$fn = 96;

// ===== パラメータ =====
mug_outer_d   = 80;   // 本体外径
mug_inner_d   = 70;   // 本体内径 (肉厚5mm)
mug_height    = 90;   // 本体高さ
bottom_thick  = 6;    // 底の厚み

handle_grip_d = 12;   // 取手の太さ(断面の直径)
handle_open_h = 30;   // 取手内側の空間の高さ
handle_open_w = 25;   // 取手内側の空間の幅(本体外周からの張り出し方向)
handle_z      = mug_height / 2;  // 取手を付ける高さ(中央)

mug_outer_r = mug_outer_d / 2;
mug_inner_r = mug_inner_d / 2;

// ===== 本体 =====
module mug_body() {
    difference() {
        // 外形
        cylinder(h = mug_height, r = mug_outer_r);
        // 内側のくぼみ(中空)
        translate([0, 0, bottom_thick])
            cylinder(h = mug_height, r = mug_inner_r);
    }
}

// ===== 取手 (+X 側のみ, D字形状) =====
// D字の中心線(パス)に沿って円形断面をスイープする
module handle() {
    // 取手中心線が描く D 字輪郭の寸法
    // 内側の空間: 高さ handle_open_h, 幅 handle_open_w
    path_h = handle_open_h + handle_grip_d; // 中心線の高さ方向スパン
    path_w = handle_open_w;                 // 中心線の張り出し幅

    // 取手の付け根 X 位置(本体外周に少し食い込ませて確実に union)
    base_x = mug_outer_r - 2;

    translate([base_x, 0, handle_z])
    rotate([90, 0, 0])  // 取手の平面を XZ→作図しやすい向きへ
    linear_extrude(height = handle_grip_d, center = true)
        difference() {
            d_shape(path_w, path_h);
            offset(r = -handle_grip_d)
                d_shape(path_w, path_h);
        }
}

// D字の外形(2D): 左側が直線(本体側)、右側が半円
module d_shape(w, h) {
    hull() {
        // 直線側(本体に接する辺):上下2点
        translate([0,  h/2 - w/2]) circle(r = 0.01);
        translate([0, -h/2 + w/2]) circle(r = 0.01);
        // 半円側
        translate([0,  h/2 - w/2]) translate([w - w/2,0]) circle(r = 0.01);
        translate([0, -h/2 + w/2]) translate([w - w/2,0]) circle(r = 0.01);
    }
    // 上記hullだと角丸の矩形になるため、よりD字に近い形を別途構成
}

// ===== 組み立て =====
union() {
    mug_body();
    handle();
}
パラメータ (7)
スライダを動かすと openscad-wasm で再レンダリング

meta

runIdbare-max_claude-opus-4-8-20c923eb569f-2026-06-09T17-39-30-423Z
matrixIdbare-max/claude-opus-4-8
signature20c923eb569fe082…
provideranthropic
modelclaude-opus-4-8
harnessbare
statussuccess
duration49.23s (wallclock: load + prompt eval + generation + network)
tokens341 in / 3620 out
wallclock tok/s73.5 tok/s (end-to-end)
cost$0.0922
createdAt2026-06-09T17:39:30.423Z
gitCommitc8a77106d384
openscadOpenSCAD version 2026.04.27

prompt

OpenSCAD で、向きが指定されたマグカップを作ってください。

本体:
- 外径 80mm、内径 70mm(肉厚 5mm)、高さ 90mm の円筒形マグ
- 底面の厚みは 6mm
- 内側は飲み物を入れられるよう中空

取手(handle):
- マグの **+X 軸方向の側面のみ** に付ける(他の方向には付けない)
- 取手は D 字形状(外側が半円、本体側が直線)で、本体外周にしっかり接続する
- 取手の内側の空間は高さ 30mm × 幅 25mm(指 3 本ぐらい入る)
- 取手はマグの高さ方向の中央付近に付ける
- 本体と取手は確実に union され、マニフォールド(隙間や宙吊りなし)を保つ

完成したコード全体を ```openscad ... ``` のフェンスで囲んで出力してください。コードのみで、追加の説明は不要です。