vibe-openscad

tier-2-offset-handle-mug / claude-haiku-4-5-20251001

5 run / 累計 36.0s / 累計 $0.0275

claude haiku 4.5 2025-10-01 bare

bare (provider default effort)

run detail →
render
bare render of tier-2-offset-handle-mug
loading STL…
success 7.1s · 330/820t · $0.0044
SCAD (72 lines)
// マグカップの本体
module mug_body() {
    // 外側の円筒
    cylinder(h = 90, r = 40, center = false);
}

// マグカップの空洞(取手との干渉を避けるため)
module mug_hollow() {
    // 内側の空洞(高さ84mm分)
    translate([0, 0, 6]) {
        cylinder(h = 84, r = 35, center = false);
    }
}

// D字形の取手
module handle() {
    // 取手の寸法
    handle_inner_height = 30;  // 指が入る高さ
    handle_inner_width = 25;   // 指が入る幅(内側)
    
    // 取手の外側半径(本体外周から延びる)
    handle_outer_radius = 50;  // マグ外径40mm + 取手の厚さで約50mm
    
    // 取手の開始高さ(マグの高さ方向中央付近)
    handle_z_start = 30;  // 高さ30mmから開始
    
    // 取手を X > 0 の側面に配置
    // 外側が半円、本体側が直線のD字形
    
    difference() {
        // 外側の半円柱と本体接続部分
        union() {
            // 外側の半円部分
            translate([0, 0, handle_z_start]) {
                difference() {
                    // 大きな円筒の一部
                    cylinder(h = handle_inner_height, r = handle_outer_radius, center = false);
                    // マグ本体の外径より内側を削除
                    cylinder(h = handle_inner_height, r = 40, center = false);
                    // X < 0 の部分を削除(+X方向のみに取手を配置)
                    translate([-100, -100, -1]) {
                        cube([100, 200, handle_inner_height + 2]);
                    }
                }
            }
            // マグ本体と取手の接続部分
            translate([0, 0, handle_z_start]) {
                // X軸方向の厚みを持つ接続ブロック
                translate([0, -5, 0]) {
                    cube([handle_outer_radius - 40, 10, handle_inner_height]);
                }
            }
        }
        
        // 取手の内側をくり抜く(D字形の直線部分)
        translate([40, -handle_inner_width/2, handle_z_start]) {
            cube([handle_outer_radius - 40 + 1, handle_inner_width, handle_inner_height]);
        }
    }
}

// メイン処理
difference() {
    union() {
        // マグカップ本体
        mug_body();
        // 取手
        handle();
    }
    // マグカップの空洞
    mug_hollow();
}

prompt

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

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

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

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

variant: thinking

off (default) success
off
7.1s · 330/820t · $0.0044
SCAD (72 lines)
// マグカップの本体
module mug_body() {
    // 外側の円筒
    cylinder(h = 90, r = 40, center = false);
}

// マグカップの空洞(取手との干渉を避けるため)
module mug_hollow() {
    // 内側の空洞(高さ84mm分)
    translate([0, 0, 6]) {
        cylinder(h = 84, r = 35, center = false);
    }
}

// D字形の取手
module handle() {
    // 取手の寸法
    handle_inner_height = 30;  // 指が入る高さ
    handle_inner_width = 25;   // 指が入る幅(内側)
    
    // 取手の外側半径(本体外周から延びる)
    handle_outer_radius = 50;  // マグ外径40mm + 取手の厚さで約50mm
    
    // 取手の開始高さ(マグの高さ方向中央付近)
    handle_z_start = 30;  // 高さ30mmから開始
    
    // 取手を X > 0 の側面に配置
    // 外側が半円、本体側が直線のD字形
    
