vibe-openscad

tier-2-l-bracket / o4-mini-2025-04-16

7 run / 累計 311.1s / 累計 $0.1594

openai o4 mini 2025-04-16 bare

bare (provider default effort)

run detail →
render
bare render of tier-2-l-bracket
loading STL…
success 54.9s · 294/5114t · $0.0228
SCAD (47 lines)
// L字金具 (L-bracket)
w       = 50;   // 幅
d       = 40;   // 奥行き
h       = 40;   // 高さ
t       = 3;    // 板厚
hole_d  = 4.5;  // 貫通穴径
cs_d    = 8;    // 皿座面径
cs_depth= 2;    // 皿座面深さ
offset  = 10;   // 縁からの距離
hole_x  = [ -w/2 + offset, w/2 - offset ];

module bracket() {
    difference() {
        // 板本体
        union() {
            // 水平フランジ
            translate([-w/2, 0, 0])
                cube([w, d, t]);
            // 垂直フランジ
            translate([-w/2, 0, 0])
                cube([w, t, h]);
        }
        // 水平フランジの穴
        for (x_pos = hole_x) {
            // 貫通穴
            translate([x_pos, d/2, t/2])
                cylinder(d=hole_d, h=t+2, center=true);
            // 皿穴
            translate([x_pos, d/2, t - cs_depth/2])
                cylinder(d=cs_d, h=cs_depth, center=true);
        }
        // 垂直フランジの穴
        for (x_pos = hole_x) {
            // 貫通穴
            translate([x_pos, t/2, h/2])
                rotate([90, 0, 0])
                    cylinder(d=hole_d, h=t+2, center=true);
            // 皿穴
            translate([x_pos, t - cs_depth/2, h/2])
                rotate([90, 0, 0])
                    cylinder(d=cs_d, h=cs_depth, center=true);
        }
    }
}

// モデル出力
bracket();
パラメータ (8)
スライダを動かすと openscad-wasm で再レンダリング

prompt

OpenSCAD で、L 字に折れた金具(L-bracket)を作ってください。

形状:
- 水平面と垂直面の 2 つのフランジが直角に繋がっている
- 水平面は 50mm × 40mm(幅 × 奥行き)
- 垂直面は 50mm × 40mm(幅 × 高さ)
- 板厚はどちらも 3mm
- 内側コーナーが原点になるように配置(水平面は +Y 方向、垂直面は +Z 方向に伸びる)

皿穴(countersunk holes):
- 各面に 2 個ずつ、合計 4 個
- M4 ねじ用(貫通穴 Φ4.5mm + 皿座面 Φ8mm × 深さ 2mm)
- 各面の中心線上で、面の縁から 10mm 内側、左右対称に 2 個並べる
- 皿座面は外側(ボルト頭が当たる側)に向ける

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

variant: effort

low success
low
13.8s · 294/1822t · $0.0083
SCAD (36 lines)
module bracket() {
    // horizontal flange
    translate([0, 0, 0])
        cube([50, 40, 3], center=false);
    // vertical flange
    translate([0, 0, 0])
        cube([50, 3, 40], center=false);
}

module holes() {
    // horizontal flange countersinks and through-holes
    for (x = [10, 40]) {
        // countersink Φ8×2mm at top surface
        translate([x, 20, 3 - 2])
            cylinder(h=2, r=4, $fn=64);
        // through-hole Φ4.5mm
        translate([x, 20, 0])
            cylinder(h=3, r=2.25, $fn=64);
    }
    // vertical flange countersinks and through-holes
    for (x = [10, 40]) {
        // countersink Φ8×2mm on outer side
        translate([x, 3, 20])
            rotate([-90, 0, 0])
                cylinder(h=2, r=4, $fn=64);
        // through-hole Φ4.5mm
        translate([x, 3, 20])
            rotate([-90, 0, 0])
                cylinder(h=3, r=2.25, $fn=64);
    }
}

difference() {
    bracket();
    holes();
}
medium (default) success
medium
54.9s · 294/5114t · $0.0228
SCAD (47 lines)
// L字金具 (L-bracket)
w       = 50;   // 幅
d       = 40;   // 奥行き
h       = 40;   // 高さ
t       = 3;    // 板厚
hole_d  = 4.5;  // 貫通穴径
cs_d    = 8;    // 皿座面径
cs_depth= 2;    // 皿座面深さ
offset  = 10;   // 縁からの距離
hole_x  = [ -w/2 + offset, w/2 - offset ];

