33 lines
1.0 KiB
OpenSCAD
33 lines
1.0 KiB
OpenSCAD
// 2020 Extrusion Insert
|
|
// Configurable 3D printable insert for 2020 aluminum extrusion
|
|
|
|
// Import PCIe holder functionality
|
|
include <holder.scad>;
|
|
|
|
// Trapezium module - creates a centralized trapezoid shape
|
|
// Parameters:
|
|
// base_width: width of the bottom edge
|
|
// top_width: width of the top edge
|
|
// height: height of the trapezium
|
|
// depth: depth/thickness of the shape (default 1)
|
|
module trapezium(base_width, top_width, height, depth = 1) {
|
|
// Calculate the difference in width
|
|
width_diff = base_width - top_width;
|
|
|
|
// Create the trapezoid points (centered)
|
|
points = [
|
|
[-base_width/2, -height/2], // bottom left
|
|
[base_width/2, -height/2], // bottom right
|
|
[top_width/2, height/2], // top right
|
|
[-top_width/2, height/2] // top left
|
|
];
|
|
|
|
// Extrude the 2D trapezoid to create 3D shape
|
|
linear_extrude(height = depth, center = true) {
|
|
polygon(points);
|
|
}
|
|
}
|
|
|
|
// Example usage (uncomment to test):
|
|
trapezium(base_width = 20, top_width = 10, height = 15, depth = 3);
|