vibe-openscad

tier-2-offset-handle-mug / gpt-5.4-2026-03-05

7 run / 累計 165.0s / 累計 $0.1656

openai gpt 5.4 2026-03-05 bare

bare (provider default effort)

run detail →
render
bare render of tier-2-offset-handle-mug
loading STL…
success 8.2s · 273/543t · $0.0092
SCAD (66 lines)
$fn = 128;

// Mug dimensions
outer_d = 80;
inner_d = 70;
mug_h   = 90;
bottom_t = 6;

// Handle opening dimensions
handle_open_w = 25;   // radial width of finger opening
handle_open_h = 30;   // vertical height of finger opening

// Handle thickness around opening
handle_wall = 5;

// Derived
outer_r = outer_d / 2;
inner_r = inner_d / 2;

// Handle placement and size
handle_center_z = mug_h / 2;
handle_outer_h = handle_open_h + 2 * handle_wall;
handle_r = handle_outer_h / 2;                  // radius for rounded top/bottom in YZ profile
handle_straight_h = handle_open_h;              // straight section height in YZ profile

// Radial extents in X
handle_inner_x = outer_r - 1.0;                 // slight overlap into mug for manifold union
handle_outer_x = outer_r + handle_open_w + 2 * handle_wall;

// 2D D-shape in XZ plane, then extruded along Y
module d_shape_2d(x0, x1, zc, open_h) {
    r = open_h / 2;
    union() {
        translate([x0, zc - r]) square([x1 - x0 - r, open_h], center = false);
        translate([x1 - r, zc]) circle(r = r);
    }
}

module mug_body() {
    difference() {
        cylinder(h = mug_h, r = outer_r);
        translate([0, 0, bottom_t])
            cylinder(h = mug_h - bottom_t + 0.01, r = inner_r);
    }
}

module handle() {
    difference() {
        // Outer D-shape
        translate([0, -handle_r, 0])
            rotate([-90, 0, 0])
                linear_extrude(height = 2 * handle_r)
                    d_shape_2d(handle_inner_x, handle_outer_x, handle_center_z, handle_outer_h);

        // Inner opening D-shape
        translate([0, -handle_open_h/2, 0])
            rotate([-90, 0, 0])
                linear_extrude(height = handle_open_h)
                    d_shape_2d(outer_r + handle_wall, outer_r + handle_wall + handle_open_w, handle_center_z, handle_open_h);
    }
}

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

prompt

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

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

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

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

variant: effort

low success
low
27.3s · 273/1352t · $0.0222
SCAD (52 lines)
$fn = 128;

mug_outer_d = 80;
mug_inner_d = 70;
mug_h       = 90;
bottom_t    = 6;

handle_inner_h = 30;
handle_inner_w = 25;
handle_wall    = 5;
handle_thick_y = 12;

handle_outer_h = handle_inner_h + 2*handle_wall; // 40
handle_outer_w = handle_inner_w + 2*handle_wall; // 35

mug_r = mug_outer_d/2;
handle_zc = mug_h/2;
attach_overlap = 3;
handle_x = mug_r - attach_overlap;

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

module mug_body() {
    difference() {
        cylinder(h=mug_h, d=mug_outer_d);
        translate([0, 0, bottom_t])
            cylinder(h=mug_h - bottom_t + 0.01, d=mug_inner_d);
    }
}

module handle() {
    translate([handle_x, -handle_thick_y/2, handle_zc - handle_outer_h/2])
        rotate([-90, 0, 0])
            linear_extrude(height=handle_thick_y)
                difference() {
                    d2d(handle_outer_h, handle_outer_w);
                    translate([handle_wall, handle_wall])
                        d2d(handle_inner_h, handle_inner_w);
                }
}

union() {
    mug_body();
    handle();
}
medium (default) success
medium
8.2s · 273/543t · $0.0092
SCAD (66 lines)
$fn = 128;

// Mug dimensions
outer_d = 80;
inner_d = 70;
mug_h   = 90;
bottom_t = 6;

// Handle opening dimensions
handle_open_w = 25;   // radial width of finger opening
handle_open_h = 30;   // vertical height of finger opening

// Handle thickness around opening
handle_wall = 5;

// Derived
outer_r = outer_d / 2;
inner_r = inner_d / 2;

// Handle placement and size
handle_center_z = mug_h / 2;
handle_outer_h = handle_open_h + 2 * handle_wall;
handle_r = handle_outer_h / 2;                  // radius for rounded top/bottom in YZ profile
handle_straight_h = handle_open_h;              // straight section height in YZ profile

