vibe-openscad

tier-2-offset-handle-mug / gpt-5.4-mini-2026-03-17

7 run / 累計 138.6s / 累計 $0.0561

openai gpt 5.4 mini 2026-03-17 bare

bare (provider default effort)

run detail →
render
bare render of tier-2-offset-handle-mug
loading STL…
success 3.2s · 273/369t · $0.0012
SCAD (50 lines)
$fn = 128;

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

handle_clear_w = 25;
handle_clear_h = 30;
handle_depth = 18;
handle_wall = 5;

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

module handle_solid() {
    // D-shaped solid, open toward the mug body (-X side of the handle)
    translate([outer_d/2, 0, height/2])
    rotate([0, 90, 0])
    linear_extrude(height = handle_depth)
    difference() {
        // outer profile: rectangle + semicircle on the outside
        union() {
            translate([0, - (handle_clear_h/2 + handle_wall)])
                square([handle_wall, handle_clear_h + 2*handle_wall], center = false);
            translate([handle_wall, 0])
                circle(r = (handle_clear_h/2 + handle_wall));
        }

        // inner void: rectangle + semicircle
        union() {
            translate([0, -handle_clear_h/2])
                square([handle_wall + 0.2, handle_clear_h], center = false);
            translate([handle_wall, 0])
                circle(r = handle_clear_h/2);
        }
    }
}

union() {
    mug_body();
    // Slight overlap into the body to guarantee manifold union
    translate([0.5, 0, 0])
        handle_solid();
}
パラメータ (8)
スライダを動かすと openscad-wasm で再レンダリング

prompt

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

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

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

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

variant: effort

low success
low
14.6s · 273/1725t · $0.0053
SCAD (52 lines)
$fn = 128;

module mug_body() {
    difference() {
        cylinder(h = 90, d = 80);
        translate([0, 0, 6])
            cylinder(h = 90 - 6 + 0.2, d = 70);
    }
}

module handle_2d() {
    // D-shaped profile in the X-Z plane:
    // flat side on the body, semicircle on the outside.
    outer_w = 35;
    outer_h = 40;
    inner_w = 25;
    inner_h = 30;
    cx = 57.5;
    cz = 45;

    difference() {
        union() {
            translate([40, cz - outer_h / 2])
                square([outer_w / 2, outer_h], center = false);
            translate([cx, cz])
                circle(r = outer_h / 2);
        }
        union() {
            translate([45, cz - inner_h / 2])
                square([inner_w / 2, inner_h], center = false);
            translate([cx, cz])
                circle(r = inner_h / 2);
        }
    }
}

module handle() {
    // Extrude along Y to give the handle thickness.
    // Slight overlap into the mug body ensures a robust union.
    linear_extrude(height = 16, center = true, convexity = 10)
        handle_2d();
}

union() {
    mug_body();

    // Small bridge to guarantee a solid manifold connection on the +X side.
    translate([38.5, -8, 26])
        cube([8.0, 16, 38], center = false);

    handle();
}
medium (default) success
medium
3.2s · 273/369t · $0.0012
SCAD (50 lines)
$fn = 128;

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

handle_clear_w = 25;
handle_clear_h = 30;
handle_depth = 18;
handle_wall = 5;

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

module handle_solid() {
    // D-shaped solid, open toward the mug body (-X side of the handle)
    translate([outer_d/2, 0, height/2])
    rotate([0, 90, 0])
    linear_extrude(height = handle_depth)
    difference() {
        // outer profile: rectangle + semicircle on the outside
        union() {
            translate([0, - (handle_clear_h/2 + handle_wall)])
                square([handle_wall, handle_clear_h + 2*handle_wall], center = false);
            translate([handle_wall, 0])
                circle(r = (handle_clear_h/2 + handle_wall));
        }

        // inner void: rectangle + semicircle
        union() {
            translate([0, -handle_clear_h/2])
                square([handle_wall + 0.2, handle_clear_h], center = false);
            translate([handle_wall, 0])
                circle(r = handle_clear_h/2);
        }
    }
}

