vibe-openscad

tier-2-offset-handle-mug / gpt-5.1-codex-mini

5 run / 累計 499.4s / 累計 $0.9165

openai gpt 5.1 codex mini bare

bare (provider default effort)

run detail →
render
bare render of tier-2-offset-handle-mug
loading STL…
success 100.1s · 273/16176t · $0.1783
SCAD (63 lines)
$fn = 120;

outer_radius = 40;
inner_radius = 35;
mug_height = 90;
bottom_thickness = 6;

handle_radius = 32;
handle_length = 12;
handle_inner_width = 25;
handle_inner_height = 30;
handle_margin = 2;

module mug_body() {
    difference() {
        // 外側
        cylinder(r = outer_radius, h = mug_height);
        // 内側(底面厚み分だけ高く)
        translate([0, 0, bottom_thickness])
            cylinder(r = inner_radius, h = mug_height - bottom_thickness);
    }
}

module handle_outer() {
    linear_extrude(height = handle_length, center = true)
        intersection() {
            circle(r = handle_radius);
            translate([0, -handle_radius])
                square([handle_radius, 2 * handle_radius]);
        }
}

module handle_body() {
    translate([outer_radius + handle_length / 2, 0, mug_height / 2])
        multmatrix([
            [0, 0, 1, 0],
            [1, 0, 0, 0],
            [0, 1, 0, 0],
            [0, 0, 0, 1]
        ])
            handle_outer();
}

module handle_cutout() {
    translate([
        outer_radius - handle_margin,
        0,
        mug_height / 2 - handle_inner_height / 2
    ])
        cube([handle_length + handle_margin * 2, handle_inner_width, handle_inner_height]);
}

module mug_handle() {
    difference() {
        handle_body();
        handle_cutout();
    }
}

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

prompt

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

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

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

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

variant: effort

lownot run
medium (default) success
medium
100.1s · 273/16176t · $0.1783
SCAD (63 lines)
$fn = 120;

outer_radius = 40;
inner_radius = 35;
mug_height = 90;
bottom_thickness = 6;

handle_radius = 32;
handle_length = 12;
handle_inner_width = 25;
handle_inner_height = 30;
handle_margin = 2;

module mug_body() {
    difference() {
        // 外側
        cylinder(r = outer_radius, h = mug_height);
        // 内側(底面厚み分だけ高く)
        translate([0, 0, bottom_thickness])
            cylinder(r = inner_radius, h = mug_height - bottom_thickness);
    }
}

module handle_outer() {
    linear_extrude(height = handle_length, center = true)
        intersection() {
            circle(r = handle_radius);
            translate([0, -handle_radius])
                square([handle_radius, 2 * handle_radius]);
        }
}

module handle_body() {
    translate([outer_radius + handle_length / 2, 0, mug_height / 2])
        multmatrix([
            [0, 0, 1, 0],
            [1, 0, 0, 0],
            [0, 1, 0, 0],
            [0, 0, 0, 1]
        ])
            handle_outer();
}

module handle_cutout() {
    translate([
        outer_radius - handle_margin,
        0,
        mug_height / 2 - handle_inner_height / 2
    ])
        cube([handle_length + handle_margin * 2, handle_inner_width, handle_inner_height]);
}

module mug_handle() {
    difference() {
        handle_body();
        handle_cutout();
    }
}

union() {
    mug_body();
    mug_handle();
}
highnot run
maxnot run
xhighnot run

iteration: iter-png

i1 success
iter 1
65.8s · 1315/10602t · $0.1185
diff vs bare: +36/-34
- $fn = 120;
+ $fn = 160;
  
  outer_radius = 40;
  inner_radius = 35;
  mug_height = 90;
  bottom_thickness = 6;
  
- handle_radius = 32;
- handle_length = 12;
- handle_inner_width = 25;
- handle_inner_height = 30;
- handle_margin = 2;
+ handle_depth = 14;
+ handle_outer_radius = 32;
+ handle_flat_depth = 10;
+ handle_vertical_center = mug_height / 2;
  
