4.0s
· 1739/523t · $0.0004
diff vs bare: +16/-11
// パラメータ設定
width = 50;
depth = 40;
height = 40;
thickness = 3;
hole_dia = 4.5;
cs_dia = 8.0;
cs_depth = 2.0;
- module hole() {
+ // 皿穴モジュール(外側から皿座面を彫る)
+ module hole_h(inverted = false) {
union() {
+ // 貫通穴
cylinder(d = hole_dia, h = thickness * 2, center = true);
- translate([0, 0, thickness / 2 - cs_depth + 0.01])
- cylinder(d = cs_dia, h = cs_depth, $fn = 32);
+ // 皿座面
+ translate([0, 0, inverted ? -thickness/2 + cs_depth/2 : thickness/2 - cs_depth/2])
+ cylinder(d = cs_dia, h = cs_depth, center = true, $fn = 32);
}
}
module l_bracket() {
difference() {
union() {
- // 水平面
+ // 水平面 (Y方向に40mm)
cube([width, depth, thickness]);
- // 垂直面
+ // 垂直面 (Z方向に40mm)
cube([width, thickness, height]);
}
- // 水平面の穴
+ // 水平面の穴: 縁から10mm内側 (Y=10とY=30の位置)
+ // 水平面の上面(Z=3)側から皿座面を彫るため、invertedをfalseにする
for (x = [-1, 1]) {
- translate([width / 2 + x * 15, 10 + (depth - 10) / 2, -thickness])
- hole();
+ translate([width / 2 + x * 10, 10 + (depth - 20) / 2, 0])
+ hole_h(inverted = false);
}
- // 垂直面の穴
+ // 垂直面の穴: 縁から10mm内側 (Z=10とZ=30の位置)
+ // 垂直面の前面(Y=3)側から皿座面を彫るため、invertedをtrueにする
for (x = [-1, 1]) {
- translate([width / 2 + x * 15, thickness + 1, 10 + (height - 10) / 2])
+ translate([width / 2 + x * 10, 0, 10 + (height - 20) / 2])
rotate([90, 0, 0])
- hole();
+ hole_h(inverted = true);
}
}
}
$fn = 64;
l_bracket();
SCAD (49 lines)
// パラメータ設定
width = 50;
depth = 40;
height = 40;
thickness = 3;
hole_dia = 4.5;
cs_dia = 8.0;
cs_depth = 2.0;
// 皿穴モジュール(外側から皿座面を彫る)
module hole_h(inverted = false) {
union() {
// 貫通穴
cylinder(d = hole_dia, h = thickness * 2, center = true);
// 皿座面
translate([0, 0, inverted ? -thickness/2 + cs_depth/2 : thickness/2 - cs_depth/2])
cylinder(d = cs_dia, h = cs_depth, center = true, $fn = 32);
}
}
module l_bracket() {
difference() {
union() {
// 水平面 (Y方向に40mm)
cube([width, depth, thickness]);
// 垂直面 (Z方向に40mm)
cube([width, thickness, height]);
}
// 水平面の穴: 縁から10mm内側 (Y=10とY=30の位置)
// 水平面の上面(Z=3)側から皿座面を彫るため、invertedをfalseにする
for (x = [-1, 1]) {
translate([width / 2 + x * 10, 10 + (depth - 20) / 2, 0])
hole_h(inverted = false);
}
// 垂直面の穴: 縁から10mm内側 (Z=10とZ=30の位置)
// 垂直面の前面(Y=3)側から皿座面を彫るため、invertedをtrueにする
for (x = [-1, 1]) {
translate([width / 2 + x * 10, 0, 10 + (height - 20) / 2])
rotate([90, 0, 0])
hole_h(inverted = true);
}
}
}
$fn = 64;
l_bracket();
5.7s
· 1907/434t · $0.0004
diff vs i1: +15/-15
// パラメータ設定
width = 50;
depth = 40;
height = 40;
thickness = 3;
hole_dia = 4.5;
cs_dia = 8.0;
cs_depth = 2.0;
- // 皿穴モジュール(外側から皿座面を彫る)
- module hole_h(inverted = false) {
+ // 皿穴モジュール
+ module countersunk_hole() {
union() {
// 貫通穴
- cylinder(d = hole_dia, h = thickness * 2, center = true);
- // 皿座面
- translate([0, 0, inverted ? -thickness/2 + cs_depth/2 : thickness/2 - cs_depth/2])
+ cylinder(d = hole_dia, h = thickness * 3, center = true);
+ // 皿座面(板の厚みに対して片側に配置)
+ translate([0, 0, thickness/2 - cs_depth/2])
cylinder(d = cs_dia, h = cs_depth, center = true, $fn = 32);
}
}
module l_bracket() {
difference() {
union() {
// 水平面 (Y方向に40mm)
cube([width, depth, thickness]);
// 垂直面 (Z方向に40mm)
cube([width, thickness, height]);
}
- // 水平面の穴: 縁から10mm内側 (Y=10とY=30の位置)
- // 水平面の上面(Z=3)側から皿座面を彫るため、invertedをfalseにする
- for (x = [-1, 1]) {
- translate([width / 2 + x * 10, 10 + (depth - 20) / 2, 0])
- hole_h(inverted = false);
+ // 水平面の穴
+ // 縁(Y=40)から10mm内側なのでY=30、左右対称に配置
+ for (x = [-10, 10]) {
+ translate([width / 2 + x, 30, 0])
+ countersunk_hole();
}
- // 垂直面の穴: 縁から10mm内側 (Z=10とZ=30の位置)
- // 垂直面の前面(Y=3)側から皿座面を彫るため、invertedをtrueにする
- for (x = [-1, 1]) {
- translate([width / 2 + x * 10, 0, 10 + (height - 20) / 2])
+ // 垂直面の穴
+ // 縁(Z=40)から10mm内側なのでZ=30、左右対称に配置
+ for (x = [-10, 10]) {
+ translate([width / 2 + x, 0, 30])
rotate([90, 0, 0])
- hole_h(inverted = true);
+ countersunk_hole();
}
}
}
$fn = 64;
l_bracket();
SCAD (49 lines)
// パラメータ設定
width = 50;
depth = 40;
height = 40;
thickness = 3;
hole_dia = 4.5;
cs_dia = 8.0;
cs_depth = 2.0;
// 皿穴モジュール
module countersunk_hole() {
union() {
// 貫通穴
cylinder(d = hole_dia, h = thickness * 3, center = true);
// 皿座面(板の厚みに対して片側に配置)
translate([0, 0, thickness/2 - cs_depth/2])
cylinder(d = cs_dia, h = cs_depth, center = true, $fn = 32);
}
}
module l_bracket() {
difference() {
union() {
// 水平面 (Y方向に40mm)
cube([width, depth, thickness]);
// 垂直面 (Z方向に40mm)
cube([width, thickness, height]);
}
// 水平面の穴
// 縁(Y=40)から10mm内側なのでY=30、左右対称に配置
for (x = [-10, 10]) {
translate([width / 2 + x, 30, 0])
countersunk_hole();
}
// 垂直面の穴
// 縁(Z=40)から10mm内側なのでZ=30、左右対称に配置
for (x = [-10, 10]) {
translate([width / 2 + x, 0, 30])
rotate([90, 0, 0])
countersunk_hole();
}
}
}
$fn = 64;
l_bracket();
3.2s
· 1818/479t · $0.0004
diff vs i2: +13/-12
// パラメータ設定
width = 50;
depth = 40;
height = 40;
thickness = 3;
hole_dia = 4.5;
cs_dia = 8.0;
cs_depth = 2.0;
// 皿穴モジュール
- module countersunk_hole() {
+ // 皿座面が常に外側(プレートの上面または背面)に来るように調整
+ module countersunk_hole(is_vertical = false) {
union() {
// 貫通穴
- cylinder(d = hole_dia, h = thickness * 3, center = true);
- // 皿座面(板の厚みに対して片側に配置)
- translate([0, 0, thickness/2 - cs_depth/2])
- cylinder(d = cs_dia, h = cs_depth, center = true, $fn = 32);
+ cylinder(d = hole_dia, h = thickness * 2, center = true);
+ // 皿座面
+ translate([0, 0, is_vertical ? -thickness/2 + cs_depth/2 : thickness/2 - cs_depth/2])
+ cylinder(d = cs_dia, h = cs_depth, center = true, $fn = 64);
}
}
module l_bracket() {
difference() {
union() {
// 水平面 (Y方向に40mm)
cube([width, depth, thickness]);
// 垂直面 (Z方向に40mm)
cube([width, thickness, height]);
}
- // 水平面の穴
- // 縁(Y=40)から10mm内側なのでY=30、左右対称に配置
+ // 水平面の穴(上面から掘る)
+ // 縁(Y=40)から10mm内側 = Y=30
for (x = [-10, 10]) {
translate([width / 2 + x, 30, 0])
- countersunk_hole();
+ countersunk_hole(is_vertical = false);
}
- // 垂直面の穴
- // 縁(Z=40)から10mm内側なのでZ=30、左右対称に配置
+ // 垂直面の穴(背面から掘る)
+ // 縁(Z=40)から10mm内側 = Z=30
for (x = [-10, 10]) {
- translate([width / 2 + x, 0, 30])
+ translate([width / 2 + x, thickness, 30])
rotate([90, 0, 0])
- countersunk_hole();
+ countersunk_hole(is_vertical = true);
}
}
}
$fn = 64;
l_bracket();
SCAD (50 lines)
// パラメータ設定
width = 50;
depth = 40;
height = 40;
thickness = 3;
hole_dia = 4.5;
cs_dia = 8.0;
cs_depth = 2.0;
// 皿穴モジュール
// 皿座面が常に外側(プレートの上面または背面)に来るように調整
module countersunk_hole(is_vertical = false) {
union() {
// 貫通穴
cylinder(d = hole_dia, h = thickness * 2, center = true);
// 皿座面
translate([0, 0, is_vertical ? -thickness/2 + cs_depth/2 : thickness/2 - cs_depth/2])
cylinder(d = cs_dia, h = cs_depth, center = true, $fn = 64);
}
}
module l_bracket() {
difference() {
union() {
// 水平面 (Y方向に40mm)
cube([width, depth, thickness]);
// 垂直面 (Z方向に40mm)
cube([width, thickness, height]);
}
// 水平面の穴(上面から掘る)
// 縁(Y=40)から10mm内側 = Y=30
for (x = [-10, 10]) {
translate([width / 2 + x, 30, 0])
countersunk_hole(is_vertical = false);
}
// 垂直面の穴(背面から掘る)
// 縁(Z=40)から10mm内側 = Z=30
for (x = [-10, 10]) {
translate([width / 2 + x, thickness, 30])
rotate([90, 0, 0])
countersunk_hole(is_vertical = true);
}
}
}
$fn = 64;
l_bracket();