union() {
    mug_body();
    // Slight overlap into the body to guarantee manifold union
    translate([0.5, 0, 0])
        handle_solid();
}
high success
high
104.7s · 273/14351t · $0.0432
SCAD (49 lines)
$fn = 96;

mug_h = 90;
body_od = 80;
body_id = 70;
base_th = 6;

handle_open_h = 30;
handle_open_w = 25;
handle_wall   = 5;

handle_outer_h = handle_open_h + 2 * handle_wall;
handle_outer_w = handle_open_w + 2 * handle_wall;

handle_depth = 18;
handle_x = body_od / 2 - 2;
handle_z = mug_h / 2;

module dshape(w, h) {
    r = h / 2;
    union() {
        translate([0, -r]) square([w - r, h], center = false);
        translate([w - r, 0]) circle(r = r);
    }
}

module body() {
    difference() {
        cylinder(h = mug_h, d = body_od);
        translate([0, 0, base_th])
            cylinder(h = mug_h - base_th + 2, d = body_id);
    }
}

module handle() {
    rotate([90, 0, 0])
        linear_extrude(height = handle_depth, center = true, convexity = 10)
            difference() {
                translate([handle_x, handle_z])
                    dshape(handle_outer_w, handle_outer_h);
                translate([handle_x + handle_wall, handle_z])
                    dshape(handle_open_w, handle_open_h);
            }
}

union() {
    body();
    handle();
}
maxnot run
xhighnot run

iteration: iter-png

i1 success
iter 1
6.0s · 1307/397t · $0.0017
diff vs bare: +11/-8
  $fn = 128;
  
  outer_d = 80;
  inner_d = 70;
  height = 90;
  bottom_thickness = 6;
  
  handle_clear_w = 25;
  handle_clear_h = 30;
- handle_depth = 18;
  handle_wall = 5;
+ handle_depth = 18;
  
  module mug_body() {
      difference() {
          cylinder(h = height, d = outer_d);
          translate([0, 0, bottom_thickness])
              cylinder(h = height - bottom_thickness + 0.1, d = inner_d);
      }
  }
  
  module handle_solid() {
-     // D-shaped solid, open toward the mug body (-X side of the handle)
-     translate([outer_d/2, 0, height/2])
+     // D-shaped handle opening toward the mug body (-X side)
+     // Built so the flat side can overlap the mug outer wall.
+     translate([outer_d/2 - 0.8, 0, height/2 - handle_clear_h/2])
      rotate([0, 90, 0])
      linear_extrude(height = handle_depth)
      difference() {
-         // outer profile: rectangle + semicircle on the outside
+         // outer profile
          union() {
-             translate([0, - (handle_clear_h/2 + handle_wall)])
+             translate([0, -(handle_clear_h/2 + handle_wall)])
                  square([handle_wall, handle_clear_h + 2*handle_wall], center = false);
              translate([handle_wall, 0])
-                 circle(r = (handle_clear_h/2 + handle_wall));
+                 circle(r = handle_clear_h/2 + handle_wall);
          }
  
-         // inner void: rectangle + semicircle
+         // inner void
          union() {
              translate([0, -handle_clear_h/2])
                  square([handle_wall + 0.2, handle_clear_h], center = false);
              translate([handle_wall, 0])
                  circle(r = handle_clear_h/2);
          }
      }
  }
  
  union() {
      mug_body();
-     // Slight overlap into the body to guarantee manifold union
+ 
+     // Place the handle at the mid-height and attach only on +X side
+     // Slight overlap ensures a manifold union without gaps.
      translate([0.5, 0, 0])
          handle_solid();
  }
SCAD (53 lines)
$fn = 128;

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

handle_clear_w = 25;
handle_clear_h = 30;
handle_wall = 5;
handle_depth = 18;

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

