a
This commit is contained in:
@@ -4,140 +4,29 @@
|
|||||||
// Import PCIe holder functionality
|
// Import PCIe holder functionality
|
||||||
include <holder.scad>;
|
include <holder.scad>;
|
||||||
|
|
||||||
// === 2020 Extrusion Insert Parameters ===
|
// Trapezium module - creates a centralized trapezoid shape
|
||||||
extrusion_2020_outer = 20; // 2020 extrusion outer dimension
|
// Parameters:
|
||||||
extrusion_2020_inner = 16.2; // Internal cavity dimension
|
// base_width: width of the bottom edge
|
||||||
extrusion_2020_slot_width = 6; // T-slot opening width
|
// top_width: width of the top edge
|
||||||
extrusion_2020_slot_depth = 1.8; // T-slot depth from outer edge
|
// height: height of the trapezium
|
||||||
tab_clearance = 0.2; // Clearance for tabs to fit in T-slots
|
// depth: depth/thickness of the shape (default 1)
|
||||||
insert_clearance = 0.1; // General clearance for the insert body
|
module trapezium(base_width, top_width, height, depth = 1) {
|
||||||
|
// Calculate the difference in width
|
||||||
|
width_diff = base_width - top_width;
|
||||||
|
|
||||||
// === 2020 Extrusion Insert Module ===
|
// Create the trapezoid points (centered)
|
||||||
module extrusion_2020_insert_2d(
|
points = [
|
||||||
with_tabs = true, // Include tabs for T-slot engagement
|
[-base_width/2, -height/2], // bottom left
|
||||||
tab_width = 4, // Width of each tab
|
[base_width/2, -height/2], // bottom right
|
||||||
tab_thickness = 1.6, // Thickness of tabs (fits in T-slot depth)
|
[top_width/2, height/2], // top right
|
||||||
insert_width = 15.8, // Width of main insert body (with clearance)
|
[-top_width/2, height/2] // top left
|
||||||
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
|
// Extrude the 2D trapezoid to create 3D shape
|
||||||
effective_insert_width = insert_width;
|
linear_extrude(height = depth, center = true) {
|
||||||
effective_insert_height = insert_height;
|
polygon(points);
|
||||||
|
|
||||||
// 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
|
// Example usage (uncomment to test):
|
||||||
echo("=== 2020 Extrusion Insert Specifications ===");
|
trapezium(base_width = 20, top_width = 10, height = 15, depth = 3);
|
||||||
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
|
|
||||||
//);
|
|
||||||
|
|||||||
Reference in New Issue
Block a user