// Radial extents in X
handle_inner_x = outer_r - 1.0;                 // slight overlap into mug for manifold union
handle_outer_x = outer_r + handle_open_w + 2 * handle_wall;

// 2D D-shape in XZ plane, then extruded along Y
module d_shape_2d(x0, x1, zc, open_h) {
    r = open_h / 2;
    union() {
        translate([x0, zc - r]) square([x1 - x0 - r, open_h], center = false);
        translate([x1 - r, zc]) circle(r = r);
    }
}

module mug_body() {
    difference() {
        cylinder(h = mug_h, r = outer_r);
        translate([0, 0, bottom_t])
            cylinder(h = mug_h - bottom_t + 0.01, r = inner_r);
    }
}

module handle() {
    difference() {
        // Outer D-shape
        translate([0, -handle_r, 0])
            rotate([-90, 0, 0])
                linear_extrude(height = 2 * handle_r)
                    d_shape_2d(handle_inner_x, handle_outer_x, handle_center_z, handle_outer_h);

        // Inner opening D-shape
        translate([0, -handle_open_h/2, 0])
            rotate([-90, 0, 0])
                linear_extrude(height = handle_open_h)
                    d_shape_2d(outer_r + handle_wall, outer_r + handle_wall + handle_open_w, handle_center_z, handle_open_h);
    }
}

union() {
    mug_body();
    handle();
}
high success
high
100.4s · 273/5840t · $0.0940
SCAD (53 lines)
$fn = 128;

mug_od = 80;
mug_id = 70;
mug_h = 90;
bottom_t = 6;

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

outer_r = mug_od / 2;
inner_r = mug_id / 2;

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

handle_x = outer_r - 2.5;
handle_z = (mug_h - handle_outer_h) / 2;

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

module mug_body() {
    difference() {
        cylinder(h = mug_h, r = outer_r);
        translate([0, 0, bottom_t])
            cylinder(h = mug_h - bottom_t + 0.1, r = inner_r);
    }
}

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

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

iteration: iter-png

i1 success
iter 1
7.4s · 1481/489t · $0.0108
diff vs bare: +33/-31
  $fn = 128;
  
  // Mug dimensions
- outer_d = 80;
- inner_d = 70;
- mug_h   = 90;
- bottom_t = 6;
+ outer_d   = 80;
+ inner_d   = 70;
+ mug_h     = 90;
+ bottom_t  = 6;
  
- // Handle opening dimensions
- handle_open_w = 25;   // radial width of finger opening
- handle_open_h = 30;   // vertical height of finger opening
+ // Handle inner opening dimensions
+ handle_open_w = 25;   // width in radial (X) direction
+ handle_open_h = 30;   // height in Z direction
  
- // Handle thickness around opening
+ // Handle thickness
  handle_wall = 5;
  
- // Derived
+ // Derived mug radii
  outer_r = outer_d / 2;
  inner_r = inner_d / 2;
  
- // Handle placement and size
- handle_center_z = mug_h / 2;
+ // Handle dimensions
+ handle_outer_w = handle_open_w + handle_wall;   // D-shape total width (straight side to farthest point)
  handle_outer_h = handle_open_h + 2 * handle_wall;
- handle_r = handle_outer_h / 2;                  // radius for rounded top/bottom in YZ profile
- handle_straight_h = handle_open_h;              // straight section height in YZ profile
  
- // Radial extents in X
- handle_inner_x = outer_r - 1.0;                 // slight overlap into mug for manifold union
- handle_outer_x = outer_r + handle_open_w + 2 * handle_wall;
+ handle_inner_r = handle_open_h / 2;
+ handle_outer_r = handle_outer_h / 2;
  
