vibe-openscad

tier-2-offset-handle-mug / claude-sonnet-5

7 run / 累計 2061.4s / 累計 $1.89

claude sonnet 5 bare

bare (provider default effort)

run detail →
render
bare render of tier-2-offset-handle-mug
loading STL…
success 190.5s · 343/17209t · $0.1728
SCAD (69 lines)
// ============================================
// 向き指定マグカップ (+X方向に取手)
// ============================================
$fn = 100;

// ---- 本体パラメータ ----
mug_or   = 40;   // 外径半径 (外径80mm)
mug_ir   = 35;   // 内径半径 (内径70mm, 肉厚5mm)
mug_h    = 90;   // 高さ
bottom_t = 6;    // 底面厚み

// ---- 取手パラメータ ----
handle_center_z   = mug_h / 2; // 取手の高さ方向中心 (45mm付近)
gap_h             = 30;  // 指入れ空間: 高さ
gap_w             = 25;  // 指入れ空間: 幅(本体表面からの奥行)
wall_t            = 10;  // 取手の肉厚(穴周囲)
embed             = 5;   // 本体壁への埋め込み量(壁厚5mm以内に収める)
handle_thickness  = 14;  // 取手の厚み(Y方向)

// D字形状(平坦な左辺 + 半円の右端)を作る2Dプロファイル
module d_profile(flat_x, width, height, center_z) {
    r = height / 2;
    x_mid = flat_x + width - r;
    difference() {
        union() {
            translate([flat_x, center_z - height/2])
                square([width, height]);
            translate([x_mid, center_z])
                circle(r = r);
        }
        // flat_x より左側を確実に切り落とし、平坦面を保証する
        translate([flat_x - 1000, center_z - 1000])
            square([1000, 2000]);
    }
}

// マグ本体(中空の円筒)
module mug_body() {
    difference() {
        cylinder(h = mug_h, r = mug_or);
        translate([0, 0, bottom_t])
            cylinder(h = mug_h - bottom_t + 1, r = mug_ir);
    }
}

// 取手(D字形、+X方向のみに配置)
module handle() {
    outer_flat_x = mug_or - embed;              // 本体壁内部まで埋め込む
    outer_width  = embed + gap_w + wall_t;      // 外側先端までの幅
    outer_height = gap_h + 2 * wall_t;          // 上下の肉厚を含む高さ

    hole_flat_x = mug_or;   // 穴は本体外周面から開始
    hole_width  = gap_w;
    hole_height = gap_h;

    translate([0, handle_thickness/2, 0])
    rotate([90, 0, 0])
    linear_extrude(height = handle_thickness)
        difference() {
            d_profile(outer_flat_x, outer_width, outer_height, handle_center_z);
            d_profile(hole_flat_x,  hole_width,  hole_height,  handle_center_z);
        }
}

// ---- 最終出力 ----
union() {
    mug_body();
    handle();
}
パラメータ (9) —
スライダを動かすと openscad-wasm で再レンダリング

prompt

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

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

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

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

variant: effort

low success →
low
9.2s · 343/845t · $0.0091
SCAD (74 lines)
// マグカップ本体 + 取手

$fn = 100;

outer_d = 80;
inner_d = 70;
height = 90;
bottom_thickness = 6;

module mug_body() {
    difference() {
        cylinder(d=outer_d, h=height);
        translate([0, 0, bottom_thickness])
            cylinder(d=inner_d, h=height - bottom_thickness + 1);
    }
}

// 取手パラメータ
handle_inner_h = 30; // 内側空間の高さ
handle_inner_w = 25; // 内側空間の幅(本体からの突き出し方向)
handle_thickness = 8; // 取手の太さ(D字の厚み)
handle_center_z = height / 2;

module handle() {
    outer_r = outer_d / 2;
    // D字形状の取手を、Y-Z平面上に断面として描き、X方向に押し出す
    // 外側:半円、本体側:直線 のD字形状を2Dで作り、linear_extrudeでX方向に厚みを持たせる

