Files
pcie/pcie.scad
T
dingfeng.wong 35a971c68f a
2025-07-21 23:56:12 +08:00

144 lines
4.9 KiB
OpenSCAD

// 2020 Extrusion Insert
// Configurable 3D printable insert for 2020 aluminum extrusion
// Import PCIe holder functionality
include <holder.scad>;
// === 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
);
}
// === Usage Examples ===
// Generate the PCIe riser holder using imported functionality
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
//);