module handle_solid() {
    // D-shaped handle opening toward the mug body (-X side)
    // Built so the flat side can overlap the mug outer wall.
    translate([outer_d/2 - 0.8, 0, height/2 - handle_clear_h/2])
    rotate([0, 90, 0])
    linear_extrude(height = handle_depth)
    difference() {
        // outer profile
        union() {
            translate([0, -(handle_clear_h/2 + handle_wall)])
                square([handle_wall, handle_clear_h + 2*handle_wall], center = false);
            translate([handle_wall, 0])
                circle(r = handle_clear_h/2 + handle_wall);
        }

        // inner void
        union() {
            translate([0, -handle_clear_h/2])
                square([handle_wall + 0.2, handle_clear_h], center = false);
            translate([handle_wall, 0])
                circle(r = handle_clear_h/2);
        }
    }
}

union() {
    mug_body();

    // Place the handle at the mid-height and attach only on +X side
    // Slight overlap ensures a manifold union without gaps.
    translate([0.5, 0, 0])
        handle_solid();
}
i2 success
iter 2
3.2s · 1329/403t · $0.0017
diff vs i1: +22/-23
  $fn = 128;
  
  outer_d = 80;
  inner_d = 70;
  height = 90;
  bottom_thickness = 6;
  
  handle_clear_w = 25;
  handle_clear_h = 30;
  handle_wall = 5;
  handle_depth = 18;
  
  module mug_body() {
      difference() {
          cylinder(h = height, d = outer_d);
          translate([0, 0, bottom_thickness])
              cylinder(h = height - bottom_thickness + 0.1, d = inner_d);
      }
  }
  
  module handle_solid() {
-     // D-shaped handle opening toward the mug body (-X side)
-     // Built so the flat side can overlap the mug outer wall.
-     translate([outer_d/2 - 0.8, 0, height/2 - handle_clear_h/2])
-     rotate([0, 90, 0])
-     linear_extrude(height = handle_depth)
-     difference() {
-         // outer profile
-         union() {
-             translate([0, -(handle_clear_h/2 + handle_wall)])
-                 square([handle_wall, handle_clear_h + 2*handle_wall], center = false);
-             translate([handle_wall, 0])
-                 circle(r = handle_clear_h/2 + handle_wall);
-         }
+     // D-shaped handle with the flat side facing the mug body
+     // Built in YZ cross-section and extruded along +X
+     translate([outer_d/2 - 1.0, 0, height/2 - handle_clear_h/2])
+         rotate([0, 90, 0])
+         linear_extrude(height = handle_depth)
+         difference() {
+             // outer profile: rectangle on body side + semicircle outward
+             union() {
+                 translate([0, -(handle_clear_h/2 + handle_wall)])
+                     square([handle_wall, handle_clear_h + 2*handle_wall], center = false);
+                 translate([handle_wall, 0])
+                     circle(r = handle_clear_h/2 + handle_wall);
+             }
  
-         // inner void
-         union() {
-             translate([0, -handle_clear_h/2])
-                 square([handle_wall + 0.2, handle_clear_h], center = false);
-             translate([handle_wall, 0])
-                 circle(r = handle_clear_h/2);
+             // inner void: 25mm wide x 30mm high
+             union() {
+                 translate([0, -handle_clear_h/2])
+                     square([handle_wall + 0.2, handle_clear_h], center = false);
+                 translate([handle_wall, 0])
+                     circle(r = handle_clear_h/2);
+             }
          }
-     }
  }
  
  union() {
      mug_body();
  
-     // Place the handle at the mid-height and attach only on +X side
-     // Slight overlap ensures a manifold union without gaps.
-     translate([0.5, 0, 0])
+     // Attach handle only on the +X side, centered vertically
+     translate([0.6, 0, 0])
          handle_solid();
  }
SCAD (52 lines)
$fn = 128;

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

handle_clear_w = 25;
handle_clear_h = 30;
handle_wall = 5;
handle_depth = 18;

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

module handle_solid() {
    // D-shaped handle with the flat side facing the mug body
    // Built in YZ cross-section and extruded along +X
    translate([outer_d/2 - 1.0, 0, height/2 - handle_clear_h/2])
        rotate([0, 90, 0])
        linear_extrude(height = handle_depth)
        difference() {
            // outer profile: rectangle on body side + semicircle outward
            union() {
                translate([0, -(handle_clear_h/2 + handle_wall)])
                    square([handle_wall, handle_clear_h + 2*handle_wall], center = false);
                translate([handle_wall, 0])
                    circle(r = handle_clear_h/2 + handle_wall);
            }

            // inner void: 25mm wide x 30mm high
            union() {
                translate([0, -handle_clear_h/2])
                    square([handle_wall + 0.2, handle_clear_h], center = false);
                translate([handle_wall, 0])
                    circle(r = handle_clear_h/2);
            }
        }
}

union() {
    mug_body();

    // Attach handle only on the +X side, centered vertically
    translate([0.6, 0, 0])
        handle_solid();
}
i3 success
iter 3
3.8s · 1335/412t · $0.0018
diff vs i2: +9/-9
  $fn = 128;
  
  outer_d = 80;
  inner_d = 70;
  height = 90;
  bottom_thickness = 6;
  
  handle_clear_w = 25;
  handle_clear_h = 30;
  handle_wall = 5;
- handle_depth = 18;
+ handle_depth = 22;          // radial extent from body toward outside
+ handle_embed = 3;           // overlap into body for robust union
  
  module mug_body() {
      difference() {
          cylinder(h = height, d = outer_d);
          translate([0, 0, bottom_thickness])
              cylinder(h = height - bottom_thickness + 0.1, d = inner_d);
      }
  }
  
  module handle_solid() {
-     // D-shaped handle with the flat side facing the mug body
-     // Built in YZ cross-section and extruded along +X
-     translate([outer_d/2 - 1.0, 0, height/2 - handle_clear_h/2])
+     // Create a D-shaped cross section in the YZ plane and extrude along +X.
+     // Flat side is toward the mug body, curved side outward.
+     translate([outer_d/2 - handle_embed, 0, height/2 - handle_clear_h/2])
          rotate([0, 90, 0])
          linear_extrude(height = handle_depth)
          difference() {
-             // outer profile: rectangle on body side + semicircle outward
              union() {
+                 // Outer boundary: flat-backed rectangle + semicircle
                  translate([0, -(handle_clear_h/2 + handle_wall)])
                      square([handle_wall, handle_clear_h + 2*handle_wall], center = false);
                  translate([handle_wall, 0])
                      circle(r = handle_clear_h/2 + handle_wall);
              }
  
-             // inner void: 25mm wide x 30mm high
+             // Inner void: 25mm wide x 30mm high
              union() {
                  translate([0, -handle_clear_h/2])
                      square([handle_wall + 0.2, handle_clear_h], center = false);
                  translate([handle_wall, 0])
                      circle(r = handle_clear_h/2);
              }
          }
  }
  
  union() {
      mug_body();
  
-     // Attach handle only on the +X side, centered vertically
-     translate([0.6, 0, 0])
-         handle_solid();
+     // Handle only on the +X side, centered vertically, with guaranteed overlap
+     handle_solid();
  }
SCAD (52 lines)
$fn = 128;

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

handle_clear_w = 25;
handle_clear_h = 30;
handle_wall = 5;
handle_depth = 22;          // radial extent from body toward outside
handle_embed = 3;           // overlap into body for robust union

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

module handle_solid() {
    // Create a D-shaped cross section in the YZ plane and extrude along +X.
    // Flat side is toward the mug body, curved side outward.
    translate([outer_d/2 - handle_embed, 0, height/2 - handle_clear_h/2])
        rotate([0, 90, 0])
        linear_extrude(height = handle_depth)
        difference() {
            union() {
                // Outer boundary: flat-backed rectangle + semicircle
                translate([0, -(handle_clear_h/2 + handle_wall)])
                    square([handle_wall, handle_clear_h + 2*handle_wall], center = false);
                translate([handle_wall, 0])
                    circle(r = handle_clear_h/2 + handle_wall);
            }

            // Inner void: 25mm wide x 30mm high
            union() {
                translate([0, -handle_clear_h/2])
                    square([handle_wall + 0.2, handle_clear_h], center = false);
                translate([handle_wall, 0])
                    circle(r = handle_clear_h/2);
            }
        }
}

union() {
    mug_body();

    // Handle only on the +X side, centered vertically, with guaranteed overlap
    handle_solid();
}