vibe-openscad

tier-3-butt-hinge / claude-opus-4-1-20250805

5 run / 累計 87.9s / 累計 $0.4948

claude opus 4.1 2025-08-05 bare

bare (provider default effort)

run detail →
render
bare render of tier-3-butt-hinge
loading STL…
success 17.3s · 707/950t · $0.0819
SCAD (100 lines)
$fn = 50;

// Parameters
leaf_width = 25;
leaf_height = 30;
leaf_thickness = 2;
knuckle_outer_dia = 8;
knuckle_inner_dia = 4.6;
knuckle_height = 6;
pin_diameter = 4;
pin_length = 32;
screw_hole_dia = 3.2;
countersink_dia = 6;
countersink_depth = 1;

// Pin
module pin() {
    color("silver")
    translate([0, -1, 0])
    cylinder(h = pin_length, d = pin_diameter);
}

// Knuckle
module knuckle(height) {
    difference() {
        cylinder(h = height, d = knuckle_outer_dia);
        translate([0, 0, -0.1])
        cylinder(h = height + 0.2, d = knuckle_inner_dia);
    }
}

// Screw hole with countersink
module screw_hole() {
    // Countersink
    translate([0, 0, leaf_thickness - countersink_depth])
    cylinder(h = countersink_depth + 0.1, d1 = screw_hole_dia, d2 = countersink_dia);
    // Through hole
    translate([0, 0, -0.1])
    cylinder(h = leaf_thickness + 0.2, d = screw_hole_dia);
}

// Left leaf
module left_leaf() {
    color("gray")
    difference() {
        union() {
            // Main plate
            translate([-leaf_width, 0, -leaf_thickness/2])
            cube([leaf_width, leaf_height, leaf_thickness]);
            
            // Knuckles (3 pieces: bottom, middle, top)
            translate([0, 0, -leaf_thickness/2]) {
                knuckle(knuckle_height);
                translate([0, knuckle_height * 2, 0])
                knuckle(knuckle_height);
                translate([0, knuckle_height * 4, 0])
                knuckle(knuckle_height);
            }
        }
        
        // Screw holes
        translate([-leaf_width/2 - 5, 7, -leaf_thickness/2])
        screw_hole();
        translate([-leaf_width/2 - 5, 15, -leaf_thickness/2])
        screw_hole();
        translate([-leaf_width/2 - 5, 23, -leaf_thickness/2])
        screw_hole();
    }
}

// Right leaf
module right_leaf() {
    color("darkgray")
    difference() {
        union() {
            // Main plate
            translate([0, 0, -leaf_thickness/2])
            cube([leaf_width, leaf_height, leaf_thickness]);
            
            // Knuckles (2 pieces: lower-middle, upper-middle)
            translate([0, knuckle_height, -leaf_thickness/2])
            knuckle(knuckle_height);
            translate([0, knuckle_height * 3, -leaf_thickness/2])
            knuckle(knuckle_height);
        }
        
        // Screw holes
        translate([leaf_width/2 + 5, 7, -leaf_thickness/2])
        screw_hole();
        translate([leaf_width/2 + 5, 15, -leaf_thickness/2])
        screw_hole();
        translate([leaf_width/2 + 5, 23, -leaf_thickness/2])
        screw_hole();
    }
}

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

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

variant: thinking

off (default) success
off
17.3s · 707/950t · $0.0819
SCAD (100 lines)
$fn = 50;

// Parameters
leaf_width = 25;
leaf_height = 30;
leaf_thickness = 2;
knuckle_outer_dia = 8;
knuckle_inner_dia = 4.6;
knuckle_height = 6;
pin_diameter = 4;
pin_length = 32;
screw_hole_dia = 3.2;
countersink_dia = 6;
countersink_depth = 1;

// Pin
module pin() {
    color("silver")
    translate([0, -1, 0])
    cylinder(h = pin_length, d = pin_diameter);
}

