vibe-openscad

bare-max/gpt-6-astra / tier-3-butt-hinge

success tier 3

bare (gpt 6 astra)

render
bare render of tier-3-butt-hinge
loading STL…
success 163.3s · 592/9159t · $0.4639
SCAD (157 lines)
// 単位: mm
// ピン中心線: X=0, Z=0(+Y方向)
// 180°開いたとき、両板の表面は Z=-2、裏面は Z=-4。
$fn = 128;

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

pin_diameter = 4;
pin_length   = 32;

knuckle_od       = 8;
radial_clearance = 0.3;
knuckle_id       = pin_diameter + 2 * radial_clearance; // 4.6
knuckle_count    = 5;
knuckle_pitch    = leaf_length / knuckle_count;        // 6

// 6mm区画の内側境界に可動用の隙間を設ける。
// 最外端は Y=0,30 に保ち、ピンの突出量を両端1mmにする。
axial_gap = 0.10;

screw_hole_diameter = 3.2;
countersink_diameter = 6;
countersink_depth    = 1;
screw_pitch          = 8;
screw_edge_inset     = 5;

eps = 0.01;

knuckle_radius = knuckle_od / 2;
leaf_inner_x   = knuckle_radius;
leaf_bottom_z  = -knuckle_radius;
leaf_top_z     = leaf_bottom_z + leaf_thickness;


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


// +Z側の表面から加工する皿穴
module countersunk_hole() {
    translate([0, 0, leaf_bottom_z - eps])
        cylinder(
            d = screw_hole_diameter,
            h = leaf_thickness + 2 * eps
        );

    // 表面で直径6mm、深さ1mmで直径3.2mmとなるテーパ。
    // 上端のみ延長し、表面位置での指定径を維持する。
    translate([0, 0, leaf_top_z - countersink_depth])
        cylinder(
            h  = countersink_depth + eps,
            d1 = screw_hole_diameter,
            d2 = countersink_diameter
               + (countersink_diameter - screw_hole_diameter)
               * eps / countersink_depth
        );
}


// 筒部と、その筒部を板につなぐ一体のウェブ
module knuckle_with_web(index, side) {
    y0 = index * knuckle_pitch
       + (index == 0 ? 0 : axial_gap / 2);

    y1 = (index + 1) * knuckle_pitch
       - (index == knuckle_count - 1 ? 0 : axial_gap / 2);

    web_x = side < 0 ? -leaf_inner_x - eps : 0;

    union() {
        cylinder_y(
            diameter = knuckle_od,
            length   = y1 - y0,
            y_start  = y0
        );

        translate([web_x, y0, leaf_bottom_z])
            cube([
                leaf_inner_x + eps,
                y1 - y0,
                leaf_thickness
            ]);
    }
}


// side=-1: 左板(区画0,2,4)
// side=+1: 右板(区画1,3)
module leaf(side) {
    body_x = side < 0
           ? -leaf_inner_x - leaf_width
           :  leaf_inner_x;

    screw_x = side
            * (leaf_inner_x + leaf_width - screw_edge_inset);

    difference() {
        union() {
            // 25×30×2の平板本体。
            // 筒部の外側に置き、相手側の筒部との干渉を防ぐ。
            translate([body_x, 0, leaf_bottom_z])
                cube([leaf_width, leaf_length, leaf_thickness]);

            for (i = [0 : knuckle_count - 1])
                if (i % 2 == (side < 0 ? 0 : 1))
                    knuckle_with_web(i, side);
        }

        // ウェブを含めて貫通させ、軸穴を完全に開ける。
        cylinder_y(
            diameter = knuckle_id,
            length   = leaf_length + 2 * eps,
            y_start  = -eps
        );

        // Y=7,15,23、8mmピッチ
        for (n = [-1 : 1])
            translate([
                screw_x,
                leaf_length / 2 + n * screw_pitch,
                0
            ])
                countersunk_hole();
    }
}


module pin() {
    cylinder_y(
        diameter = pin_diameter,
        length   = pin_length,
        y_start  = -(pin_length - leaf_length) / 2
    );
}


// 0°で閉、180°で開。回転中心は共通のY軸。
module hinge(open_angle = 180) {
    color([0.62, 0.65, 0.68])
        leaf(-1);

    color([0.72, 0.75, 0.78])
        rotate([0, open_angle - 180, 0])
            leaf(1);

    color([0.42, 0.45, 0.48])
        pin();
}


hinge(open_angle = 180);
パラメータ (15) —
スライダを動かすと openscad-wasm で再レンダリング

meta

runIdbare-max_gpt-6-astra-cdf9c9efe6dd-2026-09-05T10-16-10-155Z
matrixIdbare-max/gpt-6-astra
signaturecdf9c9efe6dd0e39…
provideropenai
modelgpt-6-astra
harnessbare
statussuccess
duration163.27s (wallclock: load + prompt eval + generation + network)
tokens592 in / 9159 out
wallclock tok/s56.1 tok/s (end-to-end)
cost$0.4639
createdAt2026-09-05T10:16:10.155Z
gitCommitd69c2b8ad709
openscadOpenSCAD version 2026.04.27

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 ... ``` のフェンスで囲んで出力してください。
コードのみで、追加の説明は不要です。