vibe-openscad

bare-low/gpt-5-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-KQqIvz/input.scad, line 132
Can't parse file '/tmp/render-KQqIvz/input.scad'!

bare (gpt 5 nano)

render
no render
render_error 32.6s · 592/3188t · $0.0013
openscad stl render failed (exit 1): ERROR: Parser error: syntax error in file ../../../../../tmp/render-KQqIvz/input.scad, line 132
Can't parse file '/tmp/render-KQqIvz/input.scad'!

SCAD (139 lines)
// Butt hinge for furniture (3 parts: left plate, right plate, pin axis)
// Opened 180 degrees, plates in same plane (Y axis is hinge axis, X is opening direction, Z is plate thickness)

// Parameters (adjustable)
plate_length_Y = 30;      // along Y
plate_width_X  = 25;       // along X (opening direction)
plate_thick    = 2;        // Z thickness
knuckle_outer_D = 8;        // outer diameter of knuckle
knuckle_inner_D = 4.6;      // inner diameter (pin clearance)
knuckle_count  = 5;         // 5 knuckles along Y
knuckle_pitch  = 6;         // 6 mm between knuckles
pin_d          = 4;         // pin diameter
pin_len        = 32;        // total pin length through knuckles
// The knuckles sit around the pin along Y, centered at Y = -12, -6, 0, 6, 12

// Holes for M3 countersunk (皿穴) at each plate away from knuckles
m3_counterbore_d = 6;        // countersunk hole diameter (表面直径)
m3_counterbore_depth = 1;     // countersunk depth
m3_thru_d = 3.2;               // through hole for M3 bolt

$fn = 100;

// Helper: position left plate (x from -plate_width_X to 0)
module left_plate(){
    difference(){
        // main plate
        translate([-plate_width_X, -plate_length_Y/2, -plate_thick/2])
            cube([plate_width_X, plate_length_Y, plate_thick], center = false);

        // through hole for hinge pin at each knuckle position (4.6 mm diameter clearance hole)
        for(i=[-2,-1,0,1,2]){
            Y = i*knuckle_pitch;
            // Centerline along Y, hole through entire plate thickness
            translate([ -plate_width_X, Y - 1, 0 ])
                // Create hole partially by aligning to the plate: use a vertical cylinder along Z
                // Since plate is flat in Z, we use translate and rotate to drill perpendicularly to Z
                // We want a through hole in the plate along Z: use cylinder along Z axis
                cylinder(h = plate_thick + 0.1, d = knuckle_inner_D + 0.4, center = true);
        }

        // Knuckle sleeves (external 8 mm diameter, around the pin) on the left plate side
        // For visualization/assembly: hollow cylinders with inner hole for pin
        translate([ -plate_width_X/2, -plate_length_Y/2, -plate_thick/2 ])
            rotate([0,0,0])
            difference(){
                // Outer knuckle cylinders positioned along Y at 5 centers on left plate side
                // We'll place the left plate knuckles (3) at Y = -12, 0, 12
            }
        // We implement knuckles as cylindrical sleeves: from left plate side toward center
        // Here simply draw 3 sleeves near the plate face (visual aid)
        for(y=[-12,0,12]){
            translate([ -plate_width_X + plate_thick/2, y, 0 ])
                rotate([0,90,0])
                cylinder(h = plate_thick, d = knuckle_outer_D, center = true);
        }
    }
}

// Helper: position right plate
module right_plate(){
    difference(){
        translate([0, -plate_length_Y/2, -plate_thick/2])
            cube([plate_width_X, plate_length_Y, plate_thick], center = false);

        // pin clearance holes through right plate
        for(i=[-2,-1,0,1,2]){
            Y = i*knuckle_pitch;
            translate([0, Y, 0])
                cylinder(h = plate_thick + 0.1, d = knuckle_inner_D + 0.4, center = true);
        }

        // Knuckles on right plate: 2 knuckles at Y = -6, 6
        for(y=[-6,6]){
            translate([ plate_width_X/2, y, 0 ])
                rotate([0,90,0])
                cylinder(h = plate_thick, d = knuckle_outer_D, center = true);
        }
    }
}

// Pin axis: cylindrical rod along Y, diameter 4 mm, length 32 mm
module pin_axis(){
    // The pin should pass through both plates and knuckles
    translate([0, -pin_len/2, 0])
        cylinder(h = pin_len, d = pin_d, center = true);
}

// Knuckle sleeves (outer diameter 8 mm, inner diameter 4.6 mm) around the pin
// These are conceptual: model as a set of hollow cylinders centered on X=0, at given Y,
// with their axis along Y (coaxial with pin). Since plates are offset in X, the sleeves straddle the pin.

module knuckles_around_pin(){
    // We will place 5 knuckles along Y at X=0, with y centers as described
    // Left plate knuckles: at Y = -12, 0, 12
    // Right plate knuckles: at Y = -6, 6
    // Outer sleeve length along X-direction is plate_thick (2mm) on each side
    // For visualization, create hollow cylinders around the pin axis
    knuckle_positions = [ -12, -6, 0, 6, 12 ];
    for(i=[0:4]){
        y = knuckle_positions[i];
        // Outer sleeve centered at X=0, Y=y
        translate([0, y, 0])
            // Create hollow cylinder: outer diameter 8, inner hole 4.6, length spanning both plates
            rotate([0,90,0])
            difference(){
                cylinder(h = plate_thick*2 + 0.1, d = knuckle_outer_D, center = true);
                cylinder(h = plate_thick*2 + 0.1, d = knuckle_inner_D, center = true);
            }
    }
}

// Now assemble all parts with plates in open 180 deg configuration
// We place left and right plates in same plane when opened, i.e., rotate right plate by 180 degrees about pin axis (Y)
// Also position so that plate flat surfaces align in a single plane (Z ~ 0)

module assembly_open180(){
    // Open 180 degrees: rotate right plate around Y axis by 180° so the flat faces coincide
    // Place left plate at X<0, right plate at X>0 before rotation
    // Base plane for reference
    translate([ -plate_width_X, 0, 0 ]) {
        // Left plate
        left_plate();
    }
    // Right plate, rotated around Y axis by 180° about pin axis at X=0
    translate([ 0, 0, 0 ]) {
        rotate([0,180,0])
            right_plate();
    }
    // Pin axis centered at X=0, Y = 0 (center between plates)
    // The pin passes through both knuckles
    pin_pos_gizmo = translate([0, 0, 0])
        pin_axis();

    // Knuckle sleeves visualization for whole hinge
    knuckles_around_pin();
}

// Main
assembly_open180();

meta

runIdbare-low_gpt-5-nano-ac9322806a54-2026-04-28T17-25-01-200Z
matrixIdbare-low/gpt-5-nano
signatureac9322806a547045…
provideropenai
modelgpt-5-nano-2025-08-07
harnessbare
statusrender_error
duration32.61s (wallclock: load + prompt eval + generation + network)
tokens592 in / 3188 out
wallclock tok/s97.8 tok/s (end-to-end)
cost$0.0013
createdAt2026-04-28T17:25:01.200Z
gitCommitbe87c9f2adaf
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 ... ``` のフェンスで囲んで出力してください。
コードのみで、追加の説明は不要です。