- // 2D D-shape in XZ plane, then extruded along Y
- module d_shape_2d(x0, x1, zc, open_h) {
-     r = open_h / 2;
+ handle_center_z = mug_h / 2;
+ 
+ // Slight overlap into mug body to guarantee manifold union
+ attach_overlap = 1.0;
+ 
+ // 2D D-shape in XZ plane:
+ // left side is the straight attachment side, right side is the semicircular outer side
+ module d2d(x_left, z_center, total_w, total_h) {
+     r = total_h / 2;
      union() {
-         translate([x0, zc - r]) square([x1 - x0 - r, open_h], center = false);
-         translate([x1 - r, zc]) circle(r = r);
+         square_w = total_w - r;
+         translate([x_left, z_center - r])
+             square([square_w, total_h], center = false);
+         translate([x_left + square_w, z_center])
+             circle(r = r);
      }
  }
  
  module mug_body() {
      difference() {
          cylinder(h = mug_h, r = outer_r);
          translate([0, 0, bottom_t])
              cylinder(h = mug_h - bottom_t + 0.01, r = inner_r);
      }
  }
  
  module handle() {
      difference() {
-         // Outer D-shape
-         translate([0, -handle_r, 0])
-             rotate([-90, 0, 0])
-                 linear_extrude(height = 2 * handle_r)
-                     d_shape_2d(handle_inner_x, handle_outer_x, handle_center_z, handle_outer_h);
+         // Outer handle body
+         linear_extrude(height = handle_outer_h, center = true)
+             d2d(outer_r - attach_overlap, handle_center_z, handle_outer_w + attach_overlap, handle_outer_h);
  
-         // Inner opening D-shape
-         translate([0, -handle_open_h/2, 0])
-             rotate([-90, 0, 0])
-                 linear_extrude(height = handle_open_h)
-                     d_shape_2d(outer_r + handle_wall, outer_r + handle_wall + handle_open_w, handle_center_z, handle_open_h);
+         // Inner finger opening
+         linear_extrude(height = handle_open_h, center = true)
+             d2d(outer_r + handle_wall, handle_center_z, handle_open_w, handle_open_h);
      }
  }
  
  union() {
      mug_body();
      handle();
  }
SCAD (68 lines)
$fn = 128;

// Mug dimensions
outer_d   = 80;
inner_d   = 70;
mug_h     = 90;
bottom_t  = 6;

// Handle inner opening dimensions
handle_open_w = 25;   // width in radial (X) direction
handle_open_h = 30;   // height in Z direction

// Handle thickness
handle_wall = 5;

// Derived mug radii
outer_r = outer_d / 2;
inner_r = inner_d / 2;

// Handle dimensions
handle_outer_w = handle_open_w + handle_wall;   // D-shape total width (straight side to farthest point)
handle_outer_h = handle_open_h + 2 * handle_wall;

handle_inner_r = handle_open_h / 2;
handle_outer_r = handle_outer_h / 2;

handle_center_z = mug_h / 2;

// Slight overlap into mug body to guarantee manifold union
attach_overlap = 1.0;

// 2D D-shape in XZ plane:
// left side is the straight attachment side, right side is the semicircular outer side
module d2d(x_left, z_center, total_w, total_h) {
    r = total_h / 2;
    union() {
        square_w = total_w - r;
        translate([x_left, z_center - r])
            square([square_w, total_h], center = false);
        translate([x_left + square_w, z_center])
            circle(r = r);
    }
}

module mug_body() {
    difference() {
        cylinder(h = mug_h, r = outer_r);
        translate([0, 0, bottom_t])
            cylinder(h = mug_h - bottom_t + 0.01, r = inner_r);
    }
}

module handle() {
    difference() {
        // Outer handle body
        linear_extrude(height = handle_outer_h, center = true)
            d2d(outer_r - attach_overlap, handle_center_z, handle_outer_w + attach_overlap, handle_outer_h);

        // Inner finger opening
        linear_extrude(height = handle_open_h, center = true)
            d2d(outer_r + handle_wall, handle_center_z, handle_open_w, handle_open_h);
    }
}

union() {
    mug_body();
    handle();
}
i2 success
iter 2
5.8s · 1427/442t · $0.0099
diff vs i1: +22/-26
  $fn = 128;
  
  // Mug dimensions
  outer_d   = 80;
  inner_d   = 70;
  mug_h     = 90;
  bottom_t  = 6;
  
  // Handle inner opening dimensions
- handle_open_w = 25;   // width in radial (X) direction
- handle_open_h = 30;   // height in Z direction
+ handle_open_w = 25;   // radial width
+ handle_open_h = 30;   // vertical height
  
  // Handle thickness
- handle_wall = 5;
+ handle_t = 5;
  
- // Derived mug radii
+ // Derived radii
  outer_r = outer_d / 2;
  inner_r = inner_d / 2;
  
- // Handle dimensions
- handle_outer_w = handle_open_w + handle_wall;   // D-shape total width (straight side to farthest point)
- handle_outer_h = handle_open_h + 2 * handle_wall;
+ // Handle outer dimensions
+ handle_outer_w = handle_open_w + handle_t;
+ handle_outer_h = handle_open_h + 2 * handle_t;
  
- handle_inner_r = handle_open_h / 2;
- handle_outer_r = handle_outer_h / 2;
- 
+ // Placement
  handle_center_z = mug_h / 2;
- 
- // Slight overlap into mug body to guarantee manifold union
  attach_overlap = 1.0;
  
- // 2D D-shape in XZ plane:
- // left side is the straight attachment side, right side is the semicircular outer side
- module d2d(x_left, z_center, total_w, total_h) {
+ // 2D D-shape on XY plane:
+ // flat side at x = x_left, rounded side toward +X
+ module d_shape_2d(x_left, y_center, total_w, total_h) {
      r = total_h / 2;
+     rect_w = total_w - r;
      union() {
-         square_w = total_w - r;
-         translate([x_left, z_center - r])
-             square([square_w, total_h], center = false);
-         translate([x_left + square_w, z_center])
+         translate([x_left, y_center - r])
+             square([rect_w, total_h], center = false);
+         translate([x_left + rect_w, y_center])
              circle(r = r);
      }
  }
  
  module mug_body() {
      difference() {
          cylinder(h = mug_h, r = outer_r);
          translate([0, 0, bottom_t])
              cylinder(h = mug_h - bottom_t + 0.01, r = inner_r);
      }
  }
  
  module handle() {
-     difference() {
-         // Outer handle body
-         linear_extrude(height = handle_outer_h, center = true)
-             d2d(outer_r - attach_overlap, handle_center_z, handle_outer_w + attach_overlap, handle_outer_h);
+     rotate([90, 0, 0]) {
+         difference() {
+             linear_extrude(height = handle_t, center = true)
+                 d_shape_2d(outer_r - attach_overlap, handle_center_z, handle_outer_w + attach_overlap, handle_outer_h);
  
-         // Inner finger opening
-         linear_extrude(height = handle_open_h, center = true)
-             d2d(outer_r + handle_wall, handle_center_z, handle_open_w, handle_open_h);
+             linear_extrude(height = handle_t + 2, center = true)
+                 d_shape_2d(outer_r + handle_t, handle_center_z, handle_open_w, handle_open_h);
+         }
      }
  }
  
  union() {
      mug_body();
      handle();
  }
SCAD (64 lines)
$fn = 128;

// Mug dimensions
outer_d   = 80;
inner_d   = 70;
mug_h     = 90;
bottom_t  = 6;

// Handle inner opening dimensions
handle_open_w = 25;   // radial width
handle_open_h = 30;   // vertical height

// Handle thickness
handle_t = 5;

// Derived radii
outer_r = outer_d / 2;
inner_r = inner_d / 2;

// Handle outer dimensions
handle_outer_w = handle_open_w + handle_t;
handle_outer_h = handle_open_h + 2 * handle_t;

// Placement
handle_center_z = mug_h / 2;
attach_overlap = 1.0;

// 2D D-shape on XY plane:
// flat side at x = x_left, rounded side toward +X
module d_shape_2d(x_left, y_center, total_w, total_h) {
    r = total_h / 2;
    rect_w = total_w - r;
    union() {
        translate([x_left, y_center - r])
            square([rect_w, total_h], center = false);
        translate([x_left + rect_w, y_center])
            circle(r = r);
    }
}

module mug_body() {
    difference() {
        cylinder(h = mug_h, r = outer_r);
        translate([0, 0, bottom_t])
            cylinder(h = mug_h - bottom_t + 0.01, r = inner_r);
    }
}

module handle() {
    rotate([90, 0, 0]) {
        difference() {
            linear_extrude(height = handle_t, center = true)
                d_shape_2d(outer_r - attach_overlap, handle_center_z, handle_outer_w + attach_overlap, handle_outer_h);

            linear_extrude(height = handle_t + 2, center = true)
                d_shape_2d(outer_r + handle_t, handle_center_z, handle_open_w, handle_open_h);
        }
    }
}

union() {
    mug_body();
    handle();
}
i3 success
iter 3
7.8s · 1380/467t · $0.0102
diff vs i2: +21/-23
  $fn = 128;
  
  // Mug dimensions
  outer_d   = 80;
  inner_d   = 70;
  mug_h     = 90;
  bottom_t  = 6;
  
- // Handle inner opening dimensions
- handle_open_w = 25;   // radial width
- handle_open_h = 30;   // vertical height
+ // Handle opening (clear space)
+ handle_open_w = 25;   // width in radial direction
+ handle_open_h = 30;   // height in Z direction
  
- // Handle thickness
- handle_t = 5;
+ // Handle thickness / depth
+ handle_t = 5;         // band thickness and Y extrusion thickness
  
- // Derived radii
+ // Derived
  outer_r = outer_d / 2;
  inner_r = inner_d / 2;
  
- // Handle outer dimensions
- handle_outer_w = handle_open_w + handle_t;
- handle_outer_h = handle_open_h + 2 * handle_t;
- 
- // Placement
+ handle_outer_h = handle_open_h + 2 * handle_t;   // 40
+ handle_outer_w = handle_open_w + handle_t;       // 30
  handle_center_z = mug_h / 2;
- attach_overlap = 1.0;
  
- // 2D D-shape on XY plane:
- // flat side at x = x_left, rounded side toward +X
- module d_shape_2d(x_left, y_center, total_w, total_h) {
+ // 2D D-shape with flat side on the left, round side on the right
+ module d_shape_2d(total_w, total_h) {
      r = total_h / 2;
      rect_w = total_w - r;
      union() {
-         translate([x_left, y_center - r])
+         translate([0, -r])
              square([rect_w, total_h], center = false);
-         translate([x_left + rect_w, y_center])
+         translate([rect_w, 0])
              circle(r = r);
      }
  }
  
  module mug_body() {
      difference() {
          cylinder(h = mug_h, r = outer_r);
          translate([0, 0, bottom_t])
              cylinder(h = mug_h - bottom_t + 0.01, r = inner_r);
      }
  }
  
  module handle() {
-     rotate([90, 0, 0]) {
-         difference() {
-             linear_extrude(height = handle_t, center = true)
-                 d_shape_2d(outer_r - attach_overlap, handle_center_z, handle_outer_w + attach_overlap, handle_outer_h);
+     // Put the D shape in XZ plane and extrude along Y.
+     // Flat side intersects the mug body to guarantee a solid manifold union.
+     translate([outer_r - handle_t, 0, handle_center_z])
+     rotate([90, 0, 0])
+     difference() {
+         linear_extrude(height = handle_t, center = true)
+             d_shape_2d(handle_outer_w, handle_outer_h);
  
+         translate([handle_t, 0, 0])
              linear_extrude(height = handle_t + 2, center = true)
-                 d_shape_2d(outer_r + handle_t, handle_center_z, handle_open_w, handle_open_h);
-         }
+                 d_shape_2d(handle_open_w, handle_open_h);
      }
  }
  
  union() {
      mug_body();
      handle();
  }
SCAD (62 lines)
$fn = 128;

// Mug dimensions
outer_d   = 80;
inner_d   = 70;
mug_h     = 90;
bottom_t  = 6;

// Handle opening (clear space)
handle_open_w = 25;   // width in radial direction
handle_open_h = 30;   // height in Z direction

// Handle thickness / depth
handle_t = 5;         // band thickness and Y extrusion thickness

// Derived
outer_r = outer_d / 2;
inner_r = inner_d / 2;

handle_outer_h = handle_open_h + 2 * handle_t;   // 40
handle_outer_w = handle_open_w + handle_t;       // 30
handle_center_z = mug_h / 2;

// 2D D-shape with flat side on the left, round side on the right
module d_shape_2d(total_w, total_h) {
    r = total_h / 2;
    rect_w = total_w - r;
    union() {
        translate([0, -r])
            square([rect_w, total_h], center = false);
        translate([rect_w, 0])
            circle(r = r);
    }
}

module mug_body() {
    difference() {
        cylinder(h = mug_h, r = outer_r);
        translate([0, 0, bottom_t])
            cylinder(h = mug_h - bottom_t + 0.01, r = inner_r);
    }
}

module handle() {
    // Put the D shape in XZ plane and extrude along Y.
    // Flat side intersects the mug body to guarantee a solid manifold union.
    translate([outer_r - handle_t, 0, handle_center_z])
    rotate([90, 0, 0])
    difference() {
        linear_extrude(height = handle_t, center = true)
            d_shape_2d(handle_outer_w, handle_outer_h);

        translate([handle_t, 0, 0])
            linear_extrude(height = handle_t + 2, center = true)
                d_shape_2d(handle_open_w, handle_open_h);
    }
}

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