+ inner_gap_width = 25;
+ inner_gap_height = 30;
+ inner_gap_offset = 2;
+ 
  module mug_body() {
      difference() {
-         // 外側
          cylinder(r = outer_radius, h = mug_height);
-         // 内側(底面厚み分だけ高く)
          translate([0, 0, bottom_thickness])
              cylinder(r = inner_radius, h = mug_height - bottom_thickness);
      }
  }
  
- module handle_outer() {
-     linear_extrude(height = handle_length, center = true)
+ module handle_profile() {
+     union() {
+         translate([-handle_flat_depth, -handle_outer_radius])
+             square([handle_flat_depth, handle_outer_radius * 2]);
          intersection() {
-             circle(r = handle_radius);
-             translate([0, -handle_radius])
-                 square([handle_radius, 2 * handle_radius]);
+             circle(r = handle_outer_radius);
+             translate([0, -handle_outer_radius])
+                 square([handle_outer_radius, handle_outer_radius * 2]);
          }
+     }
  }
  
+ module handle_shape() {
+     linear_extrude(height = handle_depth, center = true)
+         handle_profile();
+ }
+ 
  module handle_body() {
-     translate([outer_radius + handle_length / 2, 0, mug_height / 2])
-         multmatrix([
-             [0, 0, 1, 0],
-             [1, 0, 0, 0],
-             [0, 1, 0, 0],
-             [0, 0, 0, 1]
+     difference() {
+         handle_shape();
+         translate([
+             inner_gap_offset + inner_gap_width / 2,
+             0,
+             0
          ])
-             handle_outer();
+             cube(
+                 [inner_gap_width, handle_depth + 4, inner_gap_height],
+                 center = true
+             );
+     }
  }
  
- module handle_cutout() {
-     translate([
-         outer_radius - handle_margin,
-         0,
-         mug_height / 2 - handle_inner_height / 2
-     ])
-         cube([handle_length + handle_margin * 2, handle_inner_width, handle_inner_height]);
- }
- 
- module mug_handle() {
-     difference() {
+ module handle() {
+     translate([outer_radius, 0, handle_vertical_center])
          handle_body();
-         handle_cutout();
-     }
  }
  
  union() {
      mug_body();
-     mug_handle();
+     handle();
  }
SCAD (65 lines)
$fn = 160;

outer_radius = 40;
inner_radius = 35;
mug_height = 90;
bottom_thickness = 6;

handle_depth = 14;
handle_outer_radius = 32;
handle_flat_depth = 10;
handle_vertical_center = mug_height / 2;

inner_gap_width = 25;
inner_gap_height = 30;
inner_gap_offset = 2;

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

module handle_profile() {
    union() {
        translate([-handle_flat_depth, -handle_outer_radius])
            square([handle_flat_depth, handle_outer_radius * 2]);
        intersection() {
            circle(r = handle_outer_radius);
            translate([0, -handle_outer_radius])
                square([handle_outer_radius, handle_outer_radius * 2]);
        }
    }
}

module handle_shape() {
    linear_extrude(height = handle_depth, center = true)
        handle_profile();
}

module handle_body() {
    difference() {
        handle_shape();
        translate([
            inner_gap_offset + inner_gap_width / 2,
            0,
            0
        ])
            cube(
                [inner_gap_width, handle_depth + 4, inner_gap_height],
                center = true
            );
    }
}

module handle() {
    translate([outer_radius, 0, handle_vertical_center])
        handle_body();
}

union() {
    mug_body();
    handle();
}
i2 success
iter 2
114.4s · 1282/19416t · $0.2154
diff vs i1: +31/-29
  $fn = 160;
  
  outer_radius = 40;
  inner_radius = 35;
  mug_height = 90;
  bottom_thickness = 6;
  
- handle_depth = 14;
- handle_outer_radius = 32;
- handle_flat_depth = 10;
- handle_vertical_center = mug_height / 2;
- 
  inner_gap_width = 25;
  inner_gap_height = 30;
- inner_gap_offset = 2;
+ handle_wall_thickness = 6;
+ handle_circle_radius = inner_gap_width + handle_wall_thickness;
+ handle_depth = 15;
  
  module mug_body() {
      difference() {
          cylinder(r = outer_radius, h = mug_height);
          translate([0, 0, bottom_thickness])
              cylinder(r = inner_radius, h = mug_height - bottom_thickness);
      }
  }
  
  module handle_profile() {
      union() {
-         translate([-handle_flat_depth, -handle_outer_radius])
-             square([handle_flat_depth, handle_outer_radius * 2]);
-         intersection() {
-             circle(r = handle_outer_radius);
-             translate([0, -handle_outer_radius])
-                 square([handle_outer_radius, handle_outer_radius * 2]);
+         translate([outer_radius, -handle_circle_radius])
+             square([handle_wall_thickness, handle_circle_radius * 2], center = false);
+         difference() {
+             translate([outer_radius + handle_circle_radius, 0])
+                 circle(r = handle_circle_radius);
+             translate([-1000, -handle_circle_radius - 2])
+                 square([outer_radius + 1000, handle_circle_radius * 2 + 4], center = false);
          }
      }
  }
  
- module handle_shape() {
-     linear_extrude(height = handle_depth, center = true)
-         handle_profile();
- }
- 
- module handle_body() {
+ module handle_shape_raw() {
      difference() {
-         handle_shape();
-         translate([
-             inner_gap_offset + inner_gap_width / 2,
-             0,
-             0
-         ])
+         linear_extrude(height = handle_depth, center = true)
+             handle_profile();
+         translate(
+             [
+                 outer_radius + inner_gap_width / 2,
+                 0,
+                 0
+             ]
+         )
              cube(
-                 [inner_gap_width, handle_depth + 4, inner_gap_height],
+                 [
+                     inner_gap_width,
+                     inner_gap_height,
+                     handle_depth + 4
+                 ],
                  center = true
              );
      }
  }
  
- module handle() {
-     translate([outer_radius, 0, handle_vertical_center])
-         handle_body();
+ module handle_body() {
+     translate([0, 0, mug_height / 2])
+         mirror([0, 1, 0])
+             rotate([90, 0, 0])
+                 handle_shape_raw();
  }
  
  union() {
      mug_body();
-     handle();
+     handle_body();
  }
SCAD (67 lines)
$fn = 160;

outer_radius = 40;
inner_radius = 35;
mug_height = 90;
bottom_thickness = 6;

inner_gap_width = 25;
inner_gap_height = 30;
handle_wall_thickness = 6;
handle_circle_radius = inner_gap_width + handle_wall_thickness;
handle_depth = 15;

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

module handle_profile() {
    union() {
        translate([outer_radius, -handle_circle_radius])
            square([handle_wall_thickness, handle_circle_radius * 2], center = false);
        difference() {
            translate([outer_radius + handle_circle_radius, 0])
                circle(r = handle_circle_radius);
            translate([-1000, -handle_circle_radius - 2])
                square([outer_radius + 1000, handle_circle_radius * 2 + 4], center = false);
        }
    }
}

module handle_shape_raw() {
    difference() {
        linear_extrude(height = handle_depth, center = true)
            handle_profile();
        translate(
            [
                outer_radius + inner_gap_width / 2,
                0,
                0
            ]
        )
            cube(
                [
                    inner_gap_width,
                    inner_gap_height,
                    handle_depth + 4
                ],
                center = true
            );
    }
}

module handle_body() {
    translate([0, 0, mug_height / 2])
        mirror([0, 1, 0])
            rotate([90, 0, 0])
                handle_shape_raw();
}

union() {
    mug_body();
    handle_body();
}
i3 success
iter 3
119.0s · 1328/20381t · $0.2261
diff vs i2: +24/-34
  $fn = 160;
  
  outer_radius = 40;
  inner_radius = 35;
  mug_height = 90;
  bottom_thickness = 6;
  
  inner_gap_width = 25;
  inner_gap_height = 30;
  handle_wall_thickness = 6;
- handle_circle_radius = inner_gap_width + handle_wall_thickness;
- handle_depth = 15;
+ handle_depth = 16;
  
+ handle_height = inner_gap_height + 2 * handle_wall_thickness;
+ 
  module mug_body() {
      difference() {
-         cylinder(r = outer_radius, h = mug_height);
+         cylinder(r = outer_radius, h = mug_height, center = false);
          translate([0, 0, bottom_thickness])
-             cylinder(r = inner_radius, h = mug_height - bottom_thickness);
+             cylinder(r = inner_radius, h = mug_height - bottom_thickness, center = false);
      }
  }
  
- module handle_profile() {
-     union() {
-         translate([outer_radius, -handle_circle_radius])
-             square([handle_wall_thickness, handle_circle_radius * 2], center = false);
-         difference() {
-             translate([outer_radius + handle_circle_radius, 0])
-                 circle(r = handle_circle_radius);
-             translate([-1000, -handle_circle_radius - 2])
-                 square([outer_radius + 1000, handle_circle_radius * 2 + 4], center = false);
+ module handle_cross_section() {
+     intersection() {
+         union() {
+             translate([0, -handle_height / 2])
+                 square([inner_gap_width + handle_wall_thickness, handle_height], center = false);
+             translate([inner_gap_width + handle_wall_thickness, 0])
+                 circle(r = handle_height / 2);
          }
+         translate([0, -handle_height / 2])
+             square(
+                 [inner_gap_width + handle_wall_thickness + handle_height / 2, handle_height],
+                 center = false
+             );
      }
  }
  
- module handle_shape_raw() {
+ module handle_shape() {
      difference() {
          linear_extrude(height = handle_depth, center = true)
-             handle_profile();
-         translate(
-             [
-                 outer_radius + inner_gap_width / 2,
-                 0,
-                 0
-             ]
-         )
-             cube(
-                 [
-                     inner_gap_width,
-                     inner_gap_height,
-                     handle_depth + 4
-                 ],
-                 center = true
-             );
+             handle_cross_section();
+         translate([inner_gap_width / 2, 0, 0])
+             cube([inner_gap_width, inner_gap_height, handle_depth + 4], center = true);
      }
  }
  
  module handle_body() {
-     translate([0, 0, mug_height / 2])
-         mirror([0, 1, 0])
-             rotate([90, 0, 0])
-                 handle_shape_raw();
+     translate([outer_radius - 2, 0, mug_height / 2])
+         rotate([90, 0, 0])
+             handle_shape();
  }
  
  union() {
      mug_body();
      handle_body();
  }
SCAD (57 lines)
$fn = 160;

outer_radius = 40;
inner_radius = 35;
mug_height = 90;
bottom_thickness = 6;

inner_gap_width = 25;
inner_gap_height = 30;
handle_wall_thickness = 6;
handle_depth = 16;

handle_height = inner_gap_height + 2 * handle_wall_thickness;

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

module handle_cross_section() {
    intersection() {
        union() {
            translate([0, -handle_height / 2])
                square([inner_gap_width + handle_wall_thickness, handle_height], center = false);
            translate([inner_gap_width + handle_wall_thickness, 0])
                circle(r = handle_height / 2);
        }
        translate([0, -handle_height / 2])
            square(
                [inner_gap_width + handle_wall_thickness + handle_height / 2, handle_height],
                center = false
            );
    }
}

module handle_shape() {
    difference() {
        linear_extrude(height = handle_depth, center = true)
            handle_cross_section();
        translate([inner_gap_width / 2, 0, 0])
            cube([inner_gap_width, inner_gap_height, handle_depth + 4], center = true);
    }
}

module handle_body() {
    translate([outer_radius - 2, 0, mug_height / 2])
        rotate([90, 0, 0])
            handle_shape();
}

union() {
    mug_body();
    handle_body();
}