vibe-openscad

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

7 run / 累計 378.8s / 累計 $0.7561

claude opus 5 bare

bare (provider default effort)

run detail →
render
bare render of tier-2-offset-handle-mug
loading STL…
success 17.5s · 343/1297t · $0.0341
SCAD (91 lines)
// =========================================
// Mug with D-shaped handle on +X side
// =========================================

$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_center_z = height / 2;     // 高さ方向の中央付近

// 取手の内側開口の始まり(本体外周より少し内側に食い込ませて確実に union)
h_embed    = 3;                          // 本体へのめり込み量
h_in_x     = outer_r - h_embed;          // D 形状の直線部 X 位置
h_out_x    = h_in_x + h_open_w + h_thick;// D 形状の外周 X 位置

// -----------------------------------------
// 本体
// -----------------------------------------
module body() {
    difference() {
        cylinder(h = height, r = outer_r);
        translate([0, 0, bottom_th])
            cylinder(h = height - bottom_th + 1, r = inner_r);
    }
}

// -----------------------------------------
// 取手 (D 字形状: 外側半円 + 本体側直線)
//   2D プロファイルを作って linear_extrude し、
//   Y 方向に厚みを持たせるため回転させて配置
// -----------------------------------------
module handle_profile() {
    // XZ 平面上の D 字リング(中心は z = 0)
    difference() {
        // 外形: 直線部 + 外側半円(角丸 D 形状)
        hull() {
            // 本体側の直線部(縦の柱)
            translate([h_in_x, -(h_open_h / 2 + h_thick / 2)])
                square([1, h_open_h + h_thick]);
            // 外側の半円をつくるための上下の円
            translate([h_out_x - h_thick / 2,  h_open_h / 2]) circle(d = h_thick);
            translate([h_out_x - h_thick / 2, -h_open_h / 2]) circle(d = h_thick);
        }
        // 内側の空間 (高さ 30mm × 幅 25mm)
        hull() {
            translate([h_in_x - 1, -h_open_h / 2])
                square([1, h_open_h]);
            translate([h_in_x + h_open_w - h_thick / 2,  h_open_h / 2 - 0.001])
                circle(d = h_thick);
            translate([h_in_x + h_open_w - h_thick / 2, -h_open_h / 2 + 0.001])
                circle(d = h_thick);
        }
    }
}

module handle() {
    translate([0, 0, h_center_z])
        rotate([90, 0, 0])
            linear_extrude(height = h_width, center = true)
                handle_profile();
}

// -----------------------------------------
// 組み立て(取手は +X 方向のみ)
// -----------------------------------------
module mug() {
    union() {
        body();
        // 本体内部にはみ出さないよう、内側の空洞は削らない
        difference() {
            handle();
            // マグ内壁より内側に入り込んだ部分をカット
            translate([0, 0, bottom_th])
                cylinder(h = height - bottom_th + 1, r = inner_r);
        }
    }
}

mug();
パラメータ (9) —
スライダを動かすと openscad-wasm で再レンダリング

prompt

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

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

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

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

variant: effort

low success →
low
15.8s · 343/1022t · $0.0273
SCAD (76 lines)
// ===== 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);
        }
    }
}
mediumnot run
—
high (default) success →
high
14.5s · 343/1025t · $0.0273
SCAD (78 lines)
// ===== パラメータ =====
$fn = 120;

body_od      = 80;      // 外径
body_id      = 70;      // 内径
body_h       = 90;      // 高さ
bottom_t     = 6;       // 底の厚み

handle_hole_h = 30;     // 取手内側の空間 高さ
handle_hole_w = 25;     // 取手内側の空間 幅(半径方向)
handle_t      = 8;      // 取手の断面の太さ(半径方向・上下方向)
handle_w      = 12;     // 取手の厚み(Y方向)
handle_z      = body_h / 2;   // 取手の高さ中心
embed         = 3;      // 本体へのめり込み量(確実に union するため)

body_or = body_od / 2;
body_ir = body_id / 2;

// ===== 本体 =====
module body() {
    difference() {
        cylinder(h = body_h, r = body_or);
        translate([0, 0, bottom_t])
            cylinder(h = body_h - bottom_t + 1, r = body_ir);
    }
}