module bracket() {
    difference() {
        // 板本体
        union() {
            // 水平フランジ
            translate([-w/2, 0, 0])
                cube([w, d, t]);
            // 垂直フランジ
            translate([-w/2, 0, 0])
                cube([w, t, h]);
        }
        // 水平フランジの穴
        for (x_pos = hole_x) {
            // 貫通穴
            translate([x_pos, d/2, t/2])
                cylinder(d=hole_d, h=t+2, center=true);
            // 皿穴
            translate([x_pos, d/2, t - cs_depth/2])
                cylinder(d=cs_d, h=cs_depth, center=true);
        }
        // 垂直フランジの穴
        for (x_pos = hole_x) {
            // 貫通穴
            translate([x_pos, t/2, h/2])
                rotate([90, 0, 0])
                    cylinder(d=hole_d, h=t+2, center=true);
            // 皿穴
            translate([x_pos, t - cs_depth/2, h/2])
                rotate([90, 0, 0])
                    cylinder(d=cs_d, h=cs_depth, center=true);
        }
    }
}

// モデル出力
bracket();
high success
high
89.2s · 294/11768t · $0.0521
SCAD (31 lines)
difference() {
    // L 字金具本体
    union() {
        // 水平フランジ (X×Y×Z = 50×40×3)
        cube([50, 40, 3]);
        // 垂直フランジ (X×Y×Z = 50×3×40)
        cube([50, 3, 40]);
    }

    // 水平面の皿穴 (Z 軸方向)
    for (x = [10, 40]) {
        // 貫通穴 Φ4.5mm
        translate([x, 20, -1])
            cylinder(d=4.5, h=5);
        // 皿座面 Φ8mm 深さ 2mm (外側は Z=3 側)
        translate([x, 20, 1])
            cylinder(d=8, h=2);
    }

    // 垂直面の皿穴 (Y 軸方向)
    for (z = [10, 30]) {
        // 貫通穴 Φ4.5mm
        translate([25, -1, z])
            rotate([-90, 0, 0])
            cylinder(d=4.5, h=5);
        // 皿座面 Φ8mm 深さ 2mm (外側は Y=3 側)
        translate([25, 1, z])
            rotate([-90, 0, 0])
            cylinder(d=8, h=2);
    }
}
maxnot run
xhighnot run

iteration: iter-png

i1 success
iter 1
46.5s · 1666/4968t · $0.0237
diff vs bare: +20/-23
  // L字金具 (L-bracket)
