vibe-openscad

iter-png-1/claude-sonnet-4-6 / tier-3-butt-hinge

success tier 3

bare (claude sonnet 4.6)

render
bare render of tier-3-butt-hinge
loading STL…
success 34.7s · 3090/2072t · $0.0403
SCAD (142 lines)
// Butt Hinge - 180° open position
// Pin axis along Y, leaves extend in -X and +X directions

$fn = 64;

// Parameters
leaf_width  = 25;   // X extent of flat plate portion
leaf_length = 30;   // Y direction (along pin)
leaf_thick  = 2;    // Z thickness

pin_dia     = 4;
pin_r       = pin_dia / 2;
pin_length  = 32;   // 1mm overhang each end (-1 to 31)

knuckle_od  = 8;
knuckle_or  = knuckle_od / 2;   // 4
knuckle_id  = pin_dia + 0.3;    // 4.3mm clearance bore
knuckle_ir  = knuckle_id / 2;
knuckle_h   = 6;                 // each knuckle segment height

// Screw holes (M3 countersunk)
screw_cs_dia   = 6;
screw_cs_depth = 1;
screw_thru_dia = 3.2;
screw_count    = 3;
screw_pitch    = 8;

// Knuckle Y centres:
//   Left leaf  (3 knuckles): segments 0,2,4 → Y centres 3, 15, 27
//   Right leaf (2 knuckles): segments 1,3   → Y centres 9, 21
left_knuckle_y  = [3, 15, 27];
right_knuckle_y = [9, 21];

// The pin/knuckle axis is at X=0, Z=0.
// Leaf flat face is at Z=0 (top surface), body goes down to Z=-leaf_thick.
// Leaf plate extends from X=0 outward (left: -leaf_width, right: +leaf_width).
// Knuckle centre is at X=0, Z=0; lower half (Z<0) merges into plate edge.

// ─────────────────────────────────────────────
// Knuckle tube, axis along Y, centred at origin
module knuckle_tube() {
    rotate([90, 0, 0])
        difference() {
            cylinder(h = knuckle_h, r = knuckle_or, center = true);
            cylinder(h = knuckle_h + 0.02, r = knuckle_ir, center = true);
        }
}

// ─────────────────────────────────────────────
// Countersunk hole: top surface at Z=0, going downward through leaf_thick
// Wider at top (Z=0), narrows to thru-hole diameter
module cs_hole() {
    union() {
        // countersink cone: top z=0 dia=screw_cs_dia, bottom z=-screw_cs_depth dia=screw_thru_dia
        translate([0, 0, -screw_cs_depth])
            cylinder(h = screw_cs_depth + 0.01,
                     r1 = screw_thru_dia / 2,
                     r2 = screw_cs_dia / 2);
        // through hole from countersink bottom to leaf bottom
        translate([0, 0, -(leaf_thick + 0.01)])
            cylinder(h = leaf_thick - screw_cs_depth + 0.02,
                     r = screw_thru_dia / 2);
    }
}

// ─────────────────────────────────────────────
// Screw hole Y positions (centred on leaf_length)
function screw_y(i) =
    (leaf_length - (screw_count - 1) * screw_pitch) / 2 + i * screw_pitch;

// ─────────────────────────────────────────────
// Left leaf: plate extends in -X direction, knuckles at X=0
module left_leaf() {
    difference() {
        union() {
            // Flat plate: from X=-leaf_width to X=0, Y=0 to Y=30, Z=-leaf_thick to Z=0
            translate([-leaf_width, 0, -leaf_thick])
                cube([leaf_width, leaf_length, leaf_thick]);

            // Knuckles at X=0 axis
            for (yc = left_knuckle_y) {
                translate([0, yc, 0])
                    knuckle_tube();
            }
        }

        // Countersunk screw holes on flat part
        // X centre at -leaf_width/2 (middle of plate away from hinge)
        for (i = [0 : screw_count - 1]) {
            translate([-leaf_width / 2, screw_y(i), 0])
                cs_hole();
        }

        // Remove pin bore through all knuckles
        translate([0, -1, 0])
            rotate([-90, 0, 0])
                cylinder(h = pin_length + 2, r = knuckle_ir);
    }
}

// ─────────────────────────────────────────────
// Right leaf: plate extends in +X direction, knuckles at X=0
module right_leaf() {
    difference() {
        union() {
            // Flat plate: from X=0 to X=+leaf_width
            translate([0, 0, -leaf_thick])
                cube([leaf_width, leaf_length, leaf_thick]);

            // Knuckles at X=0 axis
            for (yc = right_knuckle_y) {
                translate([0, yc, 0])
                    knuckle_tube();
            }
        }

        // Countersunk screw holes
        for (i = [0 : screw_count - 1]) {
            translate([leaf_width / 2, screw_y(i), 0])
                cs_hole();
        }

        // Remove pin bore through all knuckles
        translate([0, -1, 0])
            rotate([-90, 0, 0])
                cylinder(h = pin_length + 2, r = knuckle_ir);
    }
}

// ─────────────────────────────────────────────
// Pin: Y from -1 to +31 (1mm overhang each end)
module pin() {
    translate([0, -1, 0])
        rotate([-90, 0, 0])
            cylinder(h = pin_length, r = pin_r);
}

// ─────────────────────────────────────────────
// Assembly
color([0.75, 0.75, 0.78], 1.0) left_leaf();
color([0.75, 0.75, 0.78], 1.0) right_leaf();
color([0.85, 0.70, 0.20], 1.0) pin();
パラメータ (12)
スライダを動かすと openscad-wasm で再レンダリング

meta

runIditer-png-1_claude-sonnet-4-6-f6d17ac7e375-2026-04-28T17-29-25-763Z
matrixIditer-png-1/claude-sonnet-4-6
signaturef6d17ac7e3755459…
provideranthropic
modelclaude-sonnet-4-6
harnessbare
statussuccess
duration34.75s (wallclock: load + prompt eval + generation + network)
tokens3090 in / 2072 out
wallclock tok/s59.6 tok/s (end-to-end)
cost$0.0403
createdAt2026-04-28T17:29:25.763Z
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 ... ``` のフェンスで囲んで出力してください。
コードのみで、追加の説明は不要です。