This commit is contained in:
dingfeng.wong
2025-07-21 23:56:12 +08:00
parent 58c3941d8a
commit 35a971c68f
+5 -85
View File
@@ -1,23 +1,8 @@
// PCIe Extension Riser Board Holder
// Configurable 3D printable holder with M3 mounting holes
// 2020 Extrusion Insert
// Configurable 3D printable insert for 2020 aluminum extrusion
// === Design Parameters ===
thickness = 3; // Thickness of the holder (configurable)
hole_diameter = 2.8; // M3 hole diameter (slightly smaller for 3D printing)
margin_x = 8; // Margin on each side of the holes
margin_y = 6; // Margin above and below the holes (currently unused)
holder_width = 6; // Width of the rectangular plane
// === Hole Spacing Parameters ===
first_hole_spacing = 20.5; // Distance from first to second hole
second_hole_spacing = 20.5; // Distance from second to third hole
third_hole_spacing = 22; // Distance from third to fourth hole
// === Technical Parameters ===
cylinder_overlap = 0.1; // Small overlap to ensure clean boolean operations
cylinder_resolution = 32; // Number of facets for cylinders (higher = smoother)
preview_cylinder_height = 2; // Height of preview cylinders
preview_cylinder_diameter = 3; // Diameter of preview cylinders
// Import PCIe holder functionality
include <holder.scad>;
// === 2020 Extrusion Insert Parameters ===
extrusion_2020_outer = 20; // 2020 extrusion outer dimension
@@ -124,74 +109,9 @@ module extrusion_2020_insert_3d(
);
}
// === Main Function ===
module pcie_riser_holder(
thickness = 3,
hole_diameter = 2.8,
margin_x = 8,
holder_width = 12,
first_spacing = 20.5,
second_spacing = 20.5,
third_spacing = 22,
show_preview_holes = false
) {
// Calculate hole positions
hole_position_1 = 0;
hole_position_2 = hole_position_1 + first_spacing;
hole_position_3 = hole_position_2 + second_spacing;
hole_position_4 = hole_position_3 + third_spacing;
hole_positions = [
hole_position_1,
hole_position_2,
hole_position_3,
hole_position_4
];
// Calculate total dimensions
total_length = hole_position_4 + (margin_x * 2);
total_width = holder_width;
// Main holder body
difference() {
// Create the main rectangular plane
cube([total_length, total_width, thickness]);
// Create M3 holes
for (i = [0 : len(hole_positions) - 1]) {
translate([margin_x + hole_positions[i], total_width/2, -cylinder_overlap])
cylinder(
h = thickness + (cylinder_overlap * 2),
d = hole_diameter,
$fn = cylinder_resolution
);
}
}
// Optional preview holes for reference
if (show_preview_holes) {
for (i = [0 : len(hole_positions) - 1]) {
translate([margin_x + hole_positions[i], total_width/2, thickness])
cylinder(
h = preview_cylinder_height,
d = preview_cylinder_diameter,
$fn = cylinder_resolution
);
}
}
// Display specifications
echo("=== PCIe Riser Holder Specifications ===");
echo(str("Total dimensions: ", total_length, "mm x ", total_width, "mm x ", thickness, "mm"));
echo(str("Hole spacing: ", first_spacing, "mm, ", second_spacing, "mm, ", third_spacing, "mm"));
echo(str("Hole positions: ", hole_positions));
echo(str("Hole diameter: ", hole_diameter, "mm (for M3 bolts)"));
echo("=== End Specifications ===");
}
// === Usage Examples ===
// Generate the PCIe riser holder
// Generate the PCIe riser holder using imported functionality
pcie_riser_holder(
thickness = thickness,
hole_diameter = hole_diameter,