47.0s
· 1306/6785t · $0.0028
diff vs bare: +11/-15
// OpenSCAD: M8 hex bolt (thread omitted), hex head + cylindrical shank
+ // Improvement: rotate hex head so across-flats aligns with X axis (flat faces facing left/right)
- // Across-flats of hex head
- D = 13; // mm
+ D = 13; // across-flats of hex head (mm)
+ R = D / sqrt(3); // hexagon circumradius for regular hex with given across-flats
- // Regular hexagon circumradius from across-flats: R = D / sqrt(3)
- R = D / sqrt(3);
-
- // 2D hexagon points (circumradius R), oriented generically
points_hex = [
for (i = [0 : 5])
- [
- R * cos(i * 60 * PI / 180),
- R * sin(i * 60 * PI / 180)
- ]
+ [ R * cos(i * 60 * PI / 180),
+ R * sin(i * 60 * PI / 180) ]
];
- // Head: hexagonal prism, thickness 5.3 mm, bottom on z = 0
+ // Head: hex prism, 5.3 mm tall, bottom at z = 0, rotated so flats align with X
module head() {
- linear_extrude(height = 5.3, center = false)
- polygon(points = points_hex);
+ rotate([0, 0, 30])
+ linear_extrude(height = 5.3, center = false)
+ polygon(points = points_hex);
}
- // Shank: cylinder, diameter 8 mm (radius 4 mm), length 30 mm
+ // Shank: cylinder, diameter 8 mm (radius 4 mm), length 30 mm, extending into z < 0
module shank() {
cylinder(h = 30, r = 4, center = false);
}
- // Assemble: head on top (z 0 to 5.3), shank extending to z < 0 (z -30 to 0)
+ // Assemble: head on top (z 0..5.3), shank from z -30 .. 0
union() {
head(); // z = 0 .. 5.3
translate([0, 0, -30])
shank(); // z = -30 .. 0
}
SCAD (30 lines)
// OpenSCAD: M8 hex bolt (thread omitted), hex head + cylindrical shank
// Improvement: rotate hex head so across-flats aligns with X axis (flat faces facing left/right)
D = 13; // across-flats of hex head (mm)
R = D / sqrt(3); // hexagon circumradius for regular hex with given across-flats
points_hex = [
for (i = [0 : 5])
[ R * cos(i * 60 * PI / 180),
R * sin(i * 60 * PI / 180) ]
];
// Head: hex prism, 5.3 mm tall, bottom at z = 0, rotated so flats align with X
module head() {
rotate([0, 0, 30])
linear_extrude(height = 5.3, center = false)
polygon(points = points_hex);
}
// Shank: cylinder, diameter 8 mm (radius 4 mm), length 30 mm, extending into z < 0
module shank() {
cylinder(h = 30, r = 4, center = false);
}
// Assemble: head on top (z 0..5.3), shank from z -30 .. 0
union() {
head(); // z = 0 .. 5.3
translate([0, 0, -30])
shank(); // z = -30 .. 0
}
27.8s
· 1320/3955t · $0.0016
diff vs i1: +0/-0
// OpenSCAD: M8 hex bolt (thread omitted), hex head + cylindrical shank
// Improvement: rotate hex head so across-flats aligns with X axis (flat faces facing left/right)
D = 13; // across-flats of hex head (mm)
R = D / sqrt(3); // hexagon circumradius for regular hex with given across-flats
points_hex = [
for (i = [0 : 5])
[ R * cos(i * 60 * PI / 180),
R * sin(i * 60 * PI / 180) ]
];
// Head: hex prism, 5.3 mm tall, bottom at z = 0, rotated so flats align with X
module head() {
rotate([0, 0, 30])
linear_extrude(height = 5.3, center = false)
polygon(points = points_hex);
}
// Shank: cylinder, diameter 8 mm (radius 4 mm), length 30 mm, extending into z < 0
module shank() {
cylinder(h = 30, r = 4, center = false);
}
// Assemble: head on top (z 0..5.3), shank from z -30 .. 0
union() {
head(); // z = 0 .. 5.3
translate([0, 0, -30])
shank(); // z = -30 .. 0
}
SCAD (30 lines)
// OpenSCAD: M8 hex bolt (thread omitted), hex head + cylindrical shank
// Improvement: rotate hex head so across-flats aligns with X axis (flat faces facing left/right)
D = 13; // across-flats of hex head (mm)
R = D / sqrt(3); // hexagon circumradius for regular hex with given across-flats
points_hex = [
for (i = [0 : 5])
[ R * cos(i * 60 * PI / 180),
R * sin(i * 60 * PI / 180) ]
];
// Head: hex prism, 5.3 mm tall, bottom at z = 0, rotated so flats align with X
module head() {
rotate([0, 0, 30])
linear_extrude(height = 5.3, center = false)
polygon(points = points_hex);
}
// Shank: cylinder, diameter 8 mm (radius 4 mm), length 30 mm, extending into z < 0
module shank() {
cylinder(h = 30, r = 4, center = false);
}
// Assemble: head on top (z 0..5.3), shank from z -30 .. 0
union() {
head(); // z = 0 .. 5.3
translate([0, 0, -30])
shank(); // z = -30 .. 0
}
52.3s
· 1320/6832t · $0.0028
diff vs i2: +0/-0
// OpenSCAD: M8 hex bolt (thread omitted), hex head + cylindrical shank
// Improvement: rotate hex head so across-flats aligns with X axis (flat faces facing left/right)
D = 13; // across-flats of hex head (mm)
R = D / sqrt(3); // hexagon circumradius for regular hex with given across-flats
points_hex = [
for (i = [0 : 5])
[ R * cos(i * 60 * PI / 180),
R * sin(i * 60 * PI / 180) ]
];
// Head: hex prism, 5.3 mm tall, bottom at z = 0, rotated so flats align with X
module head() {
rotate([0, 0, 30])
linear_extrude(height = 5.3, center = false)
polygon(points = points_hex);
}
// Shank: cylinder, diameter 8 mm (radius 4 mm), length 30 mm, extending into z < 0
module shank() {
cylinder(h = 30, r = 4, center = false);
}
// Assemble: head on top (z 0..5.3), shank from z -30 .. 0
union() {
head(); // z = 0 .. 5.3
translate([0, 0, -30])
shank(); // z = -30 .. 0
}
SCAD (30 lines)
// OpenSCAD: M8 hex bolt (thread omitted), hex head + cylindrical shank
// Improvement: rotate hex head so across-flats aligns with X axis (flat faces facing left/right)
D = 13; // across-flats of hex head (mm)
R = D / sqrt(3); // hexagon circumradius for regular hex with given across-flats
points_hex = [
for (i = [0 : 5])
[ R * cos(i * 60 * PI / 180),
R * sin(i * 60 * PI / 180) ]
];
// Head: hex prism, 5.3 mm tall, bottom at z = 0, rotated so flats align with X
module head() {
rotate([0, 0, 30])
linear_extrude(height = 5.3, center = false)
polygon(points = points_hex);
}
// Shank: cylinder, diameter 8 mm (radius 4 mm), length 30 mm, extending into z < 0
module shank() {
cylinder(h = 30, r = 4, center = false);
}
// Assemble: head on top (z 0..5.3), shank from z -30 .. 0
union() {
head(); // z = 0 .. 5.3
translate([0, 0, -30])
shank(); // z = -30 .. 0
}