vibe-openscad

tier-2-l-bracket / gpt-6-astra

6 run / 累計 172.0s / 累計 $0.5712

openai gpt 6 astra bare

bare (provider default effort)

run detail →
render
bare render of tier-2-l-bracket
loading STL…
success 13.7s · 294/900t · $0.0479
SCAD (62 lines)
// 単位: mm
$fn = 96;

width = 50;
depth = 40;
height = 40;
thickness = 3;

hole_d = 4.5;
countersink_d = 8;
countersink_depth = 2;
edge_offset = 10;

eps = 0.01;

// 局所座標の Z=0 が外側表面、+Z が板の内側。
module countersunk_hole() {
    translate([0, 0, -eps])
        cylinder(
            h = thickness + 2 * eps,
            d = hole_d
        );

    translate([0, 0, -eps])
        cylinder(
            h = countersink_depth + eps,
            d1 = countersink_d
                 + (countersink_d - hole_d)
                   * eps / countersink_depth,
            d2 = hole_d
        );
}

difference() {
    union() {
        // 水平フランジ: 内側表面 Z=0、+Y 方向。
        translate([-width / 2, 0, -thickness])
            cube([width, depth, thickness]);

        // 垂直フランジ: 内側表面 Y=0、+Z 方向。
        translate([-width / 2, -thickness, 0])
            cube([width, thickness, height]);

        // 内側コーナーを原点とし、外側の角を埋めて一体化。
        translate([-width / 2, -thickness, -thickness])
            cube([width, thickness, thickness]);
    }

    for (x = [
        -width / 2 + edge_offset,
         width / 2 - edge_offset
    ]) {
        // 水平面: 皿座面は下面(-Z 側)。
        translate([x, depth / 2, -thickness])
            countersunk_hole();

        // 垂直面: 皿座面は背面(-Y 側)。
        translate([x, -thickness, height / 2])
            rotate([-90, 0, 0])
                countersunk_hole();
    }
}
パラメータ (9) —
スライダを動かすと 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
11.5s · 294/766t · $0.0412
SCAD (68 lines)
// 単位: mm
$fn = 96;

width = 50;
depth = 40;
height = 40;
thickness = 3;

hole_diameter = 4.5;
countersink_diameter = 8;
countersink_depth = 2;
edge_offset = 10;

eps = 0.01;

// 内側コーナー: Y=0, Z=0。幅方向は X=0 を中心に配置。
module bracket_body() {
    union() {
        // 水平フランジ: +Y 方向
        translate([-width / 2, 0, -thickness])
            cube([width, depth, thickness]);

        // 垂直フランジ: +Z 方向
        translate([-width / 2, -thickness, 0])
            cube([width, thickness, height]);

        // 直角接続部
        translate([-width / 2, -thickness, -thickness])
            cube([width, thickness, thickness]);
    }
}

// ローカル Z=0 が外側表面、+Z が板内部へ向かう方向
module countersunk_hole() {
    taper = (countersink_diameter - hole_diameter)
            / (2 * countersink_depth);

    union() {
        translate([0, 0, -eps])
            cylinder(
                h = thickness + 2 * eps,
                d = hole_diameter
            );

        translate([0, 0, -eps])
            cylinder(
                h = countersink_depth + eps,
                d1 = countersink_diameter + 2 * eps * taper,
                d2 = hole_diameter
            );
    }
}

difference() {
    bracket_body();

    for (x = [-width / 2 + edge_offset,
               width / 2 - edge_offset]) {
        // 水平面: 中心線 Y=20、皿座面は下面 (-Z)
        translate([x, depth / 2, -thickness])
            countersunk_hole();

        // 垂直面: 中心線 Z=20、皿座面は背面 (-Y)
        translate([x, -thickness, height / 2])
            rotate([-90, 0, 0])
                countersunk_hole();
    }
}
medium (default) success →
medium
13.7s · 294/900t · $0.0479
SCAD (62 lines)
// 単位: mm
$fn = 96;

width = 50;
depth = 40;
height = 40;
thickness = 3;

hole_d = 4.5;
countersink_d = 8;
countersink_depth = 2;
edge_offset = 10;

eps = 0.01;

// 局所座標の Z=0 が外側表面、+Z が板の内側。
module countersunk_hole() {
    translate([0, 0, -eps])
        cylinder(
            h = thickness + 2 * eps,
            d = hole_d
        );

    translate([0, 0, -eps])
        cylinder(
            h = countersink_depth + eps,
            d1 = countersink_d
                 + (countersink_d - hole_d)
                   * eps / countersink_depth,
            d2 = hole_d
        );
}

difference() {
    union() {
        // 水平フランジ: 内側表面 Z=0、+Y 方向。
        translate([-width / 2, 0, -thickness])
            cube([width, depth, thickness]);

        // 垂直フランジ: 内側表面 Y=0、+Z 方向。
        translate([-width / 2, -thickness, 0])
            cube([width, thickness, height]);

        // 内側コーナーを原点とし、外側の角を埋めて一体化。
        translate([-width / 2, -thickness, -thickness])
            cube([width, thickness, thickness]);
    }

    for (x = [
        -width / 2 + edge_offset,
         width / 2 - edge_offset
    ]) {
        // 水平面: 皿座面は下面(-Z 側)。
        translate([x, depth / 2, -thickness])
            countersunk_hole();

        // 垂直面: 皿座面は背面(-Y 側)。
        translate([x, -thickness, height / 2])
            rotate([-90, 0, 0])
                countersunk_hole();
    }
}
high success →
high
30.5s · 294/1865t · $0.0962
SCAD (73 lines)
// 寸法単位: mm
// 内側コーナー: Y=0, Z=0
// 幅方向の中心: X=0
// 水平フランジは +Y、垂直フランジは +Z に伸びる。

$fn = 96;

width     = 50;
depth     = 40;
height    = 40;
thickness = 3;

hole_diameter        = 4.5;
countersink_diameter = 8;
countersink_depth    = 2;
edge_offset          = 10;

eps = 0.01;

// 外側表面をローカル Z=0 とし、+Z 方向に切削する。
module countersunk_hole() {
    union() {
        translate([0, 0, -eps])
            cylinder(
                h = thickness + 2 * eps,
                d = hole_diameter
            );

        // 表面での直径を正確に保ちながら、外側へ微小延長する。
        translate([0, 0, -eps])
            cylinder(
                h  = countersink_depth + eps,
                d1 = countersink_diameter
                     + (countersink_diameter - hole_diameter)
                       * eps / countersink_depth,
                d2 = hole_diameter
            );
    }
}

module bracket_body() {
    union() {
        // 水平フランジ: 50 × 40 × 3
        translate([-width / 2, 0, -thickness])
            cube([width, depth, thickness]);

        // 垂直フランジ: 50 × 3 × 40
        translate([-width / 2, -thickness, 0])
            cube([width, thickness, height]);

        // コーナーの板厚部分を埋め、両フランジを一体化する。
        translate([-width / 2, -thickness, -thickness])
            cube([width, thickness, thickness]);
    }
}

difference() {
    bracket_body();

    for (x = [
        -width / 2 + edge_offset,
         width / 2 - edge_offset
    ]) {
        // 水平面: 奥行き中心線上。皿座面は -Z 側。
        translate([x, depth / 2, -thickness])
            countersunk_hole();

        // 垂直面: 高さ中心線上。皿座面は -Y 側。
        translate([x, -thickness, height / 2])
            rotate([-90, 0, 0])
                countersunk_hole();
    }
}
max success →
max
58.9s · 294/3764t · $0.1911
SCAD (61 lines)
// 単位: mm
// 内側コーナー: Y=0, Z=0。幅方向 X は原点に対して左右対称。
$fn = 96;

width = 50;
depth = 40;
height = 40;
thickness = 3;

edge_offset = 10;
hole_d = 4.5;
countersink_d = 8;
countersink_depth = 2;

eps = 0.01;
hole_x = [-width / 2 + edge_offset, width / 2 - edge_offset];

// ローカル Z=0 が外側面、+Z が板の内部方向。
module countersunk_hole() {
    union() {
        translate([0, 0, -eps])
            cylinder(h = thickness + 2 * eps, d = hole_d);

        // 外側面で正確に Φ8、深さ2mmで Φ4.5 となる円錐台。
        translate([0, 0, -eps])
            cylinder(
                h = countersink_depth + eps,
                d1 = countersink_d
                     + (countersink_d - hole_d)
                     * eps / countersink_depth,
                d2 = hole_d
            );
    }
}

difference() {
    union() {
        // 水平フランジ: 内側面は Y=0~40、Z=0。
        translate([-width / 2, 0, -thickness])
            cube([width, depth, thickness]);

        // 垂直フランジ: 内側面は Y=0、Z=0~40。
        translate([-width / 2, -thickness, 0])
            cube([width, thickness, height]);

        // 外側コーナーを埋め、両フランジを一体化。
        translate([-width / 2, -thickness, -thickness])
            cube([width, thickness, thickness]);
    }

    for (x = hole_x) {
        // 水平面: 奥行き中央。皿座面は外側の -Z 向き。
        translate([x, depth / 2, -thickness])
            countersunk_hole();

        // 垂直面: 高さ中央。皿座面は外側の -Y 向き。
        translate([x, -thickness, height / 2])
            rotate([-90, 0, 0])
                countersunk_hole();
    }
}
xhigh success →
xhigh
43.7s · 294/2877t · $0.1468
SCAD (63 lines)
$fn = 96;

// 寸法(mm)
width             = 50;
horizontal_depth  = 40;
vertical_height   = 40;
thickness         = 3;

edge_offset       = 10;
hole_diameter     = 4.5;
sink_diameter     = 8;
sink_depth        = 2;

eps = 0.01;

// 外側表面をローカル z=0 とし、+Z 方向へ穴を掘る。
module countersunk_hole() {
    // 貫通穴
    translate([0, 0, -eps])
        cylinder(
            h = thickness + 2 * eps,
            d = hole_diameter
        );

    // 円錐状の皿座面。
    // 表面で正確に Φ8、深さ 2 mm で Φ4.5 となる。
    translate([0, 0, -eps])
        cylinder(
            h  = sink_depth + eps,
            d1 = sink_diameter
                 + (sink_diameter - hole_diameter)
                   * eps / sink_depth,
            d2 = hole_diameter
        );
}

difference() {
    union() {
        // 水平フランジ:内側面 z=0、+Y 方向。
        translate([-width / 2, 0, -thickness])
            cube([width, horizontal_depth, thickness]);

        // 垂直フランジ:内側面 y=0、+Z 方向。
        translate([-width / 2, -thickness, 0])
            cube([width, thickness, vertical_height]);

        // 内側コーナーの外側を埋め、両フランジを一体化。
        translate([-width / 2, -thickness, -thickness])
            cube([width, thickness, thickness]);
    }

    for (x = [-width / 2 + edge_offset,
               width / 2 - edge_offset]) {
        // 水平面:中心線 y=20、皿座面は外側(-Z)。
        translate([x, horizontal_depth / 2, -thickness])
            countersunk_hole();

        // 垂直面:中心線 z=20、皿座面は外側(-Y)。
        translate([x, -thickness, vertical_height / 2])
            rotate([-90, 0, 0])
                countersunk_hole();
    }
}