// ===== 取手(D字形状:外側が半円、本体側が直線) =====
// XZ 平面上の 2D の D 字リングを作り、Y 方向に押し出す
module handle_profile() {
    // 外形 D
    outer_h = handle_hole_h + 2 * handle_t;   // 46
    outer_w = handle_hole_w + handle_t;       // 33 (本体面から外側へ)

    difference() {
        // 外側 D 形状(左端が直線、右側が半円)
        d_shape(outer_w, outer_h);
        // 内側の空間 D 形状
        translate([0, 0])
            d_shape(handle_hole_w, handle_hole_h);
    }
}

// 幅 w(x: 0 → w)、高さ h(z: -h/2 → h/2)の D 形状
// 左端(x=0)が直線、右側が半円 + 直線部
module d_shape(w, h) {
    r = h / 2;
    straight = max(w - r, 0.01);
    union() {
        translate([0, -r]) square([straight, h]);
        translate([straight, 0]) circle(r = r);
    }
}

module handle() {
    // XZ 平面の 2D プロファイルを Y 方向に押し出して、+X 側面に配置
    translate([body_or - embed, 0, handle_z])
        rotate([90, 0, 0])
            translate([0, 0, -handle_w / 2])
                linear_extrude(height = handle_w)
                    handle_profile();
}

// ===== 合体 =====
module mug() {
    union() {
        body();
        // 本体内部にはみ出さないよう、外形でクリップ
        difference() {
            handle();
            // マグ内部の中空部分を侵さない
            translate([0, 0, bottom_t])
                cylinder(h = body_h - bottom_t + 1, r = body_ir);
        }
    }
}

mug();
max success →
max
104.2s · 343/8548t · $0.2154
SCAD (71 lines)
// =========================================================
//  マグカップ(取手は +X 方向のみ / D 字取手)
//    - 外径 80 / 内径 70(肉厚 5)/ 高さ 90 / 底厚 6
//    - 取手内側の空間:高さ 30 × 幅 25
// =========================================================

$fa = 2;
$fs = 0.5;

/* ---------------- パラメータ ---------------- */
mug_od   = 80;   // 本体外径
mug_id   = 70;   // 本体内径(肉厚 5mm)
mug_h    = 90;   // 本体高さ
bottom_t = 6;    // 底面の厚み

hole_h   = 30;   // 取手内側の空間:高さ(Z)
hole_w   = 25;   // 取手内側の空間:幅(X)
grip_t   = 10;   // 取手の太さ(XZ 面内)
grip_w   = 12;   // 取手の幅(Y 方向)
embed    = 4;    // 本体壁への食い込み量(union を確実にする)

mug_or = mug_od / 2;   // 40
mug_ir = mug_id / 2;   // 35

/* ---------------- 本体 ---------------- */
module mug_body() {
    difference() {
        cylinder(h = mug_h, r = mug_or);
        // 内側の中空(底厚 6mm を残し、上面は開口)
        translate([0, 0, bottom_t])
            cylinder(h = mug_h - bottom_t + 1, r = mug_ir);
    }
}

/* ---- 取手の内側空間(D 字の穴):本体側が直線、外側が半円 ---- */
module hole_2d() {
    r  = hole_h / 2;              // 15
    x0 = mug_or;                  // 本体外周から開始(幅 25 を確保)
    cx = x0 + hole_w - r;         // 半円の中心 X
    hull() {
        translate([x0, -r]) square([cx - x0, hole_h]);
        translate([cx, 0])  circle(r = r);
    }
}

/* ---- 取手の 2D 断面(外側=半円、本体側=直線) ---- */
module handle_2d() {
    intersection() {
        difference() {
            offset(r = grip_t) hole_2d();   // 外形(オフセットで外側が半円状)
            hole_2d();                      // 指を入れる空間
        }
        // 本体側は直線でカット(x = mug_or - embed で壁に食い込ませる)
        translate([mug_or - embed, -mug_h])
            square([mug_h * 2, mug_h * 2]);
    }
}

/* ---------------- 取手(3D:XZ 平面のループ / 厚みは Y 方向) ---------------- */
module handle() {
    translate([0, 0, mug_h / 2])            // 高さ方向の中央
        rotate([90, 0, 0])                  // 2D 断面を XZ 平面へ
            linear_extrude(height = grip_w, center = true, convexity = 10)
                handle_2d();
}