    difference() {
        // 外側の半円柱と本体接続部分
        union() {
            // 外側の半円部分
            translate([0, 0, handle_z_start]) {
                difference() {
                    // 大きな円筒の一部
                    cylinder(h = handle_inner_height, r = handle_outer_radius, center = false);
                    // マグ本体の外径より内側を削除
                    cylinder(h = handle_inner_height, r = 40, center = false);
                    // X < 0 の部分を削除(+X方向のみに取手を配置)
                    translate([-100, -100, -1]) {
                        cube([100, 200, handle_inner_height + 2]);
                    }
                }
            }
            // マグ本体と取手の接続部分
            translate([0, 0, handle_z_start]) {
                // X軸方向の厚みを持つ接続ブロック
                translate([0, -5, 0]) {
                    cube([handle_outer_radius - 40, 10, handle_inner_height]);
                }
            }
        }
        
        // 取手の内側をくり抜く(D字形の直線部分)
        translate([40, -handle_inner_width/2, handle_z_start]) {
            cube([handle_outer_radius - 40 + 1, handle_inner_width, handle_inner_height]);
        }
    }
}

// メイン処理
difference() {
    union() {
        // マグカップ本体
        mug_body();
        // 取手
        handle();
    }
    // マグカップの空洞
    mug_hollow();
}
adaptivenot run
dynamicnot run

iteration: iter-png

