vibe-openscad

tier-2-l-bracket / gemini-3.1-flash-lite

6 run / 累計 15.1s / 累計 $0.0058

gemini flash-lite 3.1 bare

bare (provider default effort)

run detail →
render
bare render of tier-2-l-bracket
loading STL…
success 2.1s · 252/377t · $0.0006
SCAD (44 lines)
// パラメータ設定
width = 50;
depth = 40;
height = 40;
thickness = 3;

// ねじ穴設定
hole_dia = 4.5;
cs_dia = 8.0;
cs_depth = 2.0;

module countersunk_hole() {
    union() {
        // 貫通穴
        cylinder(d = hole_dia, h = thickness * 3, center = true);
        // 皿座面
        translate([0, 0, thickness / 2 - cs_depth + 0.01])
            cylinder(d1 = hole_dia, d2 = cs_dia, h = cs_depth);
    }
}

difference() {
    // L字金具の本体
    union() {
        // 水平面
        cube([width, depth, thickness]);
        // 垂直面
        cube([width, thickness, height]);
    }

    // 水平面の穴 (Y方向に10mm内側、X方向に左右対称)
    for (x = [15, 35]) {
        translate([x, 10, -thickness])
            countersunk_hole();
    }

    // 垂直面の穴 (Z方向に10mm内側、X方向に左右対称)
    // 皿座面を外側(Y+)に向けるため回転
    for (x = [15, 35]) {
        translate([x, thickness + thickness, 10])
            rotate([90, 0, 0])
                countersunk_hole();
    }
}
パラメータ (7) —
スライダを動かすと 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: thinking

off success →
off
1.9s · 252/356t · $0.0006
SCAD (38 lines)
// パラメータ設定
width = 50;
depth = 40;
height = 40;
thickness = 3;

hole_dia = 4.5;
cs_dia = 8.0;
cs_depth = 2.0;

module hole() {
    union() {
        cylinder(d = hole_dia, h = thickness + 0.1, $fn = 32);
        translate([0, 0, thickness - cs_depth + 0.05])
            cylinder(d = cs_dia, h = cs_depth + 0.1, $fn = 32);
    }
}

difference() {
    // L字本体
    union() {
        cube([width, depth, thickness]);
        cube([width, thickness, height]);
    }

    // 水平面の穴
    translate([width / 4, 10, 0]) hole();
    translate([width * 3 / 4, 10, 0]) hole();

    // 垂直面の穴
    rotate([-90, 0, 0])
    translate([0, 10, -thickness]) {
        translate([width / 4, height / 2 + 5, 0]) 
            rotate([90, 0, 0]) hole();
        translate([width * 3 / 4, height / 2 + 5, 0]) 
            rotate([90, 0, 0]) hole();
    }
}
adaptivenot run
—
dynamic (default) success →
dynamic
2.1s · 252/377t · $0.0006
SCAD (44 lines)
// パラメータ設定
width = 50;
depth = 40;
height = 40;
thickness = 3;

// ねじ穴設定
hole_dia = 4.5;
cs_dia = 8.0;
cs_depth = 2.0;

module countersunk_hole() {
    union() {
        // 貫通穴
        cylinder(d = hole_dia, h = thickness * 3, center = true);
        // 皿座面
        translate([0, 0, thickness / 2 - cs_depth + 0.01])
            cylinder(d1 = hole_dia, d2 = cs_dia, h = cs_depth);
    }
}

difference() {
    // L字金具の本体
    union() {
        // 水平面
        cube([width, depth, thickness]);
        // 垂直面
        cube([width, thickness, height]);
    }

    // 水平面の穴 (Y方向に10mm内側、X方向に左右対称)
    for (x = [15, 35]) {
        translate([x, 10, -thickness])
            countersunk_hole();
    }

    // 垂直面の穴 (Z方向に10mm内側、X方向に左右対称)
    // 皿座面を外側(Y+)に向けるため回転
    for (x = [15, 35]) {
        translate([x, thickness + thickness, 10])
            rotate([90, 0, 0])
                countersunk_hole();
    }
}

iteration: iter-png

i1 success →
iter 1
2.6s · 1761/466t · $0.0011
diff vs bare: +14/-12
  // パラメータ設定
  width = 50;
  depth = 40;
  height = 40;
  thickness = 3;
  
  // ねじ穴設定
  hole_dia = 4.5;
  cs_dia = 8.0;
  cs_depth = 2.0;
  
- module countersunk_hole() {
+ module countersunk_hole(is_vertical = false) {
      union() {
          // 貫通穴
          cylinder(d = hole_dia, h = thickness * 3, center = true);
-         // 皿座面
-         translate([0, 0, thickness / 2 - cs_depth + 0.01])
+         // 皿座面(外側の面に向けて配置)
+         translate([0, 0, is_vertical ? -thickness / 2 + cs_depth / 2 : thickness / 2 - cs_depth / 2])
              cylinder(d1 = hole_dia, d2 = cs_dia, h = cs_depth);
      }
  }
  
  difference() {
      // L字金具の本体
      union() {
-         // 水平面
+         // 水平面 (Y+方向に伸びる)
          cube([width, depth, thickness]);
-         // 垂直面
+         // 垂直面 (Z+方向に伸びる)
          cube([width, thickness, height]);
      }
  
      // 水平面の穴 (Y方向に10mm内側、X方向に左右対称)
-     for (x = [15, 35]) {
-         translate([x, 10, -thickness])
-             countersunk_hole();
+     // 皿座面は下面(Z-)へ向ける
+     for (x = [12.5, 37.5]) {
+         translate([x, 10 + thickness / 2, 0])
+             rotate([180, 0, 0])
+                 countersunk_hole(false);
      }
  
      // 垂直面の穴 (Z方向に10mm内側、X方向に左右対称)
-     // 皿座面を外側(Y+)に向けるため回転
-     for (x = [15, 35]) {
-         translate([x, thickness + thickness, 10])
+     // 皿座面は背面(Y-)へ向ける
+     for (x = [12.5, 37.5]) {
+         translate([x, 0, 10 + thickness / 2])
              rotate([90, 0, 0])
-                 countersunk_hole();
+                 countersunk_hole(true);
      }
  }
SCAD (46 lines)
// パラメータ設定
width = 50;
depth = 40;
height = 40;
thickness = 3;

// ねじ穴設定
hole_dia = 4.5;
cs_dia = 8.0;
cs_depth = 2.0;

module countersunk_hole(is_vertical = false) {
    union() {
        // 貫通穴
        cylinder(d = hole_dia, h = thickness * 3, center = true);
        // 皿座面(外側の面に向けて配置)
        translate([0, 0, is_vertical ? -thickness / 2 + cs_depth / 2 : thickness / 2 - cs_depth / 2])
            cylinder(d1 = hole_dia, d2 = cs_dia, h = cs_depth);
    }
}

difference() {
    // L字金具の本体
    union() {
        // 水平面 (Y+方向に伸びる)
        cube([width, depth, thickness]);
        // 垂直面 (Z+方向に伸びる)
        cube([width, thickness, height]);
    }

    // 水平面の穴 (Y方向に10mm内側、X方向に左右対称)
    // 皿座面は下面(Z-)へ向ける
    for (x = [12.5, 37.5]) {
        translate([x, 10 + thickness / 2, 0])
            rotate([180, 0, 0])
                countersunk_hole(false);
    }

    // 垂直面の穴 (Z方向に10mm内側、X方向に左右対称)
    // 皿座面は背面(Y-)へ向ける
    for (x = [12.5, 37.5]) {
        translate([x, 0, 10 + thickness / 2])
            rotate([90, 0, 0])
                countersunk_hole(true);
    }
}
i2 success →
iter 2
2.7s · 1850/520t · $0.0012
diff vs i1: +6/-5
  // パラメータ設定
  width = 50;
  depth = 40;
  height = 40;
  thickness = 3;
  
  // ねじ穴設定
  hole_dia = 4.5;
  cs_dia = 8.0;
  cs_depth = 2.0;
  
  module countersunk_hole(is_vertical = false) {
      union() {
          // 貫通穴
          cylinder(d = hole_dia, h = thickness * 3, center = true);
          // 皿座面(外側の面に向けて配置)
+         // 水平面なら下側(Z-)、垂直面なら外側(Y-)に座面を配置
          translate([0, 0, is_vertical ? -thickness / 2 + cs_depth / 2 : thickness / 2 - cs_depth / 2])
              cylinder(d1 = hole_dia, d2 = cs_dia, h = cs_depth);
      }
  }
  
  difference() {
-     // L字金具の本体
+     // L字金具の本体 (内側コーナーが原点)
      union() {
          // 水平面 (Y+方向に伸びる)
          cube([width, depth, thickness]);
          // 垂直面 (Z+方向に伸びる)
          cube([width, thickness, height]);
      }
  
      // 水平面の穴 (Y方向に10mm内側、X方向に左右対称)
-     // 皿座面は下面(Z-)へ向ける
+     // 縁から10mmとは、外端(Y=40)から10mm手前=Y=30の位置
      for (x = [12.5, 37.5]) {
-         translate([x, 10 + thickness / 2, 0])
+         translate([x, 30, 0])
              rotate([180, 0, 0])
                  countersunk_hole(false);
      }
  
      // 垂直面の穴 (Z方向に10mm内側、X方向に左右対称)
-     // 皿座面は背面(Y-)へ向ける
+     // 縁から10mmとは、上端(Z=40)から10mm下=Z=30の位置
      for (x = [12.5, 37.5]) {
-         translate([x, 0, 10 + thickness / 2])
+         translate([x, 0, 30])
              rotate([90, 0, 0])
                  countersunk_hole(true);
      }
  }
SCAD (47 lines)
// パラメータ設定
width = 50;
depth = 40;
height = 40;
thickness = 3;

// ねじ穴設定
hole_dia = 4.5;
cs_dia = 8.0;
cs_depth = 2.0;

module countersunk_hole(is_vertical = false) {
    union() {
        // 貫通穴
        cylinder(d = hole_dia, h = thickness * 3, center = true);
        // 皿座面(外側の面に向けて配置)
        // 水平面なら下側(Z-)、垂直面なら外側(Y-)に座面を配置
        translate([0, 0, is_vertical ? -thickness / 2 + cs_depth / 2 : thickness / 2 - cs_depth / 2])
            cylinder(d1 = hole_dia, d2 = cs_dia, h = cs_depth);
    }
}

difference() {
    // L字金具の本体 (内側コーナーが原点)
    union() {
        // 水平面 (Y+方向に伸びる)
        cube([width, depth, thickness]);
        // 垂直面 (Z+方向に伸びる)
        cube([width, thickness, height]);
    }

    // 水平面の穴 (Y方向に10mm内側、X方向に左右対称)
    // 縁から10mmとは、外端(Y=40)から10mm手前=Y=30の位置
    for (x = [12.5, 37.5]) {
        translate([x, 30, 0])
            rotate([180, 0, 0])
                countersunk_hole(false);
    }

    // 垂直面の穴 (Z方向に10mm内側、X方向に左右対称)
    // 縁から10mmとは、上端(Z=40)から10mm下=Z=30の位置
    for (x = [12.5, 37.5]) {
        translate([x, 0, 30])
            rotate([90, 0, 0])
                countersunk_hole(true);
    }
}
i3 success →
iter 3
3.6s · 1904/725t · $0.0016
diff vs i2: +36/-15
  // パラメータ設定
  width = 50;
  depth = 40;
  height = 40;
  thickness = 3;
  
  // ねじ穴設定
  hole_dia = 4.5;
  cs_dia = 8.0;
  cs_depth = 2.0;
  
+ // 皿穴モジュール(外側の面から座ぐりが入るように調整)
  module countersunk_hole(is_vertical = false) {
      union() {
          // 貫通穴
          cylinder(d = hole_dia, h = thickness * 3, center = true);
-         // 皿座面(外側の面に向けて配置)
-         // 水平面なら下側(Z-)、垂直面なら外側(Y-)に座面を配置
-         translate([0, 0, is_vertical ? -thickness / 2 + cs_depth / 2 : thickness / 2 - cs_depth / 2])
-             cylinder(d1 = hole_dia, d2 = cs_dia, h = cs_depth);
+         // 皿座面:外側の面(水平面なら下面、垂直面なら背面)に向けて配置
+         if (is_vertical) {
+             // 垂直面:Y=3(外側)の面から座ぐりを入れる
+             translate([0, -thickness/2 + cs_depth/2, 0])
+                 rotate([90, 0, 0])
+                     cylinder(d1 = hole_dia, d2 = cs_dia, h = cs_depth);
+         } else {
+             // 水平面:Z=0(下面)の面から座ぐりを入れる
+             translate([0, 0, -thickness/2 + cs_depth/2])
+                 cylinder(d1 = hole_dia, d2 = cs_dia, h = cs_depth);
+         }
      }
  }
  
  difference() {
-     // L字金具の本体 (内側コーナーが原点)
+     // L字金具の本体
      union() {
-         // 水平面 (Y+方向に伸びる)
+         // 水平面 (Y+方向に40mm伸びる)
          cube([width, depth, thickness]);
-         // 垂直面 (Z+方向に伸びる)
+         // 垂直面 (Z+方向に40mm伸びる)
          cube([width, thickness, height]);
      }
  
-     // 水平面の穴 (Y方向に10mm内側、X方向に左右対称)
-     // 縁から10mmとは、外端(Y=40)から10mm手前=Y=30の位置
+     // 水平面の穴 (Y方向に縁から10mm内側 = Y=30)
      for (x = [12.5, 37.5]) {
          translate([x, 30, 0])
-             rotate([180, 0, 0])
-                 countersunk_hole(false);
+             countersunk_hole(false);
      }
  
-     // 垂直面の穴 (Z方向に10mm内側、X方向に左右対称)
-     // 縁から10mmとは、上端(Z=40)から10mm下=Z=30の位置
-     for (x = [12.5, 37.5]) {
-         translate([x, 0, 30])
+     // 垂直面の穴 (Z方向に縁から10mm内側 = Z=30)
+     for (x = [12.5, 3]) { // ※左右対称配置を修正
+         translate([x, thickness/2, 30])
              rotate([90, 0, 0])
                  countersunk_hole(true);
      }
+ }
+ 
+ // 補足:X方向の配置を [12.5, 37.5] に統一
+ difference() {
+     union() {
+         cube([width, depth, thickness]);
+         cube([width, thickness, height]);
+     }
+     // 水平面用穴
+     for (x = [12.5, 37.5]) {
+         translate([x, 30, 0]) countersunk_hole(false);
+     }
+     // 垂直面用穴
+     for (x = [12.5, 37.5]) {
+         translate([x, thickness/2, 30]) rotate([90, 0, 0]) countersunk_hole(true);
+     }
  }
SCAD (68 lines)
// パラメータ設定
width = 50;
depth = 40;
height = 40;
thickness = 3;

// ねじ穴設定
hole_dia = 4.5;
cs_dia = 8.0;
cs_depth = 2.0;

// 皿穴モジュール(外側の面から座ぐりが入るように調整)
module countersunk_hole(is_vertical = false) {
    union() {
        // 貫通穴
        cylinder(d = hole_dia, h = thickness * 3, center = true);
        // 皿座面:外側の面(水平面なら下面、垂直面なら背面)に向けて配置
        if (is_vertical) {
            // 垂直面:Y=3(外側)の面から座ぐりを入れる
            translate([0, -thickness/2 + cs_depth/2, 0])
                rotate([90, 0, 0])
                    cylinder(d1 = hole_dia, d2 = cs_dia, h = cs_depth);
        } else {
            // 水平面:Z=0(下面)の面から座ぐりを入れる
            translate([0, 0, -thickness/2 + cs_depth/2])
                cylinder(d1 = hole_dia, d2 = cs_dia, h = cs_depth);
        }
    }
}

difference() {
    // L字金具の本体
    union() {
        // 水平面 (Y+方向に40mm伸びる)
        cube([width, depth, thickness]);
        // 垂直面 (Z+方向に40mm伸びる)
        cube([width, thickness, height]);
    }

    // 水平面の穴 (Y方向に縁から10mm内側 = Y=30)
    for (x = [12.5, 37.5]) {
        translate([x, 30, 0])
            countersunk_hole(false);
    }

    // 垂直面の穴 (Z方向に縁から10mm内側 = Z=30)
    for (x = [12.5, 3]) { // ※左右対称配置を修正
        translate([x, thickness/2, 30])
            rotate([90, 0, 0])
                countersunk_hole(true);
    }
}

// 補足:X方向の配置を [12.5, 37.5] に統一
difference() {
    union() {
        cube([width, depth, thickness]);
        cube([width, thickness, height]);
    }
    // 水平面用穴
    for (x = [12.5, 37.5]) {
        translate([x, 30, 0]) countersunk_hole(false);
    }
    // 垂直面用穴
    for (x = [12.5, 37.5]) {
        translate([x, thickness/2, 30]) rotate([90, 0, 0]) countersunk_hole(true);
    }
}