vibe-openscad

bare-max/claude-opus-4-8 / tier-3-butt-hinge

success tier 3

bare (claude opus 4.8)

render
bare render of tier-3-butt-hinge
loading STL…
success 28.9s · 741/2475t · $0.0656
SCAD (170 lines)
// =========================================================
// Small Butt Hinge for Furniture (M3 mounting holes)
// Open state: 180 degrees (both leaves coplanar)
// =========================================================
//
// Coordinate system:
//   - Pin axis along +Y (centerline on Y-axis)
//   - Leaf flat faces perpendicular to Z
//   - Left leaf extends to x<0, right leaf to x>0
//   - Knuckles centered at X=0, stacked along Y in 6mm bands
//
// =========================================================

$fn = 64;

// ---------------- Parameters ----------------
leaf_len    = 30;    // dimension along pin axis (Y)
leaf_width  = 25;    // dimension in opening direction (X)
leaf_thk    = 2;     // plate thickness (Z)

pin_dia     = 4;     // pin shaft diameter
pin_len     = 32;    // pin total length (1mm overhang each end)

knuckle_n   = 5;     // total knuckle bands
knuckle_h   = leaf_len / knuckle_n;   // = 6
knuckle_od  = 8;     // knuckle outer diameter
clearance   = 0.3;   // pin-to-bore clearance
knuckle_id  = pin_dia + clearance;    // = 4.3 -> spec says 4.6; use +0.3 from pin? 
// NOTE: spec text: inner = pin + 0.3 clearance (=4.6 hole). 
// pin=4, +0.3 clearance => bore 4.6 (0.3 radial? diametral?). Use 4.6 as written.
knuckle_bore = 4.6;

// M3 countersunk holes
screw_clear_dia = 3.2;   // through hole
csk_dia         = 6;     // countersink top diameter
csk_depth       = 1;     // countersink depth
screw_n         = 3;     // holes per leaf
screw_pitch     = 8;     // spacing along Y

// derived: place screws near far edge of each leaf
// knuckle sits at X=0 spanning radius knuckle_od/2 = 4
// flat plate goes from edge of knuckle outward.

// ---------------- Helper: knuckle band ----------------
module knuckle_band() {
    // cylinder centered on Y-axis, length knuckle_h along Y
    rotate([-90, 0, 0])              // align cylinder axis to +Y
        cylinder(h = knuckle_h, d = knuckle_od);
}

module pin_bore_band() {
    rotate([-90, 0, 0])
        cylinder(h = knuckle_h + 0.2, d = knuckle_bore);
}

// ---------------- Helper: leaf plate ----------------
// A flat plate of size width x leaf_len x thk.
// dir = +1 -> extends to +X (right leaf)
// dir = -1 -> extends to -X (left leaf)
// The plate's flat face is on Z. We center it so top face at z=+thk/2.
// It starts from the knuckle outer edge and extends outward by leaf_width.
module leaf_plate(dir) {
    // knuckle outer radius
    kr = knuckle_od / 2;

    // plate spans X from kr to kr+leaf_width (then mirrored by dir)
    // but to nicely blend with knuckle, start a bit inside (overlap).
    overlap = kr;        // overlap region for solid joint
    x_start = -overlap;  // begin inside knuckle for union
    x_end   = leaf_width + kr;

    // For 180-deg open, both plates lie in same plane (z around 0).
    translate([0, 0, -leaf_thk/2])
        if (dir > 0) {
            translate([x_start, 0, 0])
                cube([x_end - x_start, leaf_len, leaf_thk]);
        } else {
            mirror([1,0,0])
                translate([x_start, 0, 0])
                    cube([x_end - x_start, leaf_len, leaf_thk]);
        }
}

// ---------------- Helper: countersunk screw hole ----------------
// Drilled from top (+Z) downward through the plate.
// Positioned at given (x, y).
module csk_hole(x, y) {
    translate([x, y, 0]) {
        // through hole
        translate([0, 0, -leaf_thk/2 - 0.1])
            cylinder(h = leaf_thk + 0.2, d = screw_clear_dia);
        // countersink (taper) opening upward from top face
        translate([0, 0, leaf_thk/2 - csk_depth])
            cylinder(h = csk_depth + 0.01,
                     d1 = screw_clear_dia,
                     d2 = csk_dia);
    }
}

// ---------------- Screw hole pattern for a leaf ----------------
// dir = +1 right leaf, -1 left leaf
module screw_pattern(dir) {
    kr = knuckle_od / 2;
    // place holes near the far edge of the plate
    // center column at some X away from knuckle
    hole_x = dir * (leaf_width + kr - 6);   // 6mm in from outer edge

    // center the 3 holes along Y about leaf center
    y0 = leaf_len/2 - ((screw_n - 1) * screw_pitch)/2;
    for (i = [0 : screw_n - 1]) {
        csk_hole(hole_x, y0 + i * screw_pitch);
    }
}

// ---------------- Left leaf ----------------
// Left leaf knuckles: outer 2 (band 0 and band 4) + center (band 2)
left_bands = [0, 2, 4];
// Right leaf knuckles: middle 2 (band 1 and band 3)
right_bands = [1, 3];

module left_leaf() {
    color("silver")
    difference() {
        union() {
            leaf_plate(-1);
            for (b = left_bands)
                translate([0, b * knuckle_h, 0])
                    knuckle_band();
        }
        // bore through left-leaf knuckles
        for (b = left_bands)
            translate([0, b * knuckle_h - 0.1, 0])
                pin_bore_band();
        // screw holes
        screw_pattern(-1);
    }
}

module right_leaf() {
    color("lightsteelblue")
    difference() {
        union() {
            leaf_plate(+1);
            for (b = right_bands)
                translate([0, b * knuckle_h, 0])
                    knuckle_band();
        }
        // bore through right-leaf knuckles
        for (b = right_bands)
            translate([0, b * knuckle_h - 0.1, 0])
                pin_bore_band();
        // screw holes
        screw_pattern(+1);
    }
}

// ---------------- Pin ----------------
module pin() {
    color("dimgray")
    // total length pin_len, centered so it overhangs 1mm each end
    // knuckle stack spans Y = 0 .. leaf_len (=30); pin from -1 .. 31
    translate([0, -1, 0])
        rotate([-90, 0, 0])
            cylinder(h = pin_len, d = pin_dia);
}

// ---------------- Assembly (180 deg open) ----------------
left_leaf();
right_leaf();
pin();
パラメータ (14)
スライダを動かすと openscad-wasm で再レンダリング

meta

runIdbare-max_claude-opus-4-8-6338f728581f-2026-06-09T17-39-18-558Z
matrixIdbare-max/claude-opus-4-8
signature6338f728581f1953…
provideranthropic
modelclaude-opus-4-8
harnessbare
statussuccess
duration28.93s (wallclock: load + prompt eval + generation + network)
tokens741 in / 2475 out
wallclock tok/s85.6 tok/s (end-to-end)
cost$0.0656
createdAt2026-06-09T17:39:18.558Z
gitCommitc8a77106d384
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 ... ``` のフェンスで囲んで出力してください。
コードのみで、追加の説明は不要です。