i1 success
iter 1
7.7s · 1905/892t · $0.0064
diff vs bare: +47/-52
- // マグカップの本体
- module mug_body() {
-     // 外側の円筒
-     cylinder(h = 90, r = 40, center = false);
- }
- 
- // マグカップの空洞(取手との干渉を避けるため)
- module mug_hollow() {
-     // 内側の空洞(高さ84mm分)
-     translate([0, 0, 6]) {
-         cylinder(h = 84, r = 35, center = false);
+ // マグカップ
+ module mug() {
+     // 外径80mm = 半径40mm
+     // 内径70mm = 半径35mm
+     // 肉厚 5mm
+     // 高さ 90mm
+     // 底面厚み 6mm
+     
+     difference() {
+         // 外側円筒
+         cylinder(h = 90, r = 40, center = false);
+         
+         // 内側の空洞(底面6mm分は残す)
+         translate([0, 0, 6]) {
+             cylinder(h = 84, r = 35, center = false);
+         }
      }
  }
  
- // D字形の取手
+ // D字形取手
  module handle() {
-     // 取手の寸法
-     handle_inner_height = 30;  // 指が入る高さ
-     handle_inner_width = 25;   // 指が入る幅(内側)
+     // 取手の内側寸法
+     handle_inner_height = 30;  // 高さ30mm
+     handle_inner_width = 25;   // 幅25mm
      
-     // 取手の外側半径(本体外周から延びる)
-     handle_outer_radius = 50;  // マグ外径40mm + 取手の厚さで約50mm
+     // 取手開始高さ(中央付近: 90/2 - 30/2 = 30)
+     handle_z = 30;
      
-     // 取手の開始高さ(マグの高さ方向中央付近)
-     handle_z_start = 30;  // 高さ30mmから開始
+     // 取手は本体外径(40mm)から延びる
+     // 外側半円部分の半径を定義
+     handle_depth = 20;  // 本体から延びる距離
      
-     // 取手を X > 0 の側面に配置
-     // 外側が半円、本体側が直線のD字形
-     
-     difference() {
-         // 外側の半円柱と本体接続部分
-         union() {
-             // 外側の半円部分
-             translate([0, 0, handle_z_start]) {
+     union() {
+         // 取手の本体側ブロック(直線部分)
+         translate([35, -handle_inner_width/2, handle_z]) {
+             cube([10, handle_inner_width, handle_inner_height]);
+         }
+         
+         // 取手の外側半円部分
+         // X >= 40 の部分の円形部分
+         difference() {
+             // 取手用円筒セクション
+             translate([0, 0, handle_z]) {
                  difference() {
-                     // 大きな円筒の一部
-                     cylinder(h = handle_inner_height, r = handle_outer_radius, center = false);
-                     // マグ本体の外径より内側を削除
+                     // 外側半径 = 40 + 20 = 60mm
+                     cylinder(h = handle_inner_height, r = 40 + handle_depth, center = false);
+                     // 内側を削除(内径との干渉を避ける)
                      cylinder(h = handle_inner_height, r = 40, center = false);
-                     // X < 0 の部分を削除(+X方向のみに取手を配置)
+                     // X < 40 の部分を削除(+X側のみ)
                      translate([-100, -100, -1]) {
                          cube([100, 200, handle_inner_height + 2]);
                      }
                  }
              }
-             // マグ本体と取手の接続部分
-             translate([0, 0, handle_z_start]) {
-                 // X軸方向の厚みを持つ接続ブロック
-                 translate([0, -5, 0]) {
-                     cube([handle_outer_radius - 40, 10, handle_inner_height]);
-                 }
+             // 取手内側をくり抜く
+             translate([40, -handle_inner_width/2, handle_z - 1]) {
+                 cube([handle_depth + 1, handle_inner_width, handle_inner_height + 2]);
              }
          }
-         
-         // 取手の内側をくり抜く(D字形の直線部分)
-         translate([40, -handle_inner_width/2, handle_z_start]) {
-             cube([handle_outer_radius - 40 + 1, handle_inner_width, handle_inner_height]);
-         }
      }
  }
  
- // メイン処理
- difference() {
-     union() {
-         // マグカップ本体
-         mug_body();
-         // 取手
-         handle();
-     }
-     // マグカップの空洞
-     mug_hollow();
+ // メイン構造
+ union() {
+     mug();
+     handle();
  }
SCAD (67 lines)
// マグカップ
module mug() {
    // 外径80mm = 半径40mm
    // 内径70mm = 半径35mm
    // 肉厚 5mm
    // 高さ 90mm
    // 底面厚み 6mm
    
    difference() {
        // 外側円筒
        cylinder(h = 90, r = 40, center = false);
        
        // 内側の空洞(底面6mm分は残す)
        translate([0, 0, 6]) {
            cylinder(h = 84, r = 35, center = false);
        }
    }
}

// D字形取手
module handle() {
    // 取手の内側寸法
    handle_inner_height = 30;  // 高さ30mm
    handle_inner_width = 25;   // 幅25mm
    
    // 取手開始高さ(中央付近: 90/2 - 30/2 = 30)
    handle_z = 30;
    
    // 取手は本体外径(40mm)から延びる
    // 外側半円部分の半径を定義
    handle_depth = 20;  // 本体から延びる距離
    
    union() {
        // 取手の本体側ブロック(直線部分)
        translate([35, -handle_inner_width/2, handle_z]) {
            cube([10, handle_inner_width, handle_inner_height]);
        }
        
        // 取手の外側半円部分
        // X >= 40 の部分の円形部分
        difference() {
            // 取手用円筒セクション
            translate([0, 0, handle_z]) {
                difference() {
                    // 外側半径 = 40 + 20 = 60mm
                    cylinder(h = handle_inner_height, r = 40 + handle_depth, center = false);
                    // 内側を削除(内径との干渉を避ける)
                    cylinder(h = handle_inner_height, r = 40, center = false);
                    // X < 40 の部分を削除(+X側のみ)
                    translate([-100, -100, -1]) {
                        cube([100, 200, handle_inner_height + 2]);
                    }
                }
            }
            // 取手内側をくり抜く
            translate([40, -handle_inner_width/2, handle_z - 1]) {
                cube([handle_depth + 1, handle_inner_width, handle_inner_height + 2]);
            }
        }
    }
}

// メイン構造
union() {
    mug();
    handle();
}
i2 success
iter 2
7.1s · 1817/861t · $0.0061
diff vs i1: +35/-38
- // マグカップ
+ // マグカップ本体
  module mug() {
-     // 外径80mm = 半径40mm
-     // 内径70mm = 半径35mm
-     // 肉厚 5mm
-     // 高さ 90mm
-     // 底面厚み 6mm
-     
      difference() {
-         // 外側円筒
-         cylinder(h = 90, r = 40, center = false);
+         // 外側円筒:外径80mm(半径40mm)、高さ90mm
+         cylinder(h = 90, r = 40, center = false, $fn = 100);
          
-         // 内側の空洞(底面6mm分は残す)
+         // 内側の空洞:底面6mm残す
          translate([0, 0, 6]) {
-             cylinder(h = 84, r = 35, center = false);
+             cylinder(h = 84, r = 35, center = false, $fn = 100);
          }
      }
  }
  
  // D字形取手
  module handle() {
-     // 取手の内側寸法
-     handle_inner_height = 30;  // 高さ30mm
-     handle_inner_width = 25;   // 幅25mm
+     // 取手の内側寸法:高さ30mm、幅25mm
+     handle_inner_height = 30;
+     handle_inner_width = 25;
+     handle_inner_depth = 20;  // 指が入る奥行き
      
-     // 取手開始高さ(中央付近: 90/2 - 30/2 = 30)
-     handle_z = 30;
+     // 取手開始高さ(マグの中央付近)
+     handle_z = (90 - handle_inner_height) / 2;  // 30mm
      
-     // 取手は本体外径(40mm)から延びる
-     // 外側半円部分の半径を定義
-     handle_depth = 20;  // 本体から延びる距離
+     // 取手の外側半径
+     handle_outer_r = 50;  // 外側が円形で本体から十分に離れる
      
      union() {
-         // 取手の本体側ブロック(直線部分)
+         // 本体側の直線部分(接続部)
          translate([35, -handle_inner_width/2, handle_z]) {
-             cube([10, handle_inner_width, handle_inner_height]);
+             cube([8, handle_inner_width, handle_inner_height]);
          }
          
-         // 取手の外側半円部分
-         // X >= 40 の部分の円形部分
+         // 外側の半円形部分
          difference() {
-             // 取手用円筒セクション
-             translate([0, 0, handle_z]) {
-                 difference() {
-                     // 外側半径 = 40 + 20 = 60mm
-                     cylinder(h = handle_inner_height, r = 40 + handle_depth, center = false);
-                     // 内側を削除(内径との干渉を避ける)
-                     cylinder(h = handle_inner_height, r = 40, center = false);
-                     // X < 40 の部分を削除(+X側のみ)
-                     translate([-100, -100, -1]) {
-                         cube([100, 200, handle_inner_height + 2]);
-                     }
+             // 取手全体の円形セクション(X >= 40の部分)
+             intersection() {
+                 cylinder(h = handle_inner_height, r = handle_outer_r, center = false, $fn = 100);
+                 translate([0, 0, handle_z]) {
+                     cube([200, 200, handle_inner_height]);
                  }
+                 // +X軸側のみ
+                 translate([40, -200, handle_z]) {
+                     cube([200, 400, handle_inner_height]);
+                 }
              }
-             // 取手内側をくり抜く
-             translate([40, -handle_inner_width/2, handle_z - 1]) {
-                 cube([handle_depth + 1, handle_inner_width, handle_inner_height + 2]);
+             
+             // 内側をくり抜く:D字形状の内側空間
+             translate([40, -handle_inner_width/2, handle_z - 0.5]) {
+                 cube([handle_inner_depth + 1, handle_inner_width, handle_inner_height + 1]);
              }
+             
+             // マグ本体との干渉部分を削除
+             translate([0, 0, handle_z - 1]) {
+                 cylinder(h = handle_inner_height + 2, r = 40, center = false, $fn = 100);
+             }
          }
      }
  }
  
- // メイン構造
+ // 完成品
  union() {
      mug();
      handle();
  }
SCAD (64 lines)
// マグカップ本体
module mug() {
    difference() {
        // 外側円筒:外径80mm(半径40mm)、高さ90mm
        cylinder(h = 90, r = 40, center = false, $fn = 100);
        
        // 内側の空洞:底面6mm残す
        translate([0, 0, 6]) {
            cylinder(h = 84, r = 35, center = false, $fn = 100);
        }
    }
}

// D字形取手
module handle() {
    // 取手の内側寸法:高さ30mm、幅25mm
    handle_inner_height = 30;
    handle_inner_width = 25;
    handle_inner_depth = 20;  // 指が入る奥行き
    
    // 取手開始高さ(マグの中央付近)
    handle_z = (90 - handle_inner_height) / 2;  // 30mm
    
    // 取手の外側半径
    handle_outer_r = 50;  // 外側が円形で本体から十分に離れる
    
    union() {
        // 本体側の直線部分(接続部)
        translate([35, -handle_inner_width/2, handle_z]) {
            cube([8, handle_inner_width, handle_inner_height]);
        }
        
        // 外側の半円形部分
        difference() {
            // 取手全体の円形セクション(X >= 40の部分)
            intersection() {
                cylinder(h = handle_inner_height, r = handle_outer_r, center = false, $fn = 100);
                translate([0, 0, handle_z]) {
                    cube([200, 200, handle_inner_height]);
                }
                // +X軸側のみ
                translate([40, -200, handle_z]) {
                    cube([200, 400, handle_inner_height]);
                }
            }
            
            // 内側をくり抜く:D字形状の内側空間
            translate([40, -handle_inner_width/2, handle_z - 0.5]) {
                cube([handle_inner_depth + 1, handle_inner_width, handle_inner_height + 1]);
            }
            
            // マグ本体との干渉部分を削除
            translate([0, 0, handle_z - 1]) {
                cylinder(h = handle_inner_height + 2, r = 40, center = false, $fn = 100);
            }
        }
    }
}

// 完成品
union() {
    mug();
    handle();
}
i3 success
iter 3
6.8s · 1797/870t · $0.0061
diff vs i2: +33/-31
  // マグカップ本体
  module mug() {
      difference() {
          // 外側円筒:外径80mm(半径40mm)、高さ90mm
          cylinder(h = 90, r = 40, center = false, $fn = 100);
          
          // 内側の空洞:底面6mm残す
          translate([0, 0, 6]) {
-             cylinder(h = 84, r = 35, center = false, $fn = 100);
+             cylinder(h = 90, r = 35, center = false, $fn = 100);
          }
      }
  }
  
  // D字形取手
  module handle() {
      // 取手の内側寸法:高さ30mm、幅25mm
      handle_inner_height = 30;
      handle_inner_width = 25;
-     handle_inner_depth = 20;  // 指が入る奥行き
      
      // 取手開始高さ(マグの中央付近)
-     handle_z = (90 - handle_inner_height) / 2;  // 30mm
+     handle_z = 30;  // マグ高さ90mmの中央
      
-     // 取手の外側半径
-     handle_outer_r = 50;  // 外側が円形で本体から十分に離れる
+     // 取手の外側寸法
+     handle_outer_depth = 28;  // 本体から外へ
+     handle_outer_r = 50;  // 外側の曲率半径
      
-     union() {
-         // 本体側の直線部分(接続部)
-         translate([35, -handle_inner_width/2, handle_z]) {
-             cube([8, handle_inner_width, handle_inner_height]);
-         }
-         
-         // 外側の半円形部分
-         difference() {
-             // 取手全体の円形セクション(X >= 40の部分)
-             intersection() {
-                 cylinder(h = handle_inner_height, r = handle_outer_r, center = false, $fn = 100);
-                 translate([0, 0, handle_z]) {
-                     cube([200, 200, handle_inner_height]);
-                 }
-                 // +X軸側のみ
-                 translate([40, -200, handle_z]) {
-                     cube([200, 400, handle_inner_height]);
-                 }
+     difference() {
+         union() {
+             // 本体に接続する直線部分(内側)
+             translate([32, -handle_inner_width/2, handle_z]) {
+                 cube([10, handle_inner_width, handle_inner_height]);
              }
              
-             // 内側をくり抜く:D字形状の内側空間
-             translate([40, -handle_inner_width/2, handle_z - 0.5]) {
-                 cube([handle_inner_depth + 1, handle_inner_width, handle_inner_height + 1]);
+             // 外側の半円形部分
+             translate([40, 0, handle_z + handle_inner_height/2]) {
+                 rotate([0, 0, 0]) {
+                     difference() {
+                         // 半円柱
+                         intersection() {
+                             cylinder(h = handle_inner_height, r = handle_outer_r, center = true, $fn = 100);
+                             translate([0, 0, 0]) {
+                                 cube([200, 100, handle_inner_height + 1], center = true);
+                             }
+                         }
+                     }
+                 }
              }
-             
-             // マグ本体との干渉部分を削除
-             translate([0, 0, handle_z - 1]) {
-                 cylinder(h = handle_inner_height + 2, r = 40, center = false, $fn = 100);
-             }
          }
+         
+         // 内側をくり抜く:D字形状の内側空間
+         translate([40, -handle_inner_width/2, handle_z - 0.5]) {
+             cube([handle_outer_depth + 2, handle_inner_width, handle_inner_height + 1]);
+         }
+         
+         // マグ本体との干渉部分を削除(本体内部を除去)
+         translate([0, 0, handle_z - 1]) {
+             cylinder(h = handle_inner_height + 2, r = 40.5, center = false, $fn = 100);
+         }
      }
  }
  
  // 完成品
  union() {
      mug();
      handle();
  }
SCAD (66 lines)
// マグカップ本体
module mug() {
    difference() {
        // 外側円筒:外径80mm(半径40mm)、高さ90mm
        cylinder(h = 90, r = 40, center = false, $fn = 100);
        
        // 内側の空洞:底面6mm残す
        translate([0, 0, 6]) {
            cylinder(h = 90, r = 35, center = false, $fn = 100);
        }
    }
}

// D字形取手
module handle() {
    // 取手の内側寸法:高さ30mm、幅25mm
    handle_inner_height = 30;
    handle_inner_width = 25;
    
    // 取手開始高さ(マグの中央付近)
    handle_z = 30;  // マグ高さ90mmの中央
    
    // 取手の外側寸法
    handle_outer_depth = 28;  // 本体から外へ
    handle_outer_r = 50;  // 外側の曲率半径
    
    difference() {
        union() {
            // 本体に接続する直線部分(内側)
            translate([32, -handle_inner_width/2, handle_z]) {
                cube([10, handle_inner_width, handle_inner_height]);
            }
            
            // 外側の半円形部分
            translate([40, 0, handle_z + handle_inner_height/2]) {
                rotate([0, 0, 0]) {
                    difference() {
                        // 半円柱
                        intersection() {
                            cylinder(h = handle_inner_height, r = handle_outer_r, center = true, $fn = 100);
                            translate([0, 0, 0]) {
                                cube([200, 100, handle_inner_height + 1], center = true);
                            }
                        }
                    }
                }
            }
        }
        
        // 内側をくり抜く:D字形状の内側空間
        translate([40, -handle_inner_width/2, handle_z - 0.5]) {
            cube([handle_outer_depth + 2, handle_inner_width, handle_inner_height + 1]);
        }
        
        // マグ本体との干渉部分を削除(本体内部を除去)
        translate([0, 0, handle_z - 1]) {
            cylinder(h = handle_inner_height + 2, r = 40.5, center = false, $fn = 100);
        }
    }
}

// 完成品
union() {
    mug();
    handle();
}