vibe-openscad

iter-png-1/gpt-5.4-nano / tier-3-butt-hinge

render_error tier 3
error
openscad stl render failed (exit 1): ERROR: Parser error: syntax error in file ../../../../../tmp/render-e9IRNF/input.scad, line 78
Can't parse file '/tmp/render-e9IRNF/input.scad'!

bare (gpt 5.4 nano)

render
no render
render_error 9.5s · 2405/1331t · $0.0010
openscad stl render failed (exit 1): ERROR: Parser error: syntax error in file ../../../../../tmp/render-e9IRNF/input.scad, line 78
Can't parse file '/tmp/render-e9IRNF/input.scad'!

SCAD (131 lines)
// Small butt hinge (3 parts assembled) in open position (180deg)

$fn = 96;

// ---- Parameters ----
t = 2;                 // leaf thickness (Z)
Ylen = 30;             // leaf length along hinge axis (Y)
Xspan = 25;            // leaf length along opening direction (X)
pin_d = 4;
pin_len = 32;         // total pin length

knuckle_len = 30;     // along Y
knuckle_segments = 5; // split into 6mm each (=> 6mm)
seg = knuckle_len/knuckle_segments; // 6mm

clear = 0.3;
bore_d = pin_d + clear; // 4.6mm

kn_outer = 8;
kn_inner = bore_d;

gap = 0.2;            // boolean robustness

// M3 countersunk holes (3 pcs per leaf)
cs_d_top = 6;        // countersink cone top diameter (mm)
cs_depth = 1;        // countersink depth (mm)
through_d = 3.2;    // through hole diameter (mm)
hole_pitch = 8;      // spacing along Y
hole_ys = [8, 16, 24];// based on 8mm pitch

// ---- Helper: make a cylinder whose axis is along Y ----
module cyl_y(d=1, h=1, center=true) {
    rotate([90,0,0]) cylinder(d=d, h=h, center=center);
}

// ---- Leaf plate: centered at hinge axis plane (X=0) ----
// Leaf lies in the XY plane with Z thickness.
module leaf_plate(x_sign=1) {
    // x_sign=-1 => leaf on x<0, x_sign=+1 => leaf on x>0
    translate([x_sign * (Xspan/2), 0, 0])
        cube([Xspan, Ylen, t], center=true);
}

// ---- Knuckle sleeve with bore: sleeve axis along Y ----
// Y position sets the sleeve center.
module knuckle(y_pos=0) {
    difference() {
        // outer sleeve
        translate([0, y_pos, 0]) cyl_y(d=kn_outer, h=knuckle_len, center=true);

        // bore along Y
        translate([0, y_pos, 0]) cyl_y(d=kn_inner, h=knuckle_len + 2*gap, center=true);
    }
}

// Countersunk + through hole (axis along Z), located at a given Y.
// Countersink is on the leaf side corresponding to +Z (we'll subtract; geometry stays correct).
module m3_hole_z() {
    // Through hole
    cylinder(d=through_d, h=t + 4*gap, center=true);

    // Countersink (cone frustum)
    translate([0,0, (cs_depth/2)])  // start at +Z face
        cylinder(h=cs_depth, d1=cs_d_top, d2=through_d, center=true);
}

// Build one leaf including its knuckles and screw holes,
// while also subtracting bore cylinders so shared knuckles align.
module leaf_with_knuckles_and_holes(x_sign=1, kn_positions=[], screw_far_face_sign=1) {
    // screw_far_face_sign: +1 => countersink normal to +Z face doesn't matter much for subtract,
    // we'll model only using "top at +Z" countersink. Since both leaves are at Z=0 plane,
    // subtraction will work regardless of which side is "far"; using +Z countersink is fine.
    difference() {
        union() {
            leaf_plate(x_sign);

            // Add knuckles at X=0 plane (hinge axis plane)
            for (y in kn_positions) knuckle(y);
        }

        // Subtract pin bores through the knuckles that belong to this leaf.
        // (So left and right both have the aligned holes.)
        for (y in kn_positions) {
            translate([0, y, 0]) cyl_y(d=kn_inner, h=kn_outer + 4*gap, center=true);
        }

        // Subtract 3 screw holes.
        // "Each plate side away from knuckle": given only as "far side", which is at x = x_sign*Xspan/2.
        // Use that as center for the hole axis along Z.
        for (yy in hole_ys) {
            translate([x_sign * (Xspan/2), yy, 0]) {
                // Countersink+through. Centered hole modeled along Z.
                // Ensure countersink is cut from the +Z face by positioning the cone appropriately.
                // The m3_hole_z module uses +Z face countersink by default.
                m3_hole_z();
            }
        }
    }
}

// Pin: cylinder along Y, total length 32mm (centered at Y=0).
module pin() {
    cyl_y(d=pin_d, h=pin_len, center=true);
}

// ---- Knuckle placement along Y ----
// Total knuckles separated in Y by 6mm across 30mm (5 segments).
// Centers at Y = -12, -6, 0, 6, 12 spanning 30mm.
kn_centers = [-12, -6, 0, 6, 12];

// Left: outer 2 + central 1 => [-12, 0, 12]
// Right: middle 2 => [-6, 6]
left_kn = [kn_centers[0], kn_centers[2], kn_centers[4]];
right_kn = [kn_centers[1], kn_centers[3]];

// ---- Main assembly in open position (180deg) ----
// Leaves already coplanar at Z=0 and placed on x<0 and x>0.
module butt_hinge_open180() {
    union() {
        // Left leaf
        leaf_with_knuckles_and_holes(x_sign=-1, kn_positions=left_kn);

        // Right leaf
        leaf_with_knuckles_and_holes(x_sign= 1, kn_positions=right_kn);

        // Shared pin
        translate([0, 0, 0]) pin();
    }
}

butt_hinge_open180();

meta

runIditer-png-1_gpt-5.4-nano-34068f5190ca-2026-04-28T17-31-37-500Z
matrixIditer-png-1/gpt-5.4-nano
signature34068f5190ca9a7d…
provideropenai
modelgpt-5.4-nano-2026-03-17
harnessbare
statusrender_error
duration9.50s (wallclock: load + prompt eval + generation + network)
tokens2405 in / 1331 out
wallclock tok/s140.0 tok/s (end-to-end)
cost$0.0010
createdAt2026-04-28T17:31:37.500Z
gitCommitbe87c9f2adaf
openscadOpenSCAD version 2026.04.27

iteration chain

各 iteration step は独立した benchmark run です。parentRunId で前段にリンクします。

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