save
This commit is contained in:
+85
@@ -0,0 +1,85 @@
|
||||
// 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;
|
||||
|
||||
// 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 ===");
|
||||
}
|
||||
@@ -0,0 +1,223 @@
|
||||
// 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
|
||||
|
||||
// === 2020 Extrusion Insert Parameters ===
|
||||
extrusion_2020_outer = 20; // 2020 extrusion outer dimension
|
||||
extrusion_2020_inner = 16.2; // Internal cavity dimension
|
||||
extrusion_2020_slot_width = 6; // T-slot opening width
|
||||
extrusion_2020_slot_depth = 1.8; // T-slot depth from outer edge
|
||||
tab_clearance = 0.2; // Clearance for tabs to fit in T-slots
|
||||
insert_clearance = 0.1; // General clearance for the insert body
|
||||
|
||||
// === 2020 Extrusion Insert Module ===
|
||||
module extrusion_2020_insert_2d(
|
||||
with_tabs = true, // Include tabs for T-slot engagement
|
||||
tab_width = 4, // Width of each tab
|
||||
tab_thickness = 1.6, // Thickness of tabs (fits in T-slot depth)
|
||||
insert_width = 15.8, // Width of main insert body (with clearance)
|
||||
insert_height = 15.8, // Height of main insert body (with clearance)
|
||||
tab_positions = [0.25, 0.75], // Relative positions of tabs (0-1)
|
||||
corner_radius = 0.5 // Corner radius for smoother printing
|
||||
) {
|
||||
|
||||
// Calculate dimensions
|
||||
effective_insert_width = insert_width;
|
||||
effective_insert_height = insert_height;
|
||||
|
||||
// Main insert body
|
||||
difference() {
|
||||
// Create main rectangular body with rounded corners
|
||||
offset(r = corner_radius)
|
||||
offset(r = -corner_radius)
|
||||
square([effective_insert_width, effective_insert_height], center = true);
|
||||
|
||||
// Optional cutouts can be added here for weight reduction or specific features
|
||||
}
|
||||
|
||||
// Add tabs for T-slot engagement if requested
|
||||
if (with_tabs) {
|
||||
// Top tabs
|
||||
for (pos = tab_positions) {
|
||||
translate([
|
||||
(pos - 0.5) * effective_insert_width,
|
||||
effective_insert_height/2 + tab_thickness/2
|
||||
])
|
||||
square([tab_width, tab_thickness], center = true);
|
||||
}
|
||||
|
||||
// Bottom tabs
|
||||
for (pos = tab_positions) {
|
||||
translate([
|
||||
(pos - 0.5) * effective_insert_width,
|
||||
-(effective_insert_height/2 + tab_thickness/2)
|
||||
])
|
||||
square([tab_width, tab_thickness], center = true);
|
||||
}
|
||||
|
||||
// Left tabs
|
||||
for (pos = tab_positions) {
|
||||
translate([
|
||||
-(effective_insert_width/2 + tab_thickness/2),
|
||||
(pos - 0.5) * effective_insert_height
|
||||
])
|
||||
square([tab_thickness, tab_width], center = true);
|
||||
}
|
||||
|
||||
// Right tabs
|
||||
for (pos = tab_positions) {
|
||||
translate([
|
||||
effective_insert_width/2 + tab_thickness/2,
|
||||
(pos - 0.5) * effective_insert_height
|
||||
])
|
||||
square([tab_thickness, tab_width], center = true);
|
||||
}
|
||||
}
|
||||
|
||||
// Display insert specifications
|
||||
echo("=== 2020 Extrusion Insert Specifications ===");
|
||||
echo(str("Insert dimensions: ", effective_insert_width, "mm x ", effective_insert_height, "mm"));
|
||||
echo(str("Tab width: ", tab_width, "mm"));
|
||||
echo(str("Tab thickness: ", tab_thickness, "mm"));
|
||||
echo(str("Tabs enabled: ", with_tabs));
|
||||
echo(str("Tab positions: ", tab_positions));
|
||||
echo("=== End Insert Specifications ===");
|
||||
}
|
||||
|
||||
// === Function to create 3D insert from 2D profile ===
|
||||
module extrusion_2020_insert_3d(
|
||||
length = 50, // Length to extrude the insert
|
||||
with_tabs = true,
|
||||
tab_width = 4,
|
||||
tab_thickness = 1.6,
|
||||
insert_width = 15.8,
|
||||
insert_height = 15.8,
|
||||
tab_positions = [0.25, 0.75],
|
||||
corner_radius = 0.5
|
||||
) {
|
||||
linear_extrude(height = length)
|
||||
extrusion_2020_insert_2d(
|
||||
with_tabs = with_tabs,
|
||||
tab_width = tab_width,
|
||||
tab_thickness = tab_thickness,
|
||||
insert_width = insert_width,
|
||||
insert_height = insert_height,
|
||||
tab_positions = tab_positions,
|
||||
corner_radius = corner_radius
|
||||
);
|
||||
}
|
||||
|
||||
// === 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
|
||||
pcie_riser_holder(
|
||||
thickness = thickness,
|
||||
hole_diameter = hole_diameter,
|
||||
margin_x = margin_x,
|
||||
holder_width = holder_width,
|
||||
first_spacing = first_hole_spacing,
|
||||
second_spacing = second_hole_spacing,
|
||||
third_spacing = third_hole_spacing,
|
||||
show_preview_holes = false // Set to true to see hole positions in preview
|
||||
);
|
||||
|
||||
// Uncomment below to generate a 2020 extrusion insert instead
|
||||
// Example 1: 2D profile for manual extrusion
|
||||
//extrusion_2020_insert_2d();
|
||||
|
||||
// Example 2: 3D insert with 50mm length
|
||||
//extrusion_2020_insert_3d(length = 50);
|
||||
|
||||
// Example 3: Insert without tabs (for loose fit)
|
||||
//extrusion_2020_insert_3d(length = 30, with_tabs = false);
|
||||
|
||||
// Example 4: Custom tab configuration
|
||||
//extrusion_2020_insert_3d(
|
||||
// length = 40,
|
||||
// tab_width = 6,
|
||||
// tab_positions = [0.2, 0.8],
|
||||
// insert_width = 15.5,
|
||||
// insert_height = 15.5
|
||||
//);
|
||||
Reference in New Issue
Block a user