vibe-openscad

tier-2-offset-handle-mug / o4-mini-2025-04-16

7 run / 累計 548.9s / 累計 $0.2482

openai o4 mini 2025-04-16 bare

bare (provider default effort)

run detail →
render
bare render of tier-2-offset-handle-mug
loading STL…
success 74.8s · 273/6550t · $0.0291
SCAD (33 lines)
// mug with specified handle on +X side
outer_d = 80;
inner_d = 70;
height = 90;
bottom_thickness = 6;
opening_width = 25;
opening_height = 30;
handle_thickness = 15;
$fn = 100;

union() {
  // mug body
  difference() {
    cylinder(d = outer_d, h = height);
    translate([0, 0, bottom_thickness])
      cylinder(d = inner_d, h = height - bottom_thickness);
  }
  // handle
  translate([0, 0, height/2 - opening_height/2])
    linear_extrude(height = opening_height)
      union() {
        // flat side of D
        translate([outer_d/2 + opening_width, -handle_thickness])
          square([handle_thickness, 2*handle_thickness]);
        // semicircular outer side
        intersection() {
          translate([outer_d/2 + opening_width + handle_thickness, 0])
            circle(r = handle_thickness);
          translate([outer_d/2 + opening_width + handle_thickness/2, 0])
            square([handle_thickness, 2*handle_thickness], center = true);
        }
      }
}
パラメータ (7)
スライダを動かすと openscad-wasm で再レンダリング

prompt

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

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

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

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

variant: effort

low success
low
21.0s · 273/2089t · $0.0095
SCAD (35 lines)
// マグカップ本体とハンドル
$fn = 100;

// パラメータ
outer_d = 80;
inner_d = 70;
height_body = 90;
thickness_bottom = 6;
handle_gap_w = 25;    // 指入れ幅
handle_gap_h = 30;    // 指入れ高さ
handle_th = 8;        // 取手肉厚
handle_zpos = (height_body - handle_gap_h) / 2;  // 取手の底面Z位置
handle_center_x = outer_d/2 + handle_gap_w + handle_th; // 半円中心X

union() {
  // 本体外側
  cylinder(d = outer_d, h = height_body);
  // 飲み物入る中空部 (底厚みを残して上部をくり抜き)
  translate([0, 0, thickness_bottom])
    cylinder(d = inner_d, h = height_body - thickness_bottom);

  // 取手(D字形、Z方向に厚みを持たせる)
  translate([0, 0, handle_zpos]) rotate([0, 0, 90])  // Z方向が高さ
    linear_extrude(height = handle_th) {
      // 2次元断面:半円と角矩形の交差でD字型
      intersection() {
        // 外側半円
        translate([handle_center_x, 0])
          circle(r = handle_th, $fn = 100);
        // 高さ制限
        translate([handle_center_x-handle_th, -handle_gap_h/2])
          square([handle_th*2, handle_gap_h]);
      }
    }
}
medium (default) success
medium
74.8s · 273/6550t · $0.0291
SCAD (33 lines)
// mug with specified handle on +X side
outer_d = 80;
inner_d = 70;
height = 90;
bottom_thickness = 6;
opening_width = 25;
opening_height = 30;
handle_thickness = 15;
$fn = 100;

union() {
  // mug body
  difference() {
    cylinder(d = outer_d, h = height);
    translate([0, 0, bottom_thickness])
      cylinder(d = inner_d, h = height - bottom_thickness);
  }
  // handle
  translate([0, 0, height/2 - opening_height/2])
    linear_extrude(height = opening_height)
      union() {
        // flat side of D
        translate([outer_d/2 + opening_width, -handle_thickness])
          square([handle_thickness, 2*handle_thickness]);
        // semicircular outer side
        intersection() {
          translate([outer_d/2 + opening_width + handle_thickness, 0])
            circle(r = handle_thickness);
          translate([outer_d/2 + opening_width + handle_thickness/2, 0])
            square([handle_thickness, 2*handle_thickness], center = true);
        }
      }
}
high success
high
172.0s · 273/22253t · $0.0982
SCAD (58 lines)
// mug 本体パラメータ
outer_d = 80;
inner_d = 70;
height = 90;
bottom_t = 6;

