// Two-Piece Split Ring Tube Clamp with Mounting Foot // Designed for 25 mm OD Tube /* [Tube & Clamp Dimensions] */ // Outer diameter of the tube to clamp tube_od = 25.0; // [15:0.5:50] // Wall thickness of the clamp ring wall_thickness = 4.0; // [2:0.5:8] // Axial width of the clamp along the tube clamp_width = 12.0; // [8:1:30] // Clearance gap between top and bottom clamp halves clamp_gap = 1.0; // [0.5:0.1:3] /* [Flange & Clamping Hardware] */ // Distance from tube outer surface to clamping bolt center bolt_offset = 8.0; // [5:0.5:15] // Bolt through-hole diameter (M4 clearance) bolt_hole_dia = 4.5; // [3:0.1:6] // Flange thickness flange_thickness = 5.0; // [3:0.5:10] // Bolt head counterbore diameter bolt_cb_dia = 8.0; // [6:0.5:12] // Bolt head counterbore depth bolt_cb_depth = 2.5; // [0:0.5:5] // Include hex nut recess on bottom flange include_nut_pocket = true; /* [Mounting Foot Dimensions] */ // Total width of the flat mounting base foot foot_width = 72.0; // [45:1:100] // Thickness of the mounting foot plate foot_thickness = 4.0; // [3:0.5:8] // Width of the mounting slots (clearance for M4) slot_width = 4.5; // [3:0.1:6] // Length of the mounting slots slot_length = 9.0; // [5:0.5:18] // Distance from clamp center to center of each mounting slot slot_offset = 27.5; // [18:0.5:45] /* [Display Settings] */ // Layout of the two halves display_mode = "side_by_side"; // [side_by_side: Side by Side, print_flat: Flat for 3D Printing, assembled: Assembled] // Spacing between halves in side-by-side view part_spacing = 75.0; // [50:5:120] /* [Colors] */ cap_color = "DodgerBlue"; base_color = "SteelBlue"; hardware_color = "Silver"; /* [Quality] */ $fn = 72; // Derived parameters r_in = tube_od / 2; r_out = r_in + wall_thickness; bolt_x = r_in + bolt_offset; flange_edge_x = bolt_x + bolt_hole_dia / 2 + 3.25; // Main visual output if (display_mode == "side_by_side") { // Bottom base half on the left translate([-part_spacing / 2, 0, 0]) clamp_base(); // Top cap half on the right (both upright for easy feature inspection) translate([part_spacing / 2, 0, 0]) clamp_cap(); } else if (display_mode == "print_flat") { // Base sits flat on its foot translate([-part_spacing / 2, 0, r_out + foot_thickness]) clamp_base(); // Cap flipped flat on its mating split faces (no supports needed) translate([part_spacing / 2, 0, -clamp_gap / 2]) rotate([180, 0, 0]) clamp_cap(); } else { // Assembled clamp clamp_base(); clamp_cap(); // Semi-transparent reference tube %rotate([90, 0, 0]) cylinder(r=r_in, h=clamp_width * 3, center=true); } // Module for the Lower Half (Base with integrated mounting foot) module clamp_base() { color(base_color) difference() { union() { // Semicircular cradle body intersection() { rotate([90, 0, 0]) cylinder(r=r_out, h=clamp_width, center=true); translate([0, 0, -r_out]) cube([r_out * 2 + 2, clamp_width + 2, r_out * 2], center=true); } // Left and right clamping flanges base_flange(side=1); base_flange(side=-1); // Pedestal gusset transition to foot hull() { translate([0, 0, -r_out / 2]) cube([r_out * 1.5, clamp_width, r_out], center=true); translate([0, 0, -(r_out + foot_thickness / 2)]) cube([foot_width * 0.7, clamp_width, foot_thickness], center=true); } // Flat mounting foot plate translate([0, 0, -(r_out + foot_thickness / 2)]) rounded_cube([foot_width, clamp_width, foot_thickness], r=3, center=true); } // Inner bore for 25 mm tube rotate([90, 0, 0]) cylinder(r=r_in, h=clamp_width + 4, center=true); // Split plane relief gap cut translate([0, 0, -clamp_gap / 4]) cube([flange_edge_x * 2 + 10, clamp_width + 4, clamp_gap / 2], center=true); // Left bolt hole (clearance Ø4.5 mm) translate([-bolt_x, 0, 0]) cylinder(d=bolt_hole_dia, h=r_out * 2, center=true); // Right bolt hole (clearance Ø4.5 mm) translate([bolt_x, 0, 0]) cylinder(d=bolt_hole_dia, h=r_out * 2, center=true); // Optional hex nut traps on underside of clamping flanges if (include_nut_pocket) { translate([-bolt_x, 0, -(clamp_gap / 2 + flange_thickness - 1.5)]) rotate([0, 0, 30]) cylinder(d=7.8, h=10, $fn=6); translate([bolt_x, 0, -(clamp_gap / 2 + flange_thickness - 1.5)]) rotate([0, 0, 30]) cylinder(d=7.8, h=10, $fn=6); } // Left mounting foot slot translate([-slot_offset, 0, -(r_out + foot_thickness / 2)]) mounting_slot(slot_width, slot_length, foot_thickness + 2); // Right mounting foot slot translate([slot_offset, 0, -(r_out + foot_thickness / 2)]) mounting_slot(slot_width, slot_length, foot_thickness + 2); } } // Module for the Upper Half (Cap) module clamp_cap() { color(cap_color) difference() { union() { // Semicircular arch body intersection() { rotate([90, 0, 0]) cylinder(r=r_out, h=clamp_width, center=true); translate([0, 0, r_out]) cube([r_out * 2 + 2, clamp_width + 2, r_out * 2], center=true); } // Left and right clamping flanges cap_flange(side=1); cap_flange(side=-1); } // Inner bore for 25 mm tube rotate([90, 0, 0]) cylinder(r=r_in, h=clamp_width + 4, center=true); // Split plane relief gap cut translate([0, 0, clamp_gap / 4]) cube([flange_edge_x * 2 + 10, clamp_width + 4, clamp_gap / 2], center=true); // Left bolt through-hole translate([-bolt_x, 0, 0]) cylinder(d=bolt_hole_dia, h=r_out * 3, center=true); // Right bolt through-hole translate([bolt_x, 0, 0]) cylinder(d=bolt_hole_dia, h=r_out * 3, center=true); // Left counterbore for M4 socket head bolt translate([-bolt_x, 0, clamp_gap / 2 + flange_thickness - bolt_cb_depth]) cylinder(d=bolt_cb_dia, h=10); // Right counterbore for M4 socket head bolt translate([bolt_x, 0, clamp_gap / 2 + flange_thickness - bolt_cb_depth]) cylinder(d=bolt_cb_dia, h=10); } } // Helper module for lower flange geometry module base_flange(side=1) { flange_len = flange_edge_x - r_in + 2; flange_cx = side * (r_in + flange_len / 2 - 1); translate([flange_cx, 0, -(clamp_gap / 2 + flange_thickness / 2)]) rounded_cube([flange_len, clamp_width, flange_thickness], r=2.5, center=true); // Fillet reinforcement to main ring translate([side * (r_in + 2), 0, -(clamp_gap / 2 + flange_thickness)]) rotate([0, side * 35, 0]) cube([4, clamp_width, flange_thickness], center=true); } // Helper module for upper flange geometry module cap_flange(side=1) { flange_len = flange_edge_x - r_in + 2; flange_cx = side * (r_in + flange_len / 2 - 1); translate([flange_cx, 0, (clamp_gap / 2 + flange_thickness / 2)]) rounded_cube([flange_len, clamp_width, flange_thickness], r=2.5, center=true); // Fillet reinforcement to main ring translate([side * (r_in + 2), 0, (clamp_gap / 2 + flange_thickness)]) rotate([0, -side * 35, 0]) cube([4, clamp_width, flange_thickness], center=true); } // Helper for slotted hole elongated in X module mounting_slot(w, len, h) { travel = len - w; hull() { translate([-travel / 2, 0, 0]) cylinder(d=w, h=h, center=true); translate([travel / 2, 0, 0]) cylinder(d=w, h=h, center=true); } } // Rounded box centered or keyed module rounded_cube(size, r=2, center=true) { dx = size[0] - 2 * r; dy = size[1] - 2 * r; dz = size[2]; shift_x = center ? 0 : size[0] / 2; shift_y = center ? 0 : size[1] / 2; shift_z = center ? 0 : size[2] / 2; translate([shift_x, shift_y, shift_z]) hull() { for (x = [-dx/2, dx/2]) { for (y = [-dy/2, dy/2]) { translate([x, y, 0]) cylinder(r=r, h=dz, center=true); } } } }