    // 外形の半径(内側空間 + 厚み)
    total_w = handle_inner_w + handle_thickness * 2;
    total_h = handle_inner_h + handle_thickness * 2;

    module d_shape(w, h) {
        // D字:上下は半円、本体側は直線でつながる断面(Y-Z平面, 原点は中心)
        r = h / 2;
        union() {
            // 半円部分(外側)
            translate([w - r - (w/2 - r), 0])
                circle(r = r);
            // 直線部分(本体側の矩形)
            translate([-(w/2), -r])
                square([w/2, h]);
        }
    }

    // outer d-shape
    module outer_dshape() {
        translate([0,0,0])
        d_shape(total_w, total_h);
    }

    // inner d-shape (穴)
    module inner_dshape() {
        d_shape(handle_inner_w, handle_inner_h);
    }

    // 2D形状をX軸方向へ厚み分押し出す(取手の厚み方向はX軸)
    translate([outer_r - 1, 0, handle_center_z])
        rotate([0, 90, 0])
            linear_extrude(height = handle_thickness, center = false)
                difference() {
                    outer_dshape();
                    inner_dshape();
                }
}

module mug() {
    union() {
        mug_body();
        handle();
    }
}

mug();
mediumnot run
—
high (default) success →
high
14.0s · 343/1390t · $0.0146
SCAD (122 lines)
// マグカップ本体と取手

$fn = 100;

// 本体パラメータ
outer_radius = 40;      // 外径80mm
inner_radius = 35;      // 内径70mm
mug_height = 90;
bottom_thickness = 6;

// 取手パラメータ
handle_inner_height = 30;
handle_inner_width = 25;
handle_thickness = 8;      // 取手の太さ(押し出し断面の直径)
handle_center_z = mug_height / 2;

module mug_body() {
    difference() {
        cylinder(h = mug_height, r = outer_radius);
        translate([0, 0, bottom_thickness])
            cylinder(h = mug_height, r = inner_radius);
    }
}

// D字型取手
// 外側が半円、本体側が直線のD字形状の断面を、上下に扫掠(スイープ)して立体を作る
module handle() {
    // D字の内側空間サイズ
    inner_w = handle_inner_width;   // X方向の内側幅(本体からの張り出し量)
    inner_h = handle_inner_height;  // Z方向の内側高さ

    // 全体の外形サイズ(内側 + 太さ分)
    outer_w = inner_w + handle_thickness;
    outer_h = inner_h + handle_thickness * 2;

    // 本体外周に接続するX位置
    x_base = outer_radius - 1; // 少しめり込ませて確実に union

    translate([x_base, 0, handle_center_z]) {
        rotate([90, 0, 0]) {
            linear_extrude(height = handle_thickness, center = true) {
                difference() {
                    // 外側のD字形状(半円 + 直線側)
                    d_shape(outer_w, outer_h);
                    // 内側のD字形状をくり抜く(内側空間)
                    d_shape_inner(inner_w, inner_h, handle_thickness);
                }
            }
        }
    }
}

// D字形状:左側が直線(本体側)、右側が半円
module d_shape(w, h) {
    r = h / 2;
    union() {
        // 直線部分(左側の四角)
        translate([-1, -h/2])
            square([r + 1, h]);
        // 半円部分(右側)
        translate([r, 0])
            circle(r = r);
    }
}

// 内側(くり抜き用)のD字形状。thicknessの分だけ小さくする
module d_shape_inner(w, h, thickness) {
    r = h / 2;
    union() {
        translate([-1, -h/2])
            square([r + 1, h]);
        translate([r, 0])
            circle(r = r);
    }
}

// 取手全体をより正確に:内側空間を確保しつつ外形はD字
module handle_solid() {
    inner_w = handle_inner_width;
    inner_h = handle_inner_height;
    t = handle_thickness;