// 取手パラメータ
handle_open_h = 30;    // 空間 高さ
handle_open_w = 25;    // 空間 幅
handle_wall   = 5;     // 取手肉厚
handle_depth  = 20;    // 取手奥行

// 計算
wall_t   = (outer_d - inner_d)/2;  // マグ肉厚 5
R_i      = handle_open_h/2;
rect_i   = handle_open_w - R_i;
T        = handle_wall;
R_o      = R_i + T;
rect_o   = rect_i + T;

// D字形状モジュール(半円+直線)
module D_shape(r, rect_w) {
  union() {
    translate([0, -r]) square([rect_w, 2*r]);
    difference() {
      translate([rect_w, 0]) circle(r = r, $fn = 64);
      translate([-1000, -1000]) square([rect_w + 1000, 2000]);
    }
  }
}
// D字リング(外側D−内側D)
module D_ring() {
  difference() {
    D_shape(R_o, rect_o);
    translate([T, 0]) D_shape(R_i, rect_i);
  }
}
// 取手形状
module handle() {
  rotate([90, 0, 0])
    linear_extrude(height = handle_depth, center = true)
      D_ring();
}
// マグ本体
module mug() {
  difference() {
    cylinder(r = outer_d/2, h = height, $fn = 100);
    translate([0, 0, bottom_t])
      cylinder(r = inner_d/2, h = height - bottom_t, $fn = 100);
  }
}

// 結合
union() {
  mug();
  translate([outer_d/2, 0, height/2])
    handle();
}
maxnot run
xhighnot run

iteration: iter-png

i1 success
iter 1
101.6s · 1457/8186t · $0.0376
diff vs bare: +46/-29
- // mug with specified handle on +X side
- outer_d = 80;
- inner_d = 70;
- height = 90;
- bottom_thickness = 6;
- opening_width = 25;
- opening_height = 30;
- handle_thickness = 15;
- $fn = 100;
+ // mug with D‐shaped handle on +X side
+ outer_d        = 80;   // outer diameter of mug
+ inner_d        = 70;   // inner diameter of mug
+ height         = 90;   // total mug height
+ bottom_thick   = 6;    // bottom thickness
+ open_w         = 25;   // finger‐hole width
+ open_h         = 30;   // finger‐hole height
+ h_thick        = 15;   // handle wall thickness (radius of outer arc)
+ $fn            = 100;  // resolution
  