// Knuckle
module knuckle(height) {
    difference() {
        cylinder(h = height, d = knuckle_outer_dia);
        translate([0, 0, -0.1])
        cylinder(h = height + 0.2, d = knuckle_inner_dia);
    }
}

// Screw hole with countersink
module screw_hole() {
    // Countersink
    translate([0, 0, leaf_thickness - countersink_depth])
    cylinder(h = countersink_depth + 0.1, d1 = screw_hole_dia, d2 = countersink_dia);
    // Through hole
    translate([0, 0, -0.1])
    cylinder(h = leaf_thickness + 0.2, d = screw_hole_dia);
}

// Left leaf
module left_leaf() {
    color("gray")
    difference() {
        union() {
            // Main plate
            translate([-leaf_width, 0, -leaf_thickness/2])
            cube([leaf_width, leaf_height, leaf_thickness]);
            
            // Knuckles (3 pieces: bottom, middle, top)
            translate([0, 0, -leaf_thickness/2]) {
                knuckle(knuckle_height);
                translate([0, knuckle_height * 2, 0])
                knuckle(knuckle_height);
                translate([0, knuckle_height * 4, 0])
                knuckle(knuckle_height);
            }
        }
        
        // Screw holes
        translate([-leaf_width/2 - 5, 7, -leaf_thickness/2])
        screw_hole();
        translate([-leaf_width/2 - 5, 15, -leaf_thickness/2])
        screw_hole();
        translate([-leaf_width/2 - 5, 23, -leaf_thickness/2])
        screw_hole();
    }
}

// Right leaf
module right_leaf() {
    color("darkgray")
    difference() {
        union() {
            // Main plate
            translate([0, 0, -leaf_thickness/2])
            cube([leaf_width, leaf_height, leaf_thickness]);
            
            // Knuckles (2 pieces: lower-middle, upper-middle)
            translate([0, knuckle_height, -leaf_thickness/2])
            knuckle(knuckle_height);
            translate([0, knuckle_height * 3, -leaf_thickness/2])
            knuckle(knuckle_height);
        }
        
        // Screw holes
        translate([leaf_width/2 + 5, 7, -leaf_thickness/2])
        screw_hole();
        translate([leaf_width/2 + 5, 15, -leaf_thickness/2])
        screw_hole();
        translate([leaf_width/2 + 5, 23, -leaf_thickness/2])
        screw_hole();
    }
}

// Assembly
left_leaf();
right_leaf();
pin();
adaptivenot run
dynamicnot run

iteration: iter-png

