vibe-openscad

tier-3-butt-hinge / gpt-5.6-sol

6 run / 累計 484.0s / 累計 $1.08

openai gpt 5.6 sol bare

bare (provider default effort)

run detail →
render
bare render of tier-3-butt-hinge
loading STL…
success 37.5s · 592/2725t · $0.0847
SCAD (115 lines)
$fn = 96;

leaf_length      = 30;
leaf_width       = 25;
leaf_thickness   = 2;

knuckle_length   = 6;
knuckle_od       = 8;
knuckle_id       = 4.6;

pin_diameter     = 4;
pin_length       = 32;

through_diameter = 3.2;
countersink_dia  = 6;
countersink_depth = 1;

attach_overlap   = 0.2;
knuckle_radius   = knuckle_od / 2;
leaf_inner_x     = knuckle_radius - attach_overlap;

eps = 0.02;

module y_cylinder(y0, length, diameter) {
    translate([0, y0, 0])
        rotate([-90, 0, 0])
            cylinder(h = length, d = diameter);
}

module knuckle(y0) {
    difference() {
        y_cylinder(y0, knuckle_length, knuckle_od);
        y_cylinder(y0 - eps, knuckle_length + 2 * eps, knuckle_id);
    }
}

module countersunk_hole(x, y) {
    translate([x, y, -leaf_thickness])
        cylinder(
            h = leaf_thickness * 2,
            d = through_diameter
        );

    translate([x, y, leaf_thickness / 2 - countersink_depth])
        cylinder(
            h = countersink_depth + eps,
            d1 = through_diameter,
            d2 = countersink_dia
        );
}

module left_leaf() {
    difference() {
        union() {
            translate([
                -leaf_inner_x - leaf_width,
                0,
                -leaf_thickness / 2
            ])
                cube([
                    leaf_width,
                    leaf_length,
                    leaf_thickness
                ]);

            for (y0 = [0, 12, 24])
                knuckle(y0);
        }

        for (y = [7, 15, 23])
            countersunk_hole(
                -leaf_inner_x - leaf_width + 7.5,
                y
            );
    }
}

module right_leaf() {
    difference() {
        union() {
            translate([
                leaf_inner_x,
                0,
                -leaf_thickness / 2
            ])
                cube([
                    leaf_width,
                    leaf_length,
                    leaf_thickness
                ]);

            for (y0 = [6, 18])
                knuckle(y0);
        }

        for (y = [7, 15, 23])
            countersunk_hole(
                leaf_inner_x + leaf_width - 7.5,
                y
            );
    }
}

module hinge_pin() {
    y_cylinder(-1, pin_length, pin_diameter);
}

color([0.68, 0.70, 0.73])
    left_leaf();

color([0.58, 0.61, 0.65])
    right_leaf();

color([0.82, 0.84, 0.86])
    hinge_pin();
パラメータ (13) —
スライダを動かすと openscad-wasm で再レンダリング

prompt

OpenSCAD で、家具用の小型バット蝶番(butt hinge)を作ってください。
3 つのパーツ(左板、右板、ピン軸)が組み合わさって動作する完成品を、
「開いた状態(180°)」で 1 つの SCAD ファイルに配置して出力します。

寸法と配置:
- 板(leaf)2 枚: 30mm × 25mm × 厚さ 2mm の鉄板形状
  - 縦 30mm の辺がピン軸に沿う(ヒンジ軸方向)
  - 横 25mm の辺が回転で開く方向に伸びる
- ピン軸: 直径 4mm の円柱、長さ 32mm(両端 1mm ずつ knuckle から飛び出す)
- knuckle(筒部): 縦 30mm を 5 等分(各 6mm)に区切り、左板に 3 個・右板に 2 個を
  互い違いに配置(左板は外側 2 個 + 中央 1 個、右板は中間 2 個)
- knuckle 外径 8mm、内径はピン軸 + 0.3mm クリアランス(= 4.6mm 穴)
- 左板と右板はピン軸を共有して回転可能。180° 開いた状態で、両板の
  平らな面が同一平面に来るように配置する
- 各板の knuckle から離れた側に、M3 用の皿穴を 3 個ずつ
  (穴ピッチは板の縦方向に 8mm 間隔、皿穴は表面から見て直径 6mm × 深さ 1mm
  のテーパ + 直径 3.2mm の貫通穴)

座標系:
- ピン軸の中心線を Y 軸に重ねる(ピン軸は +Y 方向)
- 板の平らな面は Z 軸に直交し、左板が x<0 側、右板が x>0 側に伸びる(180° 開)
- knuckle は X=0 を中心とし、Y 方向に 6mm ずつ並ぶ

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

variant: effort

low success →
low
19.3s · 592/1484t · $0.0475
SCAD (94 lines)
$fn = 96;