- union() {
-   // mug body
+ module mug() {
    difference() {
-     cylinder(d = outer_d, h = height);
-     translate([0, 0, bottom_thickness])
-       cylinder(d = inner_d, h = height - bottom_thickness);
+     // outer shell
+     cylinder(d = outer_d, h = height, $fn = $fn);
+     // hollow interior
+     translate([0,0,bottom_thick])
+       cylinder(d = inner_d, h = height - bottom_thick, $fn = $fn);
    }
-   // handle
-   translate([0, 0, height/2 - opening_height/2])
-     linear_extrude(height = opening_height)
-       union() {
-         // flat side of D
-         translate([outer_d/2 + opening_width, -handle_thickness])
-           square([handle_thickness, 2*handle_thickness]);
-         // semicircular outer side
-         intersection() {
-           translate([outer_d/2 + opening_width + handle_thickness, 0])
-             circle(r = handle_thickness);
-           translate([outer_d/2 + opening_width + handle_thickness/2, 0])
-             square([handle_thickness, 2*handle_thickness], center = true);
-         }
-       }
+ }
+ 
+ module handle2d() {
+   // 2D profile of the D‐shape (in the X–Y plane)
+   inner_x      = outer_d/2;           // flat‐face at mug outer
+   arc_cx       = inner_x + open_w;    // center of semicircle
+   union() {
+     // rectangular segment from flat face to start of arc
+     translate([inner_x, -h_thick])
+       square([open_w, 2*h_thick], center = false);
+     // outer semicircle (right half of a full circle)
+     intersection() {
+       translate([arc_cx, 0])
+         circle(r = h_thick, $fn = $fn);
+       // clip to x >= arc_cx (to keep only the right half)
+       translate([arc_cx, -100])
+         square([h_thick, 200], center = false);
+     }
+   }
+ }
+ 
+ module handle() {
+   // place handle at mid‐height, extrude the 2D D‐profile by open_h
+   translate([0, 0, height/2 - open_h/2])
+     linear_extrude(height = open_h)
+       handle2d();
+ }
+ 
+ union() {
+   mug();
+   handle();
  }
SCAD (50 lines)
// mug with D‐shaped handle on +X side
outer_d        = 80;   // outer diameter of mug
inner_d        = 70;   // inner diameter of mug
height         = 90;   // total mug height
bottom_thick   = 6;    // bottom thickness
open_w         = 25;   // finger‐hole width
open_h         = 30;   // finger‐hole height
h_thick        = 15;   // handle wall thickness (radius of outer arc)
$fn            = 100;  // resolution

module mug() {
  difference() {
    // outer shell
    cylinder(d = outer_d, h = height, $fn = $fn);
    // hollow interior
    translate([0,0,bottom_thick])
      cylinder(d = inner_d, h = height - bottom_thick, $fn = $fn);
  }
}

module handle2d() {
  // 2D profile of the D‐shape (in the X–Y plane)
  inner_x      = outer_d/2;           // flat‐face at mug outer
  arc_cx       = inner_x + open_w;    // center of semicircle
  union() {
    // rectangular segment from flat face to start of arc
    translate([inner_x, -h_thick])
      square([open_w, 2*h_thick], center = false);
    // outer semicircle (right half of a full circle)
    intersection() {
      translate([arc_cx, 0])
        circle(r = h_thick, $fn = $fn);
      // clip to x >= arc_cx (to keep only the right half)
      translate([arc_cx, -100])
        square([h_thick, 200], center = false);
    }
  }
}

module handle() {
  // place handle at mid‐height, extrude the 2D D‐profile by open_h
  translate([0, 0, height/2 - open_h/2])
    linear_extrude(height = open_h)
      handle2d();
}

union() {
  mug();
  handle();
}
i2 success
iter 2
60.0s · 1650/5157t · $0.0245
diff vs i1: +2/-2
  // mug with D‐shaped handle on +X side
  outer_d        = 80;   // outer diameter of mug
  inner_d        = 70;   // inner diameter of mug
  height         = 90;   // total mug height
  bottom_thick   = 6;    // bottom thickness
  open_w         = 25;   // finger‐hole width
  open_h         = 30;   // finger‐hole height
- h_thick        = 15;   // handle wall thickness (radius of outer arc)
+ h_thick        = open_h/2;  // half the hole height for D‐shape radius
  $fn            = 100;  // resolution
  
  module mug() {
    difference() {
      // outer shell
      cylinder(d = outer_d, h = height, $fn = $fn);
      // hollow interior
-     translate([0,0,bottom_thick])
+     translate([0, 0, bottom_thick])
        cylinder(d = inner_d, h = height - bottom_thick, $fn = $fn);
    }
  }
  
  module handle2d() {
    // 2D profile of the D‐shape (in the X–Y plane)
    inner_x      = outer_d/2;           // flat‐face at mug outer
    arc_cx       = inner_x + open_w;    // center of semicircle
    union() {
      // rectangular segment from flat face to start of arc
      translate([inner_x, -h_thick])
        square([open_w, 2*h_thick], center = false);
      // outer semicircle (right half of a full circle)
      intersection() {
        translate([arc_cx, 0])
          circle(r = h_thick, $fn = $fn);
        // clip to x >= arc_cx (to keep only the right half)
        translate([arc_cx, -100])
          square([h_thick, 200], center = false);
      }
    }
  }
  
  module handle() {
    // place handle at mid‐height, extrude the 2D D‐profile by open_h
    translate([0, 0, height/2 - open_h/2])
      linear_extrude(height = open_h)
        handle2d();
  }
  
  union() {
    mug();
    handle();
  }
SCAD (50 lines)
// mug with D‐shaped handle on +X side
outer_d        = 80;   // outer diameter of mug
inner_d        = 70;   // inner diameter of mug
height         = 90;   // total mug height
bottom_thick   = 6;    // bottom thickness
open_w         = 25;   // finger‐hole width
open_h         = 30;   // finger‐hole height
h_thick        = open_h/2;  // half the hole height for D‐shape radius
$fn            = 100;  // resolution

module mug() {
  difference() {
    // outer shell
    cylinder(d = outer_d, h = height, $fn = $fn);
    // hollow interior
    translate([0, 0, bottom_thick])
      cylinder(d = inner_d, h = height - bottom_thick, $fn = $fn);
  }
}

module handle2d() {
  // 2D profile of the D‐shape (in the X–Y plane)
  inner_x      = outer_d/2;           // flat‐face at mug outer
  arc_cx       = inner_x + open_w;    // center of semicircle
  union() {
    // rectangular segment from flat face to start of arc
    translate([inner_x, -h_thick])
      square([open_w, 2*h_thick], center = false);
    // outer semicircle (right half of a full circle)
    intersection() {
      translate([arc_cx, 0])
        circle(r = h_thick, $fn = $fn);
      // clip to x >= arc_cx (to keep only the right half)
      translate([arc_cx, -100])
        square([h_thick, 200], center = false);
    }
  }
}

module handle() {
  // place handle at mid‐height, extrude the 2D D‐profile by open_h
  translate([0, 0, height/2 - open_h/2])
    linear_extrude(height = open_h)
      handle2d();
}

union() {
  mug();
  handle();
}
i3 success
iter 3
44.6s · 1654/4161t · $0.0201
diff vs i2: +0/-0
  // mug with D‐shaped handle on +X side
  outer_d        = 80;   // outer diameter of mug
  inner_d        = 70;   // inner diameter of mug
  height         = 90;   // total mug height
  bottom_thick   = 6;    // bottom thickness
  open_w         = 25;   // finger‐hole width
  open_h         = 30;   // finger‐hole height
  h_thick        = open_h/2;  // half the hole height for D‐shape radius
  $fn            = 100;  // resolution
  
  module mug() {
    difference() {
      // outer shell
      cylinder(d = outer_d, h = height, $fn = $fn);
      // hollow interior
      translate([0, 0, bottom_thick])
        cylinder(d = inner_d, h = height - bottom_thick, $fn = $fn);
    }
  }
  
  module handle2d() {
    // 2D profile of the D‐shape (in the X–Y plane)
    inner_x      = outer_d/2;           // flat‐face at mug outer
    arc_cx       = inner_x + open_w;    // center of semicircle
    union() {
      // rectangular segment from flat face to start of arc
      translate([inner_x, -h_thick])
        square([open_w, 2*h_thick], center = false);
      // outer semicircle (right half of a full circle)
      intersection() {
        translate([arc_cx, 0])
          circle(r = h_thick, $fn = $fn);
        // clip to x >= arc_cx (to keep only the right half)
        translate([arc_cx, -100])
          square([h_thick, 200], center = false);
      }
    }
  }
  
  module handle() {
    // place handle at mid‐height, extrude the 2D D‐profile by open_h
    translate([0, 0, height/2 - open_h/2])
      linear_extrude(height = open_h)
        handle2d();
  }
  
  union() {
    mug();
    handle();
  }
SCAD (50 lines)
// mug with D‐shaped handle on +X side
outer_d        = 80;   // outer diameter of mug
inner_d        = 70;   // inner diameter of mug
height         = 90;   // total mug height
bottom_thick   = 6;    // bottom thickness
open_w         = 25;   // finger‐hole width
open_h         = 30;   // finger‐hole height
h_thick        = open_h/2;  // half the hole height for D‐shape radius
$fn            = 100;  // resolution

module mug() {
  difference() {
    // outer shell
    cylinder(d = outer_d, h = height, $fn = $fn);
    // hollow interior
    translate([0, 0, bottom_thick])
      cylinder(d = inner_d, h = height - bottom_thick, $fn = $fn);
  }
}

module handle2d() {
  // 2D profile of the D‐shape (in the X–Y plane)
  inner_x      = outer_d/2;           // flat‐face at mug outer
  arc_cx       = inner_x + open_w;    // center of semicircle
  union() {
    // rectangular segment from flat face to start of arc
    translate([inner_x, -h_thick])
      square([open_w, 2*h_thick], center = false);
    // outer semicircle (right half of a full circle)
    intersection() {
      translate([arc_cx, 0])
        circle(r = h_thick, $fn = $fn);
      // clip to x >= arc_cx (to keep only the right half)
      translate([arc_cx, -100])
        square([h_thick, 200], center = false);
    }
  }
}

module handle() {
  // place handle at mid‐height, extrude the 2D D‐profile by open_h
  translate([0, 0, height/2 - open_h/2])
    linear_extrude(height = open_h)
      handle2d();
}

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