i1 success
iter 1
16.6s · 2413/982t · $0.1098
diff vs bare: +11/-7
  $fn = 50;
  
  // Parameters
  leaf_width = 25;
  leaf_height = 30;
  leaf_thickness = 2;
  knuckle_outer_dia = 8;
  knuckle_inner_dia = 4.6;
  knuckle_height = 6;
  pin_diameter = 4;
  pin_length = 32;
  screw_hole_dia = 3.2;
  countersink_dia = 6;
  countersink_depth = 1;
  
  // Pin
  module pin() {
      color("silver")
      translate([0, -1, 0])
+     rotate([90, 0, 0])
      cylinder(h = pin_length, d = pin_diameter);
  }
  
  // Knuckle
  module knuckle(height) {
      difference() {
          cylinder(h = height, d = knuckle_outer_dia);
          translate([0, 0, -0.1])
          cylinder(h = height + 0.2, d = knuckle_inner_dia);
      }
  }
  
  // Screw hole with countersink
  module screw_hole() {
      // Countersink
      translate([0, 0, leaf_thickness - countersink_depth])
      cylinder(h = countersink_depth + 0.1, d1 = screw_hole_dia, d2 = countersink_dia);
      // Through hole
      translate([0, 0, -0.1])
      cylinder(h = leaf_thickness + 0.2, d = screw_hole_dia);
  }
  
  // Left leaf
  module left_leaf() {
      color("gray")
      difference() {
          union() {
              // Main plate
              translate([-leaf_width, 0, -leaf_thickness/2])
              cube([leaf_width, leaf_height, leaf_thickness]);
              
              // Knuckles (3 pieces: bottom, middle, top)
-             translate([0, 0, -leaf_thickness/2]) {
+             rotate([90, 0, 0]) {
+                 translate([0, 0, 0])
                  knuckle(knuckle_height);
-                 translate([0, knuckle_height * 2, 0])
+                 translate([0, 0, -knuckle_height * 2])
                  knuckle(knuckle_height);
-                 translate([0, knuckle_height * 4, 0])
+                 translate([0, 0, -knuckle_height * 4])
                  knuckle(knuckle_height);
              }
          }
          
          // Screw holes
          translate([-leaf_width/2 - 5, 7, -leaf_thickness/2])
          screw_hole();
          translate([-leaf_width/2 - 5, 15, -leaf_thickness/2])
          screw_hole();
          translate([-leaf_width/2 - 5, 23, -leaf_thickness/2])
          screw_hole();
      }
  }
  
  // Right leaf
  module right_leaf() {
      color("darkgray")
      difference() {
          union() {
              // Main plate
              translate([0, 0, -leaf_thickness/2])
              cube([leaf_width, leaf_height, leaf_thickness]);
              
              // Knuckles (2 pieces: lower-middle, upper-middle)
-             translate([0, knuckle_height, -leaf_thickness/2])
-             knuckle(knuckle_height);
-             translate([0, knuckle_height * 3, -leaf_thickness/2])
-             knuckle(knuckle_height);
+             rotate([90, 0, 0]) {
+                 translate([0, 0, -knuckle_height])
+                 knuckle(knuckle_height);
+                 translate([0, 0, -knuckle_height * 3])
+                 knuckle(knuckle_height);
+             }
          }
          
          // Screw holes
          translate([leaf_width/2 + 5, 7, -leaf_thickness/2])
          screw_hole();
          translate([leaf_width/2 + 5, 15, -leaf_thickness/2])
          screw_hole();
          translate([leaf_width/2 + 5, 23, -leaf_thickness/2])
          screw_hole();
      }
  }
  
  // Assembly
  left_leaf();
  right_leaf();
  pin();
SCAD (104 lines)
$fn = 50;

// Parameters
leaf_width = 25;
leaf_height = 30;
leaf_thickness = 2;
knuckle_outer_dia = 8;
knuckle_inner_dia = 4.6;
knuckle_height = 6;
pin_diameter = 4;
pin_length = 32;
screw_hole_dia = 3.2;
countersink_dia = 6;
countersink_depth = 1;

// Pin
module pin() {
    color("silver")
    translate([0, -1, 0])
    rotate([90, 0, 0])
    cylinder(h = pin_length, d = pin_diameter);
}

// Knuckle
module knuckle(height) {
    difference() {
        cylinder(h = height, d = knuckle_outer_dia);
        translate([0, 0, -0.1])
        cylinder(h = height + 0.2, d = knuckle_inner_dia);
    }
}

// Screw hole with countersink
module screw_hole() {
    // Countersink
    translate([0, 0, leaf_thickness - countersink_depth])
    cylinder(h = countersink_depth + 0.1, d1 = screw_hole_dia, d2 = countersink_dia);
    // Through hole
    translate([0, 0, -0.1])
    cylinder(h = leaf_thickness + 0.2, d = screw_hole_dia);
}

// Left leaf
module left_leaf() {
    color("gray")
    difference() {
        union() {
            // Main plate
            translate([-leaf_width, 0, -leaf_thickness/2])
            cube([leaf_width, leaf_height, leaf_thickness]);
            
            // Knuckles (3 pieces: bottom, middle, top)
            rotate([90, 0, 0]) {
                translate([0, 0, 0])
                knuckle(knuckle_height);
                translate([0, 0, -knuckle_height * 2])
                knuckle(knuckle_height);
                translate([0, 0, -knuckle_height * 4])
                knuckle(knuckle_height);
            }
        }
        
        // Screw holes
        translate([-leaf_width/2 - 5, 7, -leaf_thickness/2])
        screw_hole();
        translate([-leaf_width/2 - 5, 15, -leaf_thickness/2])
        screw_hole();
        translate([-leaf_width/2 - 5, 23, -leaf_thickness/2])
        screw_hole();
    }
}

// Right leaf
module right_leaf() {
    color("darkgray")
    difference() {
        union() {
            // Main plate
            translate([0, 0, -leaf_thickness/2])
            cube([leaf_width, leaf_height, leaf_thickness]);
            
            // Knuckles (2 pieces: lower-middle, upper-middle)
            rotate([90, 0, 0]) {
                translate([0, 0, -knuckle_height])
                knuckle(knuckle_height);
                translate([0, 0, -knuckle_height * 3])
                knuckle(knuckle_height);
            }
        }
        
        // Screw holes
        translate([leaf_width/2 + 5, 7, -leaf_thickness/2])
        screw_hole();
        translate([leaf_width/2 + 5, 15, -leaf_thickness/2])
        screw_hole();
        translate([leaf_width/2 + 5, 23, -leaf_thickness/2])
        screw_hole();
    }
}

// Assembly
left_leaf();
right_leaf();
pin();
i2 success
iter 2
20.2s · 2445/981t · $0.1103
diff vs i1: +7/-7
  $fn = 50;
  
  // Parameters
  leaf_width = 25;
  leaf_height = 30;
  leaf_thickness = 2;
  knuckle_outer_dia = 8;
  knuckle_inner_dia = 4.6;
  knuckle_height = 6;
  pin_diameter = 4;
  pin_length = 32;
  screw_hole_dia = 3.2;
  countersink_dia = 6;
  countersink_depth = 1;
  
  // Pin
  module pin() {
      color("silver")
      translate([0, -1, 0])
-     rotate([90, 0, 0])
+     rotate([-90, 0, 0])
      cylinder(h = pin_length, d = pin_diameter);
  }
  
  // Knuckle
  module knuckle(height) {
      difference() {
          cylinder(h = height, d = knuckle_outer_dia);
          translate([0, 0, -0.1])
          cylinder(h = height + 0.2, d = knuckle_inner_dia);
      }
  }
  
  // Screw hole with countersink
  module screw_hole() {
      // Countersink
      translate([0, 0, leaf_thickness - countersink_depth])
      cylinder(h = countersink_depth + 0.1, d1 = screw_hole_dia, d2 = countersink_dia);
      // Through hole
      translate([0, 0, -0.1])
      cylinder(h = leaf_thickness + 0.2, d = screw_hole_dia);
  }
  
  // Left leaf
  module left_leaf() {
      color("gray")
      difference() {
          union() {
              // Main plate
              translate([-leaf_width, 0, -leaf_thickness/2])
              cube([leaf_width, leaf_height, leaf_thickness]);
              
              // Knuckles (3 pieces: bottom, middle, top)
-             rotate([90, 0, 0]) {
+             rotate([-90, 0, 0]) {
                  translate([0, 0, 0])
                  knuckle(knuckle_height);
-                 translate([0, 0, -knuckle_height * 2])
+                 translate([0, 0, knuckle_height * 2])
                  knuckle(knuckle_height);
-                 translate([0, 0, -knuckle_height * 4])
+                 translate([0, 0, knuckle_height * 4])
                  knuckle(knuckle_height);
              }
          }
          
          // Screw holes
          translate([-leaf_width/2 - 5, 7, -leaf_thickness/2])
          screw_hole();
          translate([-leaf_width/2 - 5, 15, -leaf_thickness/2])
          screw_hole();
          translate([-leaf_width/2 - 5, 23, -leaf_thickness/2])
          screw_hole();
      }
  }
  
  // Right leaf
  module right_leaf() {
      color("darkgray")
      difference() {
          union() {
              // Main plate
              translate([0, 0, -leaf_thickness/2])
              cube([leaf_width, leaf_height, leaf_thickness]);
              
              // Knuckles (2 pieces: lower-middle, upper-middle)
-             rotate([90, 0, 0]) {
-                 translate([0, 0, -knuckle_height])
+             rotate([-90, 0, 0]) {
+                 translate([0, 0, knuckle_height])
                  knuckle(knuckle_height);
-                 translate([0, 0, -knuckle_height * 3])
+                 translate([0, 0, knuckle_height * 3])
                  knuckle(knuckle_height);
              }
          }
          
          // Screw holes
          translate([leaf_width/2 + 5, 7, -leaf_thickness/2])
          screw_hole();
          translate([leaf_width/2 + 5, 15, -leaf_thickness/2])
          screw_hole();
          translate([leaf_width/2 + 5, 23, -leaf_thickness/2])
          screw_hole();
      }
  }
  
  // Assembly
  left_leaf();
  right_leaf();
  pin();
SCAD (104 lines)
$fn = 50;

// Parameters
leaf_width = 25;
leaf_height = 30;
leaf_thickness = 2;
knuckle_outer_dia = 8;
knuckle_inner_dia = 4.6;
knuckle_height = 6;
pin_diameter = 4;
pin_length = 32;
screw_hole_dia = 3.2;
countersink_dia = 6;
countersink_depth = 1;

// Pin
module pin() {
    color("silver")
    translate([0, -1, 0])
    rotate([-90, 0, 0])
    cylinder(h = pin_length, d = pin_diameter);
}

// Knuckle
module knuckle(height) {
    difference() {
        cylinder(h = height, d = knuckle_outer_dia);
        translate([0, 0, -0.1])
        cylinder(h = height + 0.2, d = knuckle_inner_dia);
    }
}

// Screw hole with countersink
module screw_hole() {
    // Countersink
    translate([0, 0, leaf_thickness - countersink_depth])
    cylinder(h = countersink_depth + 0.1, d1 = screw_hole_dia, d2 = countersink_dia);
    // Through hole
    translate([0, 0, -0.1])
    cylinder(h = leaf_thickness + 0.2, d = screw_hole_dia);
}

// Left leaf
module left_leaf() {
    color("gray")
    difference() {
        union() {
            // Main plate
            translate([-leaf_width, 0, -leaf_thickness/2])
            cube([leaf_width, leaf_height, leaf_thickness]);
            
            // Knuckles (3 pieces: bottom, middle, top)
            rotate([-90, 0, 0]) {
                translate([0, 0, 0])
                knuckle(knuckle_height);
                translate([0, 0, knuckle_height * 2])
                knuckle(knuckle_height);
                translate([0, 0, knuckle_height * 4])
                knuckle(knuckle_height);
            }
        }
        
        // Screw holes
        translate([-leaf_width/2 - 5, 7, -leaf_thickness/2])
        screw_hole();
        translate([-leaf_width/2 - 5, 15, -leaf_thickness/2])
        screw_hole();
        translate([-leaf_width/2 - 5, 23, -leaf_thickness/2])
        screw_hole();
    }
}

// Right leaf
module right_leaf() {
    color("darkgray")
    difference() {
        union() {
            // Main plate
            translate([0, 0, -leaf_thickness/2])
            cube([leaf_width, leaf_height, leaf_thickness]);
            
            // Knuckles (2 pieces: lower-middle, upper-middle)
            rotate([-90, 0, 0]) {
                translate([0, 0, knuckle_height])
                knuckle(knuckle_height);
                translate([0, 0, knuckle_height * 3])
                knuckle(knuckle_height);
            }
        }
        
        // Screw holes
        translate([leaf_width/2 + 5, 7, -leaf_thickness/2])
        screw_hole();
        translate([leaf_width/2 + 5, 15, -leaf_thickness/2])
        screw_hole();
        translate([leaf_width/2 + 5, 23, -leaf_thickness/2])
        screw_hole();
    }
}

// Assembly
left_leaf();
right_leaf();
pin();
i3 success
iter 3
16.5s · 2444/991t · $0.1110
diff vs i2: +12/-12
  $fn = 50;
  
  // Parameters
  leaf_width = 25;
  leaf_height = 30;
  leaf_thickness = 2;
  knuckle_outer_dia = 8;
  knuckle_inner_dia = 4.6;
  knuckle_height = 6;
  pin_diameter = 4;
  pin_length = 32;
  screw_hole_dia = 3.2;
  countersink_dia = 6;
  countersink_depth = 1;
  
  // Pin
  module pin() {
      color("silver")
      translate([0, -1, 0])
      rotate([-90, 0, 0])
      cylinder(h = pin_length, d = pin_diameter);
  }
  
  // Knuckle
  module knuckle(height) {
      difference() {
          cylinder(h = height, d = knuckle_outer_dia);
          translate([0, 0, -0.1])
          cylinder(h = height + 0.2, d = knuckle_inner_dia);
      }
  }
  
  // Screw hole with countersink
  module screw_hole() {
-     // Countersink
-     translate([0, 0, leaf_thickness - countersink_depth])
-     cylinder(h = countersink_depth + 0.1, d1 = screw_hole_dia, d2 = countersink_dia);
      // Through hole
      translate([0, 0, -0.1])
      cylinder(h = leaf_thickness + 0.2, d = screw_hole_dia);
+     // Countersink
+     translate([0, 0, leaf_thickness - countersink_depth])
+     cylinder(h = countersink_depth + 0.1, d2 = countersink_dia, d1 = screw_hole_dia);
  }
  
  // Left leaf
  module left_leaf() {
      color("gray")
      difference() {
          union() {
              // Main plate
              translate([-leaf_width, 0, -leaf_thickness/2])
-             cube([leaf_width, leaf_height, leaf_thickness]);
+             cube([leaf_width - knuckle_outer_dia/2, leaf_height, leaf_thickness]);
              
              // Knuckles (3 pieces: bottom, middle, top)
              rotate([-90, 0, 0]) {
                  translate([0, 0, 0])
                  knuckle(knuckle_height);
                  translate([0, 0, knuckle_height * 2])
                  knuckle(knuckle_height);
                  translate([0, 0, knuckle_height * 4])
                  knuckle(knuckle_height);
              }
          }
          
          // Screw holes
-         translate([-leaf_width/2 - 5, 7, -leaf_thickness/2])
+         translate([-leaf_width + 8, 7, -leaf_thickness/2])
          screw_hole();
-         translate([-leaf_width/2 - 5, 15, -leaf_thickness/2])
+         translate([-leaf_width + 8, 15, -leaf_thickness/2])
          screw_hole();
-         translate([-leaf_width/2 - 5, 23, -leaf_thickness/2])
+         translate([-leaf_width + 8, 23, -leaf_thickness/2])
          screw_hole();
      }
  }
  
  // Right leaf
  module right_leaf() {
      color("darkgray")
      difference() {
          union() {
              // Main plate
-             translate([0, 0, -leaf_thickness/2])
-             cube([leaf_width, leaf_height, leaf_thickness]);
+             translate([knuckle_outer_dia/2, 0, -leaf_thickness/2])
+             cube([leaf_width - knuckle_outer_dia/2, leaf_height, leaf_thickness]);
              
              // Knuckles (2 pieces: lower-middle, upper-middle)
              rotate([-90, 0, 0]) {
                  translate([0, 0, knuckle_height])
                  knuckle(knuckle_height);
                  translate([0, 0, knuckle_height * 3])
                  knuckle(knuckle_height);
              }
          }
          
          // Screw holes
-         translate([leaf_width/2 + 5, 7, -leaf_thickness/2])
+         translate([leaf_width - 8, 7, -leaf_thickness/2])
          screw_hole();
-         translate([leaf_width/2 + 5, 15, -leaf_thickness/2])
+         translate([leaf_width - 8, 15, -leaf_thickness/2])
          screw_hole();
-         translate([leaf_width/2 + 5, 23, -leaf_thickness/2])
+         translate([leaf_width - 8, 23, -leaf_thickness/2])
          screw_hole();
      }
  }
  
  // Assembly
  left_leaf();
  right_leaf();
  pin();
SCAD (104 lines)
$fn = 50;

// Parameters
leaf_width = 25;
leaf_height = 30;
leaf_thickness = 2;
knuckle_outer_dia = 8;
knuckle_inner_dia = 4.6;
knuckle_height = 6;
pin_diameter = 4;
pin_length = 32;
screw_hole_dia = 3.2;
countersink_dia = 6;
countersink_depth = 1;

// Pin
module pin() {
    color("silver")
    translate([0, -1, 0])
    rotate([-90, 0, 0])
    cylinder(h = pin_length, d = pin_diameter);
}

// Knuckle
module knuckle(height) {
    difference() {
        cylinder(h = height, d = knuckle_outer_dia);
        translate([0, 0, -0.1])
        cylinder(h = height + 0.2, d = knuckle_inner_dia);
    }
}

// Screw hole with countersink
module screw_hole() {
    // Through hole
    translate([0, 0, -0.1])
    cylinder(h = leaf_thickness + 0.2, d = screw_hole_dia);
    // Countersink
    translate([0, 0, leaf_thickness - countersink_depth])
    cylinder(h = countersink_depth + 0.1, d2 = countersink_dia, d1 = screw_hole_dia);
}

// Left leaf
module left_leaf() {
    color("gray")
    difference() {
        union() {
            // Main plate
            translate([-leaf_width, 0, -leaf_thickness/2])
            cube([leaf_width - knuckle_outer_dia/2, leaf_height, leaf_thickness]);
            
            // Knuckles (3 pieces: bottom, middle, top)
            rotate([-90, 0, 0]) {
                translate([0, 0, 0])
                knuckle(knuckle_height);
                translate([0, 0, knuckle_height * 2])
                knuckle(knuckle_height);
                translate([0, 0, knuckle_height * 4])
                knuckle(knuckle_height);
            }
        }
        
        // Screw holes
        translate([-leaf_width + 8, 7, -leaf_thickness/2])
        screw_hole();
        translate([-leaf_width + 8, 15, -leaf_thickness/2])
        screw_hole();
        translate([-leaf_width + 8, 23, -leaf_thickness/2])
        screw_hole();
    }
}

// Right leaf
module right_leaf() {
    color("darkgray")
    difference() {
        union() {
            // Main plate
            translate([knuckle_outer_dia/2, 0, -leaf_thickness/2])
            cube([leaf_width - knuckle_outer_dia/2, leaf_height, leaf_thickness]);
            
            // Knuckles (2 pieces: lower-middle, upper-middle)
            rotate([-90, 0, 0]) {
                translate([0, 0, knuckle_height])
                knuckle(knuckle_height);
                translate([0, 0, knuckle_height * 3])
                knuckle(knuckle_height);
            }
        }
        
        // Screw holes
        translate([leaf_width - 8, 7, -leaf_thickness/2])
        screw_hole();
        translate([leaf_width - 8, 15, -leaf_thickness/2])
        screw_hole();
        translate([leaf_width - 8, 23, -leaf_thickness/2])
        screw_hole();
    }
}

// Assembly
left_leaf();
right_leaf();
pin();