leaf_length      = 30;
leaf_width       = 25;
leaf_thickness   = 2;

knuckle_length   = 6;
knuckle_od       = 8;
knuckle_id       = 4.6;

pin_diameter     = 4;
pin_length       = 32;

through_diameter = 3.2;
countersink_dia  = 6;
countersink_depth = 1;

eps = 0.02;

module y_cylinder(h, d) {
    rotate([-90, 0, 0])
        cylinder(h = h, d = d);
}

module knuckle(y_pos) {
    difference() {
        translate([0, y_pos, 0])
            y_cylinder(knuckle_length, knuckle_od);

        translate([0, y_pos - eps, 0])
            y_cylinder(knuckle_length + 2 * eps, knuckle_id);
    }
}

module countersunk_hole(x_pos, y_pos) {
    // M3 clearance through-hole
    translate([x_pos, y_pos, -leaf_thickness / 2 - eps])
        cylinder(
            h = leaf_thickness + 2 * eps,
            d = through_diameter
        );

    // Countersink from the upper surface
    translate([x_pos, y_pos, 0])
        cylinder(
            h = countersink_depth + eps,
            d1 = through_diameter,
            d2 = countersink_dia
        );
}

module left_leaf() {
    difference() {
        union() {
            translate([-leaf_width, 0, -leaf_thickness / 2])
                cube([leaf_width, leaf_length, leaf_thickness]);

            for (y_pos = [0, 12, 24])
                knuckle(y_pos);
        }

        for (y_pos = [7, 15, 23])
            countersunk_hole(-18, y_pos);
    }
}

module right_leaf() {
    difference() {
        union() {
            translate([0, 0, -leaf_thickness / 2])
                cube([leaf_width, leaf_length, leaf_thickness]);

            for (y_pos = [6, 18])
                knuckle(y_pos);
        }

        for (y_pos = [7, 15, 23])
            countersunk_hole(18, y_pos);
    }
}

module hinge_pin() {
    translate([0, -1, 0])
        y_cylinder(pin_length, pin_diameter);
}

color("steelblue")
    left_leaf();

color("lightsteelblue")
    right_leaf();

color("silver")
    hinge_pin();
medium (default) success →
medium
37.5s · 592/2725t · $0.0847
SCAD (115 lines)
$fn = 96;

leaf_length      = 30;
leaf_width       = 25;
leaf_thickness   = 2;

knuckle_length   = 6;
knuckle_od       = 8;
knuckle_id       = 4.6;

pin_diameter     = 4;
pin_length       = 32;

through_diameter = 3.2;
countersink_dia  = 6;
countersink_depth = 1;

attach_overlap   = 0.2;
knuckle_radius   = knuckle_od / 2;
leaf_inner_x     = knuckle_radius - attach_overlap;

eps = 0.02;

module y_cylinder(y0, length, diameter) {
    translate([0, y0, 0])
        rotate([-90, 0, 0])
            cylinder(h = length, d = diameter);
}

module knuckle(y0) {
    difference() {
        y_cylinder(y0, knuckle_length, knuckle_od);
        y_cylinder(y0 - eps, knuckle_length + 2 * eps, knuckle_id);
    }
}

module countersunk_hole(x, y) {
    translate([x, y, -leaf_thickness])
        cylinder(
            h = leaf_thickness * 2,
            d = through_diameter
        );

    translate([x, y, leaf_thickness / 2 - countersink_depth])
        cylinder(
            h = countersink_depth + eps,
            d1 = through_diameter,
            d2 = countersink_dia
        );
}

module left_leaf() {
    difference() {
        union() {
            translate([
                -leaf_inner_x - leaf_width,
                0,
                -leaf_thickness / 2
            ])
                cube([
                    leaf_width,
                    leaf_length,
                    leaf_thickness
                ]);

            for (y0 = [0, 12, 24])
                knuckle(y0);
        }

        for (y = [7, 15, 23])
            countersunk_hole(
                -leaf_inner_x - leaf_width + 7.5,
                y
            );
    }
}

module right_leaf() {
    difference() {
        union() {
            translate([
                leaf_inner_x,
                0,
                -leaf_thickness / 2
            ])
                cube([
                    leaf_width,
                    leaf_length,
                    leaf_thickness
                ]);

            for (y0 = [6, 18])
                knuckle(y0);
        }

        for (y = [7, 15, 23])
            countersunk_hole(
                leaf_inner_x + leaf_width - 7.5,
                y
            );
    }
}

module hinge_pin() {
    y_cylinder(-1, pin_length, pin_diameter);
}

color([0.68, 0.70, 0.73])
    left_leaf();

color([0.58, 0.61, 0.65])
    right_leaf();

color([0.82, 0.84, 0.86])
    hinge_pin();