    outer_h = inner_h + 2 * t;
    outer_r = outer_h / 2;

    x_base = outer_radius - 2; // 本体にめり込ませる

    translate([x_base, 0, handle_center_z]) {
        rotate([90, 0, 0]) {
            linear_extrude(height = t, center = true) {
                difference() {
                    // 外形:左が直線、右が半円のD字
                    hull() {
                        translate([0, -outer_r])
                            square([1, outer_h]);
                        translate([outer_r, 0])
                            circle(r = outer_r);
                    }
                    // 内側の穴:同じくD字型にくり抜き、指が入る空間を作る
                    translate([t, 0]) {
                        inner_r = inner_h / 2;
                        hull() {
                            translate([0, -inner_r])
                                square([1, inner_h]);
                            translate([inner_w - inner_r, 0])
                                circle(r = inner_r);
                        }
                    }
                }
            }
        }
    }
}

module mug_with_handle() {
    union() {
        mug_body();
        handle_solid();
    }
}

mug_with_handle();
max no_code nocode →
no_code
701.4s · 343/64000t · $0.6407
model returned empty response (stopReason=max_tokens)
SCAD (1 lines)

no SCAD

xhigh success →
xhigh
431.0s · 343/39944t · $0.4001
SCAD (74 lines)
$fn = 100;

// ==================== パラメータ ====================
// マグ本体
mug_outer_r  = 40;   // 外径80mm
mug_inner_r  = 35;   // 内径70mm(肉厚5mm)
mug_height   = 90;
bottom_thick = 6;

// 取手
handle_hole_h   = 30;  // 取手内側空間の高さ
handle_hole_w   = 25;  // 取手内側空間の幅(本体表面からの突き出し量)
handle_band_t   = 8;   // 取手バンド material の太さ
handle_width    = 20;  // 取手のY方向(奥行き)の幅
handle_embed    = 4;   // 本体側への埋め込み量(確実に union するため)
handle_center_z = mug_height / 2; // 高さ方向中央

// ==================== マグ本体 ====================
module mug_body() {
    difference() {
        cylinder(r = mug_outer_r, h = mug_height);
        translate([0, 0, bottom_thick])
            cylinder(r = mug_inner_r, h = mug_height - bottom_thick + 2);
    }
}

// ==================== D字プロファイル(2D断面) ====================
// flat_u : 本体側の直線部分のu座標(まっすぐな辺)
// far_u  : 先端(半円の頂点)のu座標
// half_h : 高さの半分
// r      : 半円部分の半径
module d_profile(flat_u, far_u, half_h, r) {
    rect_w = far_u - r - flat_u;
    intersection() {
        union() {
            if (rect_w > 0) {
                translate([flat_u, -half_h])
                    square([rect_w, 2 * half_h]);
            }
            translate([far_u - r, 0])
                circle(r = r);
        }
        // flat_u より内側(本体側)にはみ出た部分を切り落として直線にする
        translate([flat_u, -1000])
            square([2000, 2000]);
    }
}

// ==================== 取手(+X方向のみ) ====================
module handle() {
    hole_half_h = handle_hole_h / 2;
    hole_r      = hole_half_h;
    flat_u_hole = mug_outer_r;                 // 穴は本体表面から
    far_u_hole  = flat_u_hole + handle_hole_w; // 穴の奥行き25mm

    outer_half_h = hole_half_h + handle_band_t;
    outer_r      = outer_half_h;
    flat_u_outer = mug_outer_r - handle_embed; // 本体内部へ埋め込む
    far_u_outer  = far_u_hole + handle_band_t; // 外周は穴+バンド厚

    translate([0, 0, handle_center_z])
        rotate([90, 0, 0])
            linear_extrude(height = handle_width, center = true)
                difference() {
                    d_profile(flat_u_outer, far_u_outer, outer_half_h, outer_r);
                    d_profile(flat_u_hole,  far_u_hole,  hole_half_h,  hole_r);
                }
}

