vibe-openscad

iter-png-2/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-K7NwPr/input.scad, line 75
Can't parse file '/tmp/render-K7NwPr/input.scad'!

bare (gpt 5.4 nano)

render
no render
render_error 7.4s · 2024/1197t · $0.0009
openscad stl render failed (exit 1): ERROR: Parser error: syntax error in file ../../../../../tmp/render-K7NwPr/input.scad, line 75
Can't parse file '/tmp/render-K7NwPr/input.scad'!

SCAD (123 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 (centered)

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

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_ys = [8, 16, 24];// pitch 8mm along Y

// ---- Helper: 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 on hinge plane at X=0.
// It lies in YZ plane when centered at X=0? In this model: create as XY-plane leaf with Z thickness.
module leaf_plate(x_sign=1) {
    // leaf on x<0 or x>0; flat faces are parallel to X-Y plane, thickness along Z
    translate([x_sign * (Xspan/2), 0, 0])
        cube([Xspan, Ylen, t], center=true);
}

// Knuckle sleeve along Y at X=0, centered at given y.
// Bore is along Y.
module knuckle(y_pos=0) {
    difference() {
        translate([0, y_pos, 0])
            cyl_y(d=kn_outer, h=knuckle_len, center=true);
        translate([0, y_pos, 0])
            cyl_y(d=kn_inner, h=knuckle_len + 2*gap, center=true);
    }
}

// Countersunk + through hole along Z axis, centered at current origin.
// Countersink is cut from +Z face (and will still be valid as subtraction).
module m3_hole_z() {
    // through
    cylinder(d=through_d, h=t + 6*gap, center=true);

    // countersink cone: top diameter cs_d_top at +Z face
    // We place cone center so that its base aligns at z=+t/2 (plate top).
    // Cone height = cs_depth.
    translate([0,0, (t/2 - cs_depth/2)])
        cylinder(h=cs_depth, d1=cs_d_top, d2=through_d, center=true);
}

// One leaf with knuckles and screw holes; knuckle bores for pin are subtracted here,
// but since the other leaf also subtracts, this is safe (shared hole remains).
module leaf_with_knuckles_and_holes(x_sign=1, kn_positions=[]) {
    difference() {
        union() {
            leaf_plate(x_sign);

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

        // Subtract the pin bore through the knuckles for this leaf
        for (y in kn_positions)
            translate([0, y, 0])
                cyl_y(d=kn_inner, h=kn_outer + 4*gap, center=true);

        // Subtract 3 M3 screw holes at far side from knuckles.
        // "far side away from knuckle" => leaf face at x = x_sign*(Xspan/2)
        // Hole axis is along Z at that x location.
        for (yy in hole_ys) {
            translate([x_sign * (Xspan/2), yy, 0])
                rotate([90,0,0]) {
                    // no rotation; m3_hole_z expects axis along Z at its own position
                    // (keep as-is)
                }
            translate([x_sign * (Xspan/2), yy, 0])
                m3_hole_z();
        }
    }
}

// Pin: cylinder along Y
module pin() {
    cyl_y(d=pin_d, h=pin_len, center=true);
}

// ---- Knuckle Y positions ----
// centers at Y = -12, -6, 0, 6, 12 spanning 30mm with 6mm steps
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]];

// ---- Assembly in open position (180deg) ----
module butt_hinge_open180() {
    union() {
        leaf_with_knuckles_and_holes(x_sign=-1, kn_positions=left_kn);
        leaf_with_knuckles_and_holes(x_sign= 1, kn_positions=right_kn);

        pin();
    }
}

butt_hinge_open180();

meta

runIditer-png-2_gpt-5.4-nano-c41a9506e3d4-2026-04-28T17-31-44-961Z
matrixIditer-png-2/gpt-5.4-nano
signaturec41a9506e3d46e48…
provideropenai
modelgpt-5.4-nano-2026-03-17
harnessbare
statusrender_error
duration7.42s (wallclock: load + prompt eval + generation + network)
tokens2024 in / 1197 out
wallclock tok/s161.3 tok/s (end-to-end)
cost$0.0009
createdAt2026-04-28T17:31:44.961Z
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 ... ``` のフェンスで囲んで出力してください。
コードのみで、追加の説明は不要です。