/* ---------------- 合体(マニフォールド) ---------------- */
union() {
    mug_body();
    handle();      // +X 側のみ
}
xhigh success →
xhigh
108.2s · 343/8297t · $0.2091
SCAD (69 lines)
/* ============================================================
   マグカップ(取手は +X 方向のみ / D 字形状)
   ============================================================ */

$fn = 96;

/* ---- 本体パラメータ ---- */
outer_d  = 80;      // 外径
inner_d  = 70;      // 内径(肉厚 5mm)
mug_h    = 90;      // 全高
bottom_t = 6;       // 底の厚み

/* ---- 取手パラメータ ---- */
handle_hole_h = 30; // 取手内側の空間:高さ
handle_hole_w = 25; // 取手内側の空間:幅
handle_t      = 8;  // 取手の太さ(半径方向)
handle_w      = 12; // 取手の幅(Y方向)
handle_z      = mug_h / 2;   // 取手の中心高さ(マグ中央)

eps   = 0.01;
R_out = outer_d / 2;
R_in  = inner_d / 2;

/* ---- 取手の 2D 断面(XZ 平面用) ----
   外側:半円 / 本体側:直線 の D 字形
   左端は本体外周より handle_t だけ内側に食い込ませて確実に接続 */
module handle_2d() {
    r_i = handle_hole_h / 2;                 // 内側半円半径 = 15
    r_o = r_i + handle_t;                    // 外側半円半径 = 23
    x_i = R_out;                             // 内側空間の直線部(本体外周)
    x_o = x_i - handle_t;                    // 外形の直線部(本体内部へ埋没)
    cx  = x_i + handle_hole_w - r_i;         // 半円の中心 X

    difference() {
        // 外形(D 字)
        hull() {
            translate([x_o, -r_o]) square([eps, 2 * r_o]);
            translate([cx, 0]) circle(r = r_o);
        }
        // 内側の空間(D 字・30 x 25)
        hull() {
            translate([x_i, -r_i]) square([eps, 2 * r_i]);
            translate([cx, 0]) circle(r = r_i);
        }
    }
}

/* ---- 取手(+X 側のみ・Y 方向に厚み) ---- */
module handle() {
    translate([0, 0, handle_z])
        rotate([90, 0, 0])
            linear_extrude(height = handle_w, center = true)
                handle_2d();
}

/* ---- マグ本体 + 取手 ---- */
module mug() {
    difference() {
        union() {
            cylinder(h = mug_h, d = outer_d);   // 外形
            handle();                           // 取手(確実に union)
        }
        // 内側の中空(底厚 6mm を残して上面は開口)
        translate([0, 0, bottom_t])
            cylinder(h = mug_h - bottom_t + eps, d = inner_d);
    }
}

mug();

variant: thinking

off success →
off
14.5s · 343/1025t · $0.0273
SCAD (78 lines)
// ===== パラメータ =====
$fn = 120;

body_od      = 80;      // 外径
body_id      = 70;      // 内径
body_h       = 90;      // 高さ
bottom_t     = 6;       // 底の厚み

handle_hole_h = 30;     // 取手内側の空間 高さ
handle_hole_w = 25;     // 取手内側の空間 幅(半径方向)
handle_t      = 8;      // 取手の断面の太さ(半径方向・上下方向)
handle_w      = 12;     // 取手の厚み(Y方向)
handle_z      = body_h / 2;   // 取手の高さ中心
embed         = 3;      // 本体へのめり込み量(確実に union するため)

body_or = body_od / 2;
body_ir = body_id / 2;

// ===== 本体 =====
module body() {
    difference() {
        cylinder(h = body_h, r = body_or);
        translate([0, 0, bottom_t])
            cylinder(h = body_h - bottom_t + 1, r = body_ir);
    }
}

// ===== 取手(D字形状:外側が半円、本体側が直線) =====
// XZ 平面上の 2D の D 字リングを作り、Y 方向に押し出す
module handle_profile() {
    // 外形 D
    outer_h = handle_hole_h + 2 * handle_t;   // 46
    outer_w = handle_hole_w + handle_t;       // 33 (本体面から外側へ)

