diff vs bare: +50/-60
- // L-bracket parameters
- bracket_w = 50; // width (common to both flanges)
- bracket_h = 40; // height / depth of flanges
+ // パラメータ
+ bracket_w = 50; // 幅
+ bracket_h = 40; // 奥行・高さ
thickness = 3;
- // Countersunk hole parameters
- hole_d = 4.5; // through hole diameter
- cs_d = 8; // countersink diameter
- cs_depth = 2; // countersink depth
- edge_offset = 10; // distance from edge to hole center (along the main axis)
- center_line = bracket_w/2;
+ // 皿穴パラメータ
+ hole_d = 4.5; // 貫通穴径
+ cs_d = 8; // 皿座径
+ cs_depth = 2; // 皿座深さ
+ edge_offset = 10; // フランジ面の縁から穴中心までの距離
- // Hole positions (symmetric along width)
- hole_y_pos = [edge_offset, bracket_h-edge_offset];
+ // 2つ穴のY/Z座標
+ hole_pos = [edge_offset, bracket_h - edge_offset];
- // Utilities
- module countersunk_hole(face="") {
- // face: "top" or "side"
- if (face == "top") {
- // Plate at Z = 0, +Y; hole along -Z
- translate([0,0,thickness])
- rotate([90,0,0])
+ // 板金L金具
+ module flange_horizontal() {
+ // 原点コーナーから +Y 方向へ
+ difference() {
+ cube([bracket_w, bracket_h, thickness]);
+ // 穴: 原点からY方向へ広がる、皿頭外側(Z=0側が外面)
+ for (y = hole_pos)
+ translate([bracket_w/2, y, 0])
+ countersunk_hole("down");
+ }
+ }
+ module flange_vertical() {
+ // 原点から +Z方向へ
+ difference() {
+ cube([bracket_w, thickness, bracket_h]);
+ // 穴: 原点からZ方向へ広がる、皿頭外側(Y=0側が外面)
+ for (z = hole_pos)
+ translate([bracket_w/2, 0, z])
+ countersunk_hole("front");
+ }
+ }
+
+ // 皿穴モジュール
+ // face: "down"=下向き外面, "front"=前向き外面
+ module countersunk_hole(face) {
+ if (face == "down") {
+ // Z=0側が皿座
union() {
- // Through hole
- cylinder(d=hole_d, h=thickness+0.5, $fn=32);
- // Countersink
- translate([0,0,-cs_depth])
+ // 貫通穴
+ cylinder(d=hole_d, h=thickness+0.2, $fn=32);
+ // 皿座
cylinder(d=cs_d, h=cs_depth, $fn=32);
}
- }
- if (face == "side") {
- // Plate at Y = 0, +Z; hole along -Y
- translate([0,thickness,0])
- rotate([0,90,0])
+ } else if (face == "front") {
+ // Y=0側が皿座
+ rotate([-90,0,0])
union() {
- // Through hole
- cylinder(d=hole_d, h=thickness+0.5, $fn=32);
- // Countersink
- translate([0,0,-cs_depth])
+ // 貫通穴
+ cylinder(d=hole_d, h=thickness+0.2, $fn=32);
+ // 皿座
cylinder(d=cs_d, h=cs_depth, $fn=32);
}
}
}
- // Horizontal flange
- module flange_top() {
- difference() {
- // Main plate
- translate([0, 0, 0])
- cube([bracket_w, bracket_h, thickness]);
- // Holes
- for (ypos = hole_y_pos)
- translate([center_line, ypos, 0])
- countersunk_hole("top");
- }
- }
-
- // Vertical flange
- module flange_side() {
- difference() {
- // Main plate
- translate([0, 0, 0])
- cube([bracket_w, thickness, bracket_h]);
- // Holes
- for (zpos = hole_y_pos)
- translate([center_line, 0, zpos])
- countersunk_hole("side");
- }
- }
-
- // Assemble L-bracket at origin (inner corner at [0,0,0])
- flange_top();
- flange_side();
+ // 組立(原点内コーナー)
+ flange_horizontal();
+ translate([0, 0, thickness]) // 水平板上端に垂直板
+ flange_vertical();
SCAD (63 lines)
// パラメータ
bracket_w = 50; // 幅
bracket_h = 40; // 奥行・高さ
thickness = 3;
// 皿穴パラメータ
hole_d = 4.5; // 貫通穴径
cs_d = 8; // 皿座径
cs_depth = 2; // 皿座深さ
edge_offset = 10; // フランジ面の縁から穴中心までの距離
// 2つ穴のY/Z座標
hole_pos = [edge_offset, bracket_h - edge_offset];
// 板金L金具
module flange_horizontal() {
// 原点コーナーから +Y 方向へ
difference() {
cube([bracket_w, bracket_h, thickness]);
// 穴: 原点からY方向へ広がる、皿頭外側(Z=0側が外面)
for (y = hole_pos)
translate([bracket_w/2, y, 0])
countersunk_hole("down");
}
}
module flange_vertical() {
// 原点から +Z方向へ
difference() {
cube([bracket_w, thickness, bracket_h]);
// 穴: 原点からZ方向へ広がる、皿頭外側(Y=0側が外面)
for (z = hole_pos)
translate([bracket_w/2, 0, z])
countersunk_hole("front");
}
}
// 皿穴モジュール
// face: "down"=下向き外面, "front"=前向き外面
module countersunk_hole(face) {
if (face == "down") {
// Z=0側が皿座
union() {
// 貫通穴
cylinder(d=hole_d, h=thickness+0.2, $fn=32);
// 皿座
cylinder(d=cs_d, h=cs_depth, $fn=32);
}
} else if (face == "front") {
// Y=0側が皿座
rotate([-90,0,0])
union() {
// 貫通穴
cylinder(d=hole_d, h=thickness+0.2, $fn=32);
// 皿座
cylinder(d=cs_d, h=cs_depth, $fn=32);
}
}
}
// 組立(原点内コーナー)
flange_horizontal();
translate([0, 0, thickness]) // 水平板上端に垂直板
flange_vertical();