- w       = 50;   // 幅
- d       = 40;   // 奥行き
- h       = 40;   // 高さ
- t       = 3;    // 板厚
- hole_d  = 4.5;  // 貫通穴径
- cs_d    = 8;    // 皿座面径
- cs_depth= 2;    // 皿座面深さ
- offset  = 10;   // 縁からの距離
- hole_x  = [ -w/2 + offset, w/2 - offset ];
+ w        = 50;   // 幅
+ d        = 40;   // 奥行き
+ h        = 40;   // 高さ
+ t        = 3;    // 板厚
+ hole_d   = 4.5;  // 貫通穴径
+ cs_d     = 8;    // 皿座面径
+ cs_depth = 2;    // 皿座面深さ
+ offset   = 10;   // 縁からの距離
  
  module bracket() {
      difference() {
          // 板本体
          union() {
-             // 水平フランジ
-             translate([-w/2, 0, 0])
-                 cube([w, d, t]);
-             // 垂直フランジ
-             translate([-w/2, 0, 0])
-                 cube([w, t, h]);
+             // 水平フランジ (原点から +Y, +Z 方向に伸びる)
+             cube([w, d, t]);
+             // 垂直フランジ (原点から +Y, +Z 方向に伸びる)
+             cube([w, t, h]);
          }
          // 水平フランジの穴
-         for (x_pos = hole_x) {
+         for (x_pos = [offset, w - offset]) {
              // 貫通穴
              translate([x_pos, d/2, t/2])
-                 cylinder(d=hole_d, h=t+2, center=true);
-             // 皿穴
+                 cylinder(d = hole_d, h = t + 2, center = true);
+             // 皿穴 (外側 = +Z 側)
              translate([x_pos, d/2, t - cs_depth/2])
-                 cylinder(d=cs_d, h=cs_depth, center=true);
+                 cylinder(d = cs_d, h = cs_depth, center = true);
          }
          // 垂直フランジの穴
-         for (x_pos = hole_x) {
+         for (x_pos = [offset, w - offset]) {
              // 貫通穴
              translate([x_pos, t/2, h/2])
                  rotate([90, 0, 0])
-                     cylinder(d=hole_d, h=t+2, center=true);
-             // 皿穴
+                     cylinder(d = hole_d, h = t + 2, center = true);
+             // 皿穴 (外側 = +Y 側)
              translate([x_pos, t - cs_depth/2, h/2])
                  rotate([90, 0, 0])
-                     cylinder(d=cs_d, h=cs_depth, center=true);
+                     cylinder(d = cs_d, h = cs_depth, center = true);
          }
      }
  }
  
  // モデル出力
  bracket();
SCAD (44 lines)
// L字金具 (L-bracket)
w        = 50;   // 幅
d        = 40;   // 奥行き
h        = 40;   // 高さ
t        = 3;    // 板厚
hole_d   = 4.5;  // 貫通穴径
cs_d     = 8;    // 皿座面径
cs_depth = 2;    // 皿座面深さ
offset   = 10;   // 縁からの距離

module bracket() {
    difference() {
        // 板本体
        union() {
            // 水平フランジ (原点から +Y, +Z 方向に伸びる)
            cube([w, d, t]);
            // 垂直フランジ (原点から +Y, +Z 方向に伸びる)
            cube([w, t, h]);
        }
        // 水平フランジの穴
        for (x_pos = [offset, w - offset]) {
            // 貫通穴
            translate([x_pos, d/2, t/2])
                cylinder(d = hole_d, h = t + 2, center = true);
            // 皿穴 (外側 = +Z 側)
            translate([x_pos, d/2, t - cs_depth/2])
                cylinder(d = cs_d, h = cs_depth, center = true);
        }
        // 垂直フランジの穴
        for (x_pos = [offset, w - offset]) {
            // 貫通穴
            translate([x_pos, t/2, h/2])
                rotate([90, 0, 0])
                    cylinder(d = hole_d, h = t + 2, center = true);
            // 皿穴 (外側 = +Y 側)
            translate([x_pos, t - cs_depth/2, h/2])
                rotate([90, 0, 0])
                    cylinder(d = cs_d, h = cs_depth, center = true);
        }
    }
}

// モデル出力
bracket();
i2 success
iter 2
29.2s · 1684/3291t · $0.0163
diff vs i1: +0/-0
  // L字金具 (L-bracket)
  w        = 50;   // 幅
  d        = 40;   // 奥行き
  h        = 40;   // 高さ
  t        = 3;    // 板厚
  hole_d   = 4.5;  // 貫通穴径
  cs_d     = 8;    // 皿座面径
  cs_depth = 2;    // 皿座面深さ
  offset   = 10;   // 縁からの距離
  
  module bracket() {
      difference() {
          // 板本体
          union() {
              // 水平フランジ (原点から +Y, +Z 方向に伸びる)
              cube([w, d, t]);
              // 垂直フランジ (原点から +Y, +Z 方向に伸びる)
              cube([w, t, h]);
          }
          // 水平フランジの穴
          for (x_pos = [offset, w - offset]) {
              // 貫通穴
              translate([x_pos, d/2, t/2])
                  cylinder(d = hole_d, h = t + 2, center = true);
              // 皿穴 (外側 = +Z 側)
              translate([x_pos, d/2, t - cs_depth/2])
                  cylinder(d = cs_d, h = cs_depth, center = true);
          }
          // 垂直フランジの穴
          for (x_pos = [offset, w - offset]) {
              // 貫通穴
              translate([x_pos, t/2, h/2])
                  rotate([90, 0, 0])
                      cylinder(d = hole_d, h = t + 2, center = true);
              // 皿穴 (外側 = +Y 側)
              translate([x_pos, t - cs_depth/2, h/2])
                  rotate([90, 0, 0])
                      cylinder(d = cs_d, h = cs_depth, center = true);
          }
      }
  }
  
  // モデル出力
  bracket();
SCAD (44 lines)
// L字金具 (L-bracket)
w        = 50;   // 幅
d        = 40;   // 奥行き
h        = 40;   // 高さ
t        = 3;    // 板厚
hole_d   = 4.5;  // 貫通穴径
cs_d     = 8;    // 皿座面径
cs_depth = 2;    // 皿座面深さ
offset   = 10;   // 縁からの距離

module bracket() {
    difference() {
        // 板本体
        union() {
            // 水平フランジ (原点から +Y, +Z 方向に伸びる)
            cube([w, d, t]);
            // 垂直フランジ (原点から +Y, +Z 方向に伸びる)
            cube([w, t, h]);
        }
        // 水平フランジの穴
        for (x_pos = [offset, w - offset]) {
            // 貫通穴
            translate([x_pos, d/2, t/2])
                cylinder(d = hole_d, h = t + 2, center = true);
            // 皿穴 (外側 = +Z 側)
            translate([x_pos, d/2, t - cs_depth/2])
                cylinder(d = cs_d, h = cs_depth, center = true);
        }
        // 垂直フランジの穴
        for (x_pos = [offset, w - offset]) {
            // 貫通穴
            translate([x_pos, t/2, h/2])
                rotate([90, 0, 0])
                    cylinder(d = hole_d, h = t + 2, center = true);
            // 皿穴 (外側 = +Y 側)
            translate([x_pos, t - cs_depth/2, h/2])
                rotate([90, 0, 0])
                    cylinder(d = cs_d, h = cs_depth, center = true);
        }
    }
}

// モデル出力
bracket();
i3 success
iter 3
22.5s · 1684/2596t · $0.0133
diff vs i2: +4/-5
  // L字金具 (L-bracket)
  w        = 50;   // 幅
  d        = 40;   // 奥行き
  h        = 40;   // 高さ
  t        = 3;    // 板厚
  hole_d   = 4.5;  // 貫通穴径
  cs_d     = 8;    // 皿座面径
  cs_depth = 2;    // 皿座面深さ
  offset   = 10;   // 縁からの距離
  
  module bracket() {
      difference() {
          // 板本体
          union() {
-             // 水平フランジ (原点から +Y, +Z 方向に伸びる)
+             // 水平フランジ
              cube([w, d, t]);
-             // 垂直フランジ (原点から +Y, +Z 方向に伸びる)
+             // 垂直フランジ
              cube([w, t, h]);
          }
          // 水平フランジの穴
          for (x_pos = [offset, w - offset]) {
              // 貫通穴
              translate([x_pos, d/2, t/2])
                  cylinder(d = hole_d, h = t + 2, center = true);
-             // 皿穴 (外側 = +Z 側)
+             // 皿穴 (外側=+Z側)
              translate([x_pos, d/2, t - cs_depth/2])
                  cylinder(d = cs_d, h = cs_depth, center = true);
          }
          // 垂直フランジの穴
          for (x_pos = [offset, w - offset]) {
              // 貫通穴
              translate([x_pos, t/2, h/2])
                  rotate([90, 0, 0])
                      cylinder(d = hole_d, h = t + 2, center = true);
-             // 皿穴 (外側 = +Y 側)
+             // 皿穴 (外側=+Y側)
              translate([x_pos, t - cs_depth/2, h/2])
                  rotate([90, 0, 0])
                      cylinder(d = cs_d, h = cs_depth, center = true);
          }
      }
  }
  
- // モデル出力
  bracket();
SCAD (43 lines)
// L字金具 (L-bracket)
w        = 50;   // 幅
d        = 40;   // 奥行き
h        = 40;   // 高さ
t        = 3;    // 板厚
hole_d   = 4.5;  // 貫通穴径
cs_d     = 8;    // 皿座面径
cs_depth = 2;    // 皿座面深さ
offset   = 10;   // 縁からの距離

module bracket() {
    difference() {
        // 板本体
        union() {
            // 水平フランジ
            cube([w, d, t]);
            // 垂直フランジ
            cube([w, t, h]);
        }
        // 水平フランジの穴
        for (x_pos = [offset, w - offset]) {
            // 貫通穴
            translate([x_pos, d/2, t/2])
                cylinder(d = hole_d, h = t + 2, center = true);
            // 皿穴 (外側=+Z側)
            translate([x_pos, d/2, t - cs_depth/2])
                cylinder(d = cs_d, h = cs_depth, center = true);
        }
        // 垂直フランジの穴
        for (x_pos = [offset, w - offset]) {
            // 貫通穴
            translate([x_pos, t/2, h/2])
                rotate([90, 0, 0])
                    cylinder(d = hole_d, h = t + 2, center = true);
            // 皿穴 (外側=+Y側)
            translate([x_pos, t - cs_depth/2, h/2])
                rotate([90, 0, 0])
                    cylinder(d = cs_d, h = cs_depth, center = true);
        }
    }
}

bracket();