    difference() {
        // 外側 D 形状(左端が直線、右側が半円)
        d_shape(outer_w, outer_h);
        // 内側の空間 D 形状
        translate([0, 0])
            d_shape(handle_hole_w, handle_hole_h);
    }
}

// 幅 w(x: 0 → w)、高さ h(z: -h/2 → h/2)の D 形状
// 左端(x=0)が直線、右側が半円 + 直線部
module d_shape(w, h) {
    r = h / 2;
    straight = max(w - r, 0.01);
    union() {
        translate([0, -r]) square([straight, h]);
        translate([straight, 0]) circle(r = r);
    }
}

module handle() {
    // XZ 平面の 2D プロファイルを Y 方向に押し出して、+X 側面に配置
    translate([body_or - embed, 0, handle_z])
        rotate([90, 0, 0])
            translate([0, 0, -handle_w / 2])
                linear_extrude(height = handle_w)
                    handle_profile();
}

// ===== 合体 =====
module mug() {
    union() {
        body();
        // 本体内部にはみ出さないよう、外形でクリップ
        difference() {
            handle();
            // マグ内部の中空部分を侵さない
            translate([0, 0, bottom_t])
                cylinder(h = body_h - bottom_t + 1, r = body_ir);
        }
    }
}

mug();
adaptive (default) success →
adaptive
104.2s · 343/8548t · $0.2154
SCAD (71 lines)
// =========================================================
//  マグカップ(取手は +X 方向のみ / D 字取手)
//    - 外径 80 / 内径 70(肉厚 5)/ 高さ 90 / 底厚 6
//    - 取手内側の空間:高さ 30 × 幅 25
// =========================================================

$fa = 2;
$fs = 0.5;

/* ---------------- パラメータ ---------------- */
mug_od   = 80;   // 本体外径
mug_id   = 70;   // 本体内径(肉厚 5mm)
mug_h    = 90;   // 本体高さ
bottom_t = 6;    // 底面の厚み

hole_h   = 30;   // 取手内側の空間:高さ(Z)
hole_w   = 25;   // 取手内側の空間:幅(X)
grip_t   = 10;   // 取手の太さ(XZ 面内)
grip_w   = 12;   // 取手の幅(Y 方向)
embed    = 4;    // 本体壁への食い込み量(union を確実にする)

mug_or = mug_od / 2;   // 40
mug_ir = mug_id / 2;   // 35

/* ---------------- 本体 ---------------- */
module mug_body() {
    difference() {
        cylinder(h = mug_h, r = mug_or);
        // 内側の中空(底厚 6mm を残し、上面は開口)
        translate([0, 0, bottom_t])
            cylinder(h = mug_h - bottom_t + 1, r = mug_ir);
    }
}

/* ---- 取手の内側空間(D 字の穴):本体側が直線、外側が半円 ---- */
module hole_2d() {
    r  = hole_h / 2;              // 15
    x0 = mug_or;                  // 本体外周から開始(幅 25 を確保)
    cx = x0 + hole_w - r;         // 半円の中心 X
    hull() {
        translate([x0, -r]) square([cx - x0, hole_h]);
        translate([cx, 0])  circle(r = r);
    }
}

/* ---- 取手の 2D 断面(外側=半円、本体側=直線) ---- */
module handle_2d() {
    intersection() {
        difference() {
            offset(r = grip_t) hole_2d();   // 外形(オフセットで外側が半円状)
            hole_2d();                      // 指を入れる空間
        }
        // 本体側は直線でカット(x = mug_or - embed で壁に食い込ませる)
        translate([mug_or - embed, -mug_h])
            square([mug_h * 2, mug_h * 2]);
    }
}

/* ---------------- 取手(3D:XZ 平面のループ / 厚みは Y 方向) ---------------- */
module handle() {
    translate([0, 0, mug_h / 2])            // 高さ方向の中央
        rotate([90, 0, 0])                  // 2D 断面を XZ 平面へ
            linear_extrude(height = grip_w, center = true, convexity = 10)
                handle_2d();
}

/* ---------------- 合体(マニフォールド) ---------------- */
union() {
    mug_body();
    handle();      // +X 側のみ
}
dynamicnot run
—