Skip to content

Instantly share code, notes, and snippets.

@josser
Created March 13, 2025 13:56
Show Gist options
  • Save josser/9cb124025716c5228ea84ad79f7b63ef to your computer and use it in GitHub Desktop.
Save josser/9cb124025716c5228ea84ad79f7b63ef to your computer and use it in GitHub Desktop.
// Customization Parameters
OD = 20; // Pipe Outer Diameter
ID = 16; // Pipe Inner Diameter
slot_width = 2; // Slot Width
slot_depth = 3; // Slot Depth
hub_thickness = 10; // Connector Hub Thickness (radius of intersection)
pipe_length = 30; // Length of each pipe section
num_slots = 4; // Number of slots per pipe
// Module for a single pipe section with slots
module pipe_section(length) {
difference() {
cylinder(h = length, r = OD / 2, center = true);
// Subtract inner cylinder to make it hollow
translate([0, 0, -1])
cylinder(h = length + 2, r = ID / 2, center = true);
// Create slots
for (i = [0:num_slots - 1]) {
rotate([0, 0, i * 360 / num_slots])
translate([OD / 2 + 0.01, -slot_width / 2, 0]) // Translate slightly outside the cylinder
cube([slot_depth, slot_width, length + 2], center = false);
}
}
}
// Main 4-way connector module
module four_way_connector() {
union() {
// +X axis
difference() {
translate([pipe_length / 2, 0, 0])
rotate([0, 90, 0])
pipe_section(pipe_length);
// Subtract +Y
translate([0, pipe_length / 2, 0])
rotate([90, 0, 0])
cylinder(h = pipe_length, r = OD / 2, center = true);
// Subtract -Z
translate([0, 0, -pipe_length / 2])
cylinder(h = pipe_length, r = OD / 2, center = true);
}
// -X axis
difference() {
translate([-pipe_length / 2, 0, 0])
rotate([0, 90, 0])
pipe_section(pipe_length);
// Subtract +Y
translate([0, pipe_length / 2, 0])
rotate([90, 0, 0])
cylinder(h = pipe_length, r = OD / 2, center = true);
// Subtract -Z
translate([0, 0, -pipe_length / 2])
cylinder(h = pipe_length, r = OD / 2, center = true);
}
// +Y axis
difference() {
translate([0, pipe_length / 2, 0])
rotate([90, 0, 0])
pipe_section(pipe_length);
// Subtract +X
translate([pipe_length / 2, 0, 0])
rotate([0, 90, 0])
cylinder(h = pipe_length, r = OD / 2, center = true);
// Subtract -X
translate([-pipe_length / 2, 0, 0])
rotate([0, 90, 0])
cylinder(h = pipe_length, r = OD / 2, center = true);
}
// -Z axis
difference() {
translate([0, 0, -pipe_length / 2])
pipe_section(pipe_length);
// Subtract +X
translate([pipe_length / 2, 0, 0])
rotate([0, 90, 0])
cylinder(h = pipe_length, r = OD / 2, center = true);
// Subtract -X
translate([-pipe_length / 2, 0, 0])
rotate([0, 90, 0])
cylinder(h = pipe_length, r = OD / 2, center = true);
}
}
}
// Render the model
four_way_connector();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment