vibe-openscad

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

6 run / 累計 21.4s / 累計 $0.0016

gemini flash-lite 3.1 preview bare

bare (provider default effort)

run detail →
render
bare render of tier-2-l-bracket
loading STL…
success 2.8s · 252/355t · $0.0002
SCAD (44 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 * 2, center = true);
        translate([0, 0, thickness / 2 - cs_depth + 0.01])
            cylinder(d = cs_dia, h = cs_depth, $fn = 32);
    }
}

module l_bracket() {
    difference() {
        union() {
            // 水平面
            cube([width, depth, thickness]);
            // 垂直面
            cube([width, thickness, height]);
        }

        // 水平面の穴
        for (x = [-1, 1]) {
            translate([width / 2 + x * 15, 10 + (depth - 10) / 2, -thickness])
                hole();
        }

        // 垂直面の穴
        for (x = [-1, 1]) {
            translate([width / 2 + x * 15, thickness + 1, 10 + (height - 10) / 2])
                rotate([90, 0, 0])
                    hole();
        }
    }
}

$fn = 64;
l_bracket();
パラメータ (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
2.9s · 252/394t · $0.0002
SCAD (42 lines)
// パラメータ設定
width = 50;
h_depth = 40;
v_height = 40;
thickness = 3;

hole_dia = 4.5;
countersink_dia = 8;
countersink_depth = 2;

// 皿穴モジュール
module countersunk_hole() {
    union() {
        cylinder(d = hole_dia, h = thickness + 0.1, $fn = 32);
        translate([0, 0, thickness - countersink_depth + 0.05])
            cylinder(d1 = hole_dia, d2 = countersink_dia, h = countersink_depth, $fn = 32);
    }
}

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

    // 水平面の穴 (Y方向に10mm内側、X方向に左右対称)
    for (x = [-1, 1]) {
        translate([width / 2 + x * 15, 10, -0.05])
            rotate([0, 0, 0])
                countersunk_hole();
    }

    // 垂直面の穴 (Z方向に10mm内側、X方向に左右対称)
    for (x = [-1, 1]) {
        translate([width / 2 + x * 15, -0.05, 10])
            rotate([-90, 0, 0])
                countersunk_hole();
    }
}
adaptivenot run
dynamic (default) success
dynamic
2.8s · 252/355t · $0.0002
SCAD (44 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 * 2, center = true);
        translate([0, 0, thickness / 2 - cs_depth + 0.01])
            cylinder(d = cs_dia, h = cs_depth, $fn = 32);
    }
}

module l_bracket() {
    difference() {
        union() {
            // 水平面
            cube([width, depth, thickness]);
            // 垂直面
            cube([width, thickness, height]);
        }

        // 水平面の穴
        for (x = [-1, 1]) {
            translate([width / 2 + x * 15, 10 + (depth - 10) / 2, -thickness])
                hole();
        }

        // 垂直面の穴
        for (x = [-1, 1]) {
            translate([width / 2 + x * 15, thickness + 1, 10 + (height - 10) / 2])
                rotate([90, 0, 0])
                    hole();
        }
    }
}

$fn = 64;
l_bracket();

iteration: iter-png

i1 success
iter 1
4.0s · 1739/523t · $0.0004
diff vs bare: +16/-11
  // パラメータ設定
  width = 50;
  depth = 40;
  height = 40;
  thickness = 3;
  
  hole_dia = 4.5;
  cs_dia = 8.0;
  cs_depth = 2.0;
  
- module hole() {
+ // 皿穴モジュール(外側から皿座面を彫る)
+ module hole_h(inverted = false) {
      union() {
+         // 貫通穴
          cylinder(d = hole_dia, h = thickness * 2, center = true);
-         translate([0, 0, thickness / 2 - cs_depth + 0.01])
-             cylinder(d = cs_dia, h = cs_depth, $fn = 32);
+         // 皿座面
+         translate([0, 0, inverted ? -thickness/2 + cs_depth/2 : thickness/2 - cs_depth/2])
+             cylinder(d = cs_dia, h = cs_depth, center = true, $fn = 32);
      }
  }
  
  module l_bracket() {
      difference() {
          union() {
-             // 水平面
+             // 水平面 (Y方向に40mm)
              cube([width, depth, thickness]);
-             // 垂直面
+             // 垂直面 (Z方向に40mm)
              cube([width, thickness, height]);
          }
  
-         // 水平面の穴
+         // 水平面の穴: 縁から10mm内側 (Y=10とY=30の位置)
+         // 水平面の上面(Z=3)側から皿座面を彫るため、invertedをfalseにする
          for (x = [-1, 1]) {
-             translate([width / 2 + x * 15, 10 + (depth - 10) / 2, -thickness])
-                 hole();
+             translate([width / 2 + x * 10, 10 + (depth - 20) / 2, 0])
+                 hole_h(inverted = false);
          }
  
-         // 垂直面の穴
+         // 垂直面の穴: 縁から10mm内側 (Z=10とZ=30の位置)
+         // 垂直面の前面(Y=3)側から皿座面を彫るため、invertedをtrueにする
          for (x = [-1, 1]) {
-             translate([width / 2 + x * 15, thickness + 1, 10 + (height - 10) / 2])
+             translate([width / 2 + x * 10, 0, 10 + (height - 20) / 2])
                  rotate([90, 0, 0])
-                     hole();
+                     hole_h(inverted = true);
          }
      }
  }
  
  $fn = 64;
  l_bracket();
SCAD (49 lines)
// パラメータ設定
width = 50;
depth = 40;
height = 40;
thickness = 3;

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

// 皿穴モジュール(外側から皿座面を彫る)
module hole_h(inverted = false) {
    union() {
        // 貫通穴
        cylinder(d = hole_dia, h = thickness * 2, center = true);
        // 皿座面
        translate([0, 0, inverted ? -thickness/2 + cs_depth/2 : thickness/2 - cs_depth/2])
            cylinder(d = cs_dia, h = cs_depth, center = true, $fn = 32);
    }
}

module l_bracket() {
    difference() {
        union() {
            // 水平面 (Y方向に40mm)
            cube([width, depth, thickness]);
            // 垂直面 (Z方向に40mm)
            cube([width, thickness, height]);
        }

        // 水平面の穴: 縁から10mm内側 (Y=10とY=30の位置)
        // 水平面の上面(Z=3)側から皿座面を彫るため、invertedをfalseにする
        for (x = [-1, 1]) {
            translate([width / 2 + x * 10, 10 + (depth - 20) / 2, 0])
                hole_h(inverted = false);
        }

        // 垂直面の穴: 縁から10mm内側 (Z=10とZ=30の位置)
        // 垂直面の前面(Y=3)側から皿座面を彫るため、invertedをtrueにする
        for (x = [-1, 1]) {
            translate([width / 2 + x * 10, 0, 10 + (height - 20) / 2])
                rotate([90, 0, 0])
                    hole_h(inverted = true);
        }
    }
}

$fn = 64;
l_bracket();
i2 success
iter 2
5.7s · 1907/434t · $0.0004
diff vs i1: +15/-15
  // パラメータ設定
  width = 50;
  depth = 40;
  height = 40;
  thickness = 3;
  
  hole_dia = 4.5;
  cs_dia = 8.0;
  cs_depth = 2.0;
  
- // 皿穴モジュール(外側から皿座面を彫る)
- module hole_h(inverted = false) {
+ // 皿穴モジュール
+ module countersunk_hole() {
      union() {
          // 貫通穴
-         cylinder(d = hole_dia, h = thickness * 2, center = true);
-         // 皿座面
-         translate([0, 0, inverted ? -thickness/2 + cs_depth/2 : thickness/2 - cs_depth/2])
+         cylinder(d = hole_dia, h = thickness * 3, center = true);
+         // 皿座面(板の厚みに対して片側に配置)
+         translate([0, 0, thickness/2 - cs_depth/2])
              cylinder(d = cs_dia, h = cs_depth, center = true, $fn = 32);
      }
  }
  
  module l_bracket() {
      difference() {
          union() {
              // 水平面 (Y方向に40mm)
              cube([width, depth, thickness]);
              // 垂直面 (Z方向に40mm)
              cube([width, thickness, height]);
          }
  
-         // 水平面の穴: 縁から10mm内側 (Y=10とY=30の位置)
-         // 水平面の上面(Z=3)側から皿座面を彫るため、invertedをfalseにする
-         for (x = [-1, 1]) {
-             translate([width / 2 + x * 10, 10 + (depth - 20) / 2, 0])
-                 hole_h(inverted = false);
+         // 水平面の穴
+         // 縁(Y=40)から10mm内側なのでY=30、左右対称に配置
+         for (x = [-10, 10]) {
+             translate([width / 2 + x, 30, 0])
+                 countersunk_hole();
          }
  
-         // 垂直面の穴: 縁から10mm内側 (Z=10とZ=30の位置)
-         // 垂直面の前面(Y=3)側から皿座面を彫るため、invertedをtrueにする
-         for (x = [-1, 1]) {
-             translate([width / 2 + x * 10, 0, 10 + (height - 20) / 2])
+         // 垂直面の穴
+         // 縁(Z=40)から10mm内側なのでZ=30、左右対称に配置
+         for (x = [-10, 10]) {
+             translate([width / 2 + x, 0, 30])
                  rotate([90, 0, 0])
-                     hole_h(inverted = true);
+                     countersunk_hole();
          }
      }
  }
  
  $fn = 64;
  l_bracket();
SCAD (49 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/2])
            cylinder(d = cs_dia, h = cs_depth, center = true, $fn = 32);
    }
}

module l_bracket() {
    difference() {
        union() {
            // 水平面 (Y方向に40mm)
            cube([width, depth, thickness]);
            // 垂直面 (Z方向に40mm)
            cube([width, thickness, height]);
        }

        // 水平面の穴
        // 縁(Y=40)から10mm内側なのでY=30、左右対称に配置
        for (x = [-10, 10]) {
            translate([width / 2 + x, 30, 0])
                countersunk_hole();
        }

        // 垂直面の穴
        // 縁(Z=40)から10mm内側なのでZ=30、左右対称に配置
        for (x = [-10, 10]) {
            translate([width / 2 + x, 0, 30])
                rotate([90, 0, 0])
                    countersunk_hole();
        }
    }
}

$fn = 64;
l_bracket();
i3 success
iter 3
3.2s · 1818/479t · $0.0004
diff vs i2: +13/-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/2])
-             cylinder(d = cs_dia, h = cs_depth, center = true, $fn = 32);
+         cylinder(d = hole_dia, h = thickness * 2, center = true);
+         // 皿座面
+         translate([0, 0, is_vertical ? -thickness/2 + cs_depth/2 : thickness/2 - cs_depth/2])
+             cylinder(d = cs_dia, h = cs_depth, center = true, $fn = 64);
      }
  }
  
  module l_bracket() {
      difference() {
          union() {
              // 水平面 (Y方向に40mm)
              cube([width, depth, thickness]);
              // 垂直面 (Z方向に40mm)
              cube([width, thickness, height]);
          }
  
-         // 水平面の穴
-         // 縁(Y=40)から10mm内側なのでY=30、左右対称に配置
+         // 水平面の穴(上面から掘る)
+         // 縁(Y=40)から10mm内側 = Y=30
          for (x = [-10, 10]) {
              translate([width / 2 + x, 30, 0])
-                 countersunk_hole();
+                 countersunk_hole(is_vertical = false);
          }
  
-         // 垂直面の穴
-         // 縁(Z=40)から10mm内側なのでZ=30、左右対称に配置
+         // 垂直面の穴(背面から掘る)
+         // 縁(Z=40)から10mm内側 = Z=30
          for (x = [-10, 10]) {
-             translate([width / 2 + x, 0, 30])
+             translate([width / 2 + x, thickness, 30])
                  rotate([90, 0, 0])
-                     countersunk_hole();
+                     countersunk_hole(is_vertical = true);
          }
      }
  }
  
  $fn = 64;
  l_bracket();
SCAD (50 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 * 2, center = true);
        // 皿座面
        translate([0, 0, is_vertical ? -thickness/2 + cs_depth/2 : thickness/2 - cs_depth/2])
            cylinder(d = cs_dia, h = cs_depth, center = true, $fn = 64);
    }
}

module l_bracket() {
    difference() {
        union() {
            // 水平面 (Y方向に40mm)
            cube([width, depth, thickness]);
            // 垂直面 (Z方向に40mm)
            cube([width, thickness, height]);
        }

        // 水平面の穴(上面から掘る)
        // 縁(Y=40)から10mm内側 = Y=30
        for (x = [-10, 10]) {
            translate([width / 2 + x, 30, 0])
                countersunk_hole(is_vertical = false);
        }

        // 垂直面の穴(背面から掘る)
        // 縁(Z=40)から10mm内側 = Z=30
        for (x = [-10, 10]) {
            translate([width / 2 + x, thickness, 30])
                rotate([90, 0, 0])
                    countersunk_hole(is_vertical = true);
        }
    }
}

$fn = 64;
l_bracket();