// ==================== 組み立て ====================
union() {
    mug_body();
    handle();
}

variant: thinking

off success →
off
14.0s · 343/1390t · $0.0146
SCAD (122 lines)
// マグカップ本体と取手

$fn = 100;

// 本体パラメータ
outer_radius = 40;      // 外径80mm
inner_radius = 35;      // 内径70mm
mug_height = 90;
bottom_thickness = 6;

// 取手パラメータ
handle_inner_height = 30;
handle_inner_width = 25;
handle_thickness = 8;      // 取手の太さ(押し出し断面の直径)
handle_center_z = mug_height / 2;

module mug_body() {
    difference() {
        cylinder(h = mug_height, r = outer_radius);
        translate([0, 0, bottom_thickness])
            cylinder(h = mug_height, r = inner_radius);
    }
}

// D字型取手
// 外側が半円、本体側が直線のD字形状の断面を、上下に扫掠(スイープ)して立体を作る
module handle() {
    // D字の内側空間サイズ
    inner_w = handle_inner_width;   // X方向の内側幅(本体からの張り出し量)
    inner_h = handle_inner_height;  // Z方向の内側高さ

    // 全体の外形サイズ(内側 + 太さ分)
    outer_w = inner_w + handle_thickness;
    outer_h = inner_h + handle_thickness * 2;

    // 本体外周に接続するX位置
    x_base = outer_radius - 1; // 少しめり込ませて確実に union

    translate([x_base, 0, handle_center_z]) {
        rotate([90, 0, 0]) {
            linear_extrude(height = handle_thickness, center = true) {
                difference() {
                    // 外側のD字形状(半円 + 直線側)
                    d_shape(outer_w, outer_h);
                    // 内側のD字形状をくり抜く(内側空間)
                    d_shape_inner(inner_w, inner_h, handle_thickness);
                }
            }
        }
    }
}

// D字形状:左側が直線(本体側)、右側が半円
module d_shape(w, h) {
    r = h / 2;
    union() {
        // 直線部分(左側の四角)
        translate([-1, -h/2])
            square([r + 1, h]);
        // 半円部分(右側)
        translate([r, 0])
            circle(r = r);
    }
}

// 内側(くり抜き用)のD字形状。thicknessの分だけ小さくする
module d_shape_inner(w, h, thickness) {
    r = h / 2;
    union() {
        translate([-1, -h/2])
            square([r + 1, h]);
        translate([r, 0])
            circle(r = r);
    }
}

// 取手全体をより正確に:内側空間を確保しつつ外形はD字
module handle_solid() {
    inner_w = handle_inner_width;
    inner_h = handle_inner_height;
    t = handle_thickness;

    outer_h = inner_h + 2 * t;
    outer_r = outer_h / 2;

    x_base = outer_radius - 2; // 本体にめり込ませる

    translate([x_base, 0, handle_center_z]) {
        rotate([90, 0, 0]) {
            linear_extrude(height = t, center = true) {
                difference() {
                    // 外形:左が直線、右が半円のD字
                    hull() {
                        translate([0, -outer_r])
                            square([1, outer_h]);
                        translate([outer_r, 0])
                            circle(r = outer_r);
                    }
                    // 内側の穴:同じくD字型にくり抜き、指が入る空間を作る
                    translate([t, 0]) {
                        inner_r = inner_h / 2;
                        hull() {
                            translate([0, -inner_r])
                                square([1, inner_h]);
                            translate([inner_w - inner_r, 0])
                                circle(r = inner_r);
                        }
                    }
                }
            }
        }
    }
}

module mug_with_handle() {
    union() {
        mug_body();
        handle_solid();
    }
}

mug_with_handle();
adaptive (default) no_code nocode →
no_code
701.4s · 343/64000t · $0.6407
model returned empty response (stopReason=max_tokens)
SCAD (1 lines)

no SCAD

dynamicnot run
—