99 lines
3.7 KiB
OpenSCAD
99 lines
3.7 KiB
OpenSCAD
// PCIe Extension Riser Board Holder
|
|
// Configurable 3D printable holder with M3 mounting holes
|
|
|
|
// === 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
|
|
|
|
// === 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;
|
|
|
|
// Extension parameters for negative y direction
|
|
extension_from_holes = 42; // 40mm extension in negative y direction from holes
|
|
hole_y_position = total_width/2; // Current hole y position
|
|
|
|
// New total width includes original width plus extension
|
|
extended_total_width = total_width + extension_from_holes;
|
|
|
|
// Main holder body
|
|
difference() {
|
|
// Create the main rectangular plane, translated to accommodate extension
|
|
translate([0, -extension_from_holes, 0])
|
|
cube([total_length, extended_total_width, thickness]);
|
|
|
|
// Create M3 holes (position unchanged relative to original rectangle)
|
|
for (i = [0 : len(hole_positions) - 1]) {
|
|
translate([margin_x + hole_positions[i], hole_y_position, -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], hole_y_position, 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 ", extended_total_width, "mm x ", thickness, "mm"));
|
|
echo(str("Extension: 40mm in negative y direction from holes"));
|
|
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 ===");
|
|
}
|
|
|
|
// === Test the holder ===
|
|
// Default holder
|
|
pcie_riser_holder();
|