high success →
high
64.6s · 592/4964t · $0.1519
SCAD (137 lines)
$fn = 96;

leaf_length       = 30;
leaf_width        = 25;
leaf_thickness    = 2;

knuckle_length    = 6;
knuckle_outer_d   = 8;
knuckle_inner_d   = 4.6;
knuckle_radius    = knuckle_outer_d / 2;

pin_diameter      = 4;
pin_length        = 32;

leaf_clearance    = 0.2;
web_overlap       = 0.1;

through_hole_d    = 3.2;
countersink_d     = 6;
countersink_depth = 1;

hole_y_positions  = [7, 15, 23];
hole_x_offset     = knuckle_radius + leaf_clearance + 18;

eps = 0.02;

module y_cylinder(d, h, y0 = 0) {
    translate([0, y0, 0])
        rotate([-90, 0, 0])
            cylinder(d = d, h = h);
}

module countersunk_hole(x, y) {
    translate([x, y, -leaf_thickness / 2 - eps])
        cylinder(
            d = through_hole_d,
            h = leaf_thickness + 2 * eps
        );

    translate([x, y, leaf_thickness / 2 - countersink_depth])
        cylinder(
            h  = countersink_depth + eps,
            d1 = through_hole_d,
            d2 = countersink_d
        );
}

module leaf(side = 1, segments = []) {
    inner_edge = knuckle_radius + leaf_clearance;
    plate_x = side < 0
        ? -(inner_edge + leaf_width)
        : inner_edge;

    web_inner = knuckle_inner_d / 2 - web_overlap;
    web_outer = inner_edge + web_overlap;

    difference() {
        union() {
            translate([plate_x, 0, -leaf_thickness / 2])
                cube([leaf_width, leaf_length, leaf_thickness]);

            for (segment = segments) {
                y0 = segment * knuckle_length;

                y_cylinder(
                    d  = knuckle_outer_d,
                    h  = knuckle_length,
                    y0 = y0
                );

                if (side < 0) {
                    translate([
                        -web_outer,
                        y0,
                        -leaf_thickness / 2
                    ])
                        cube([
                            web_outer - web_inner,
                            knuckle_length,
                            leaf_thickness
                        ]);
                } else {
                    translate([
                        web_inner,
                        y0,
                        -leaf_thickness / 2
                    ])
                        cube([
                            web_outer - web_inner,
                            knuckle_length,
                            leaf_thickness
                        ]);
                }
            }
        }

        for (segment = segments) {
            y_cylinder(
                d  = knuckle_inner_d,
                h  = knuckle_length + 2 * eps,
                y0 = segment * knuckle_length - eps
            );
        }

        for (hole_y = hole_y_positions) {
            countersunk_hole(
                side * hole_x_offset,
                hole_y
            );
        }
    }
}

module left_leaf() {
    leaf(side = -1, segments = [0, 2, 4]);
}

module right_leaf() {
    leaf(side = 1, segments = [1, 3]);
}

module hinge_pin() {
    y_cylinder(
        d  = pin_diameter,
        h  = pin_length,
        y0 = -1
    );
}

color([0.68, 0.72, 0.76])
    left_leaf();

color([0.78, 0.81, 0.84])
    right_leaf();

color([0.35, 0.38, 0.42])
    hinge_pin();
max success →
max
244.1s · 592/17703t · $0.5340
SCAD (129 lines)
$fn = 96;

leaf_length    = 30;
leaf_width     = 25;
leaf_thickness = 2;

knuckle_length = 6;
knuckle_od     = 8;
knuckle_id     = 4.6;

pin_diameter   = 4;
pin_overhang   = 1;
pin_length     = leaf_length + 2 * pin_overhang;

through_d      = 3.2;
countersink_d  = 6;
countersink_depth = 1;

hole_x = leaf_width - 6;
hole_y_positions = [
    leaf_length / 2 - 8,
    leaf_length / 2,
    leaf_length / 2 + 8
];

left_knuckle_y  = [0, 12, 24];
right_knuckle_y = [6, 18];

barrel_clearance = 0.15;
eps = 0.02;

module cylinder_y(y0, len, diameter) {
    translate([0, y0, 0])
        rotate([-90, 0, 0])
            cylinder(h = len, d = diameter, center = false);
}

module countersunk_hole(x, y) {
    translate([x, y, -leaf_thickness / 2 - eps])
        cylinder(
            h = leaf_thickness + 2 * eps,
            d = through_d
        );

    cone_extra_d =
        (countersink_d - through_d) * eps / countersink_depth;

    translate([
        x,
        y,
        leaf_thickness / 2 - countersink_depth
    ])
        cylinder(
            h  = countersink_depth + eps,
            d1 = through_d,
            d2 = countersink_d + cone_extra_d
        );
}

module left_leaf() {
    difference() {
        union() {
            translate([-leaf_width, 0, -leaf_thickness / 2])
                cube([leaf_width, leaf_length, leaf_thickness]);

            for (y0 = left_knuckle_y)
                cylinder_y(y0, knuckle_length, knuckle_od);
        }

        for (y0 = left_knuckle_y)
            cylinder_y(
                y0 - eps,
                knuckle_length + 2 * eps,
                knuckle_id
            );

        for (y0 = right_knuckle_y)
            cylinder_y(
                y0,
                knuckle_length,
                knuckle_od + 2 * barrel_clearance
            );

        for (y = hole_y_positions)
            countersunk_hole(-hole_x, y);
    }
}

module right_leaf() {
    difference() {
        union() {
            translate([0, 0, -leaf_thickness / 2])
                cube([leaf_width, leaf_length, leaf_thickness]);

            for (y0 = right_knuckle_y)
                cylinder_y(y0, knuckle_length, knuckle_od);
        }

        for (y0 = right_knuckle_y)
            cylinder_y(
                y0 - eps,
                knuckle_length + 2 * eps,
                knuckle_id
            );

        for (y0 = left_knuckle_y)
            cylinder_y(
                y0,
                knuckle_length,
                knuckle_od + 2 * barrel_clearance
            );

        for (y = hole_y_positions)
            countersunk_hole(hole_x, y);
    }
}

module hinge_pin() {
    cylinder_y(-pin_overhang, pin_length, pin_diameter);
}

color([0.72, 0.76, 0.80])
    left_leaf();

color([0.58, 0.63, 0.68])
    right_leaf();

color([0.88, 0.88, 0.86])
    hinge_pin();
xhigh success →
xhigh
81.0s · 592/5736t · $0.1750
SCAD (163 lines)
$fn = 96;

leaf_length   = 30;
leaf_width    = 25;
leaf_thickness = 2;

knuckle_count  = 5;
knuckle_length = leaf_length / knuckle_count;
knuckle_od     = 8;
knuckle_id     = 4.6;

pin_diameter = 4;
pin_length   = 32;

screw_hole_d = 3.2;
countersink_d = 6;
countersink_depth = 1;
screw_x = 18;
screw_y_positions = [7, 15, 23];

eps = 0.02;


// Y軸方向の円柱
module y_cylinder(y_start, length, diameter) {
    translate([0, y_start, 0])
        rotate([-90, 0, 0])
            cylinder(h = length, d = diameter);
}


// M3皿穴
module countersunk_hole(x_pos, y_pos) {
    translate([
        x_pos,
        y_pos,
        -leaf_thickness / 2 - eps
    ])
        cylinder(
            h = leaf_thickness + 2 * eps,
            d = screw_hole_d
        );

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


// 左板
module left_leaf() {
    difference() {
        union() {
            translate([
                -leaf_width,
                0,
                -leaf_thickness / 2
            ])
                cube([
                    leaf_width,
                    leaf_length,
                    leaf_thickness
                ]);

            for (i = [0, 2, 4])
                y_cylinder(
                    i * knuckle_length,
                    knuckle_length,
                    knuckle_od
                );
        }

        // ピン軸用の穴
        y_cylinder(
            -eps,
            leaf_length + 2 * eps,
            knuckle_id
        );

        // 右板側knuckleとの干渉を除去
        for (i = [1, 3])
            y_cylinder(
                i * knuckle_length,
                knuckle_length,
                knuckle_od
            );

        // 皿穴
        for (y_pos = screw_y_positions)
            countersunk_hole(-screw_x, y_pos);
    }
}


// 右板
module right_leaf() {
    difference() {
        union() {
            translate([
                0,
                0,
                -leaf_thickness / 2
            ])
                cube([
                    leaf_width,
                    leaf_length,
                    leaf_thickness
                ]);

            for (i = [1, 3])
                y_cylinder(
                    i * knuckle_length,
                    knuckle_length,
                    knuckle_od
                );
        }

        // ピン軸用の穴
        y_cylinder(
            -eps,
            leaf_length + 2 * eps,
            knuckle_id
        );

        // 左板側knuckleとの干渉を除去
        for (i = [0, 2, 4])
            y_cylinder(
                i * knuckle_length,
                knuckle_length,
                knuckle_od
            );

        // 皿穴
        for (y_pos = screw_y_positions)
            countersunk_hole(screw_x, y_pos);
    }
}


// ピン軸
module hinge_pin() {
    y_cylinder(
        -1,
        pin_length,
        pin_diameter
    );
}


// 180°開いた完成状態
color([0.68, 0.72, 0.78])
    left_leaf();

color([0.78, 0.81, 0.86])
    right_leaf();

color([0.32, 0.34, 0.38])
    hinge_pin();