// Parametric Snap-in Cable Clip // Designed for clean 3D printing and easy cable insertion include /* [Cable Parameters] */ // Nominal cable diameter (mm) cable_diameter = 6.0; // [2.0:0.5:20.0] // Snap opening width at top (mm) snap_opening = 5.5; // [1.5:0.5:18.0] // Clip wall thickness (mm) wall_thickness = 1.6; // [1.0:0.2:4.0] /* [Base Parameters] */ // Base length along X (mm) base_length = 20.0; // [10.0:1.0:50.0] // Base width / clip depth along Y (mm) base_width = 12.0; // [6.0:1.0:30.0] // Base plate thickness (mm) base_thickness = 2.0; // [1.0:0.5:5.0] // Base corner rounding radius (mm) base_corner_radius = 2.5; // [0.5:0.5:6.0] /* [Lead-in & Reinforcement] */ // Flare angle of entry tabs (degrees) flare_angle = 35; // [15:5:60] // Length of lead-in entry tabs (mm) flare_length = 1.5; // [0.5:0.5:4.0] // Transition fillet radius at base (mm) fillet_radius = 2.0; // [0.5:0.5:5.0] /* [Appearance] */ clip_color = "#1E88E5"; // Color picker $fn = 64; module cable_clip() { r_in = cable_diameter / 2; r_out = r_in + wall_thickness; // Safety check: ensure opening does not exceed diameter actual_opening = min(snap_opening, cable_diameter * 0.98); // Calculate angle corresponding to half opening // sin(half_angle) = (opening / 2) / r_in sin_val = min(0.98, (actual_opening / 2) / r_in); half_angle_rad = asin(sin_val); half_angle_deg = half_angle_rad; // in degrees in OpenSCAD // Cable center height above base cable_center_z = base_thickness + r_in + 0.4; color(clip_color) { // 1. Base Plate with rounded corners cuboid([base_length, base_width, base_thickness], rounding=base_corner_radius, edges="Z", anchor=BOTTOM) { // Attach C-clip on top of base position(TOP) { // 2. C-shaped arm and base transition rotate([90, 0, 0]) linear_extrude(height=base_width, center=true, convexity=4) { clip_2d_profile(r_in, r_out, half_angle_deg, cable_center_z - base_thickness); } } } } } module clip_2d_profile(r_in, r_out, half_angle, center_h) { // Center of the cable circle cx = 0; cy = center_h; // Tip coordinates at inner and outer arc // Angle measured from top (+Y axis): +/- half_angle tip_angle = half_angle; // Generate 2D C-shape with flared entry tabs and base fillets difference() { union() { // Main outer circular body translate([cx, cy]) circle(r=r_out); // Base support gussets / fillet blending to flat base polygon(points=[ [-r_out, 0], [r_out, 0], [r_out + fillet_radius, 0], [r_out, cy], [-r_out, cy], [-r_out - fillet_radius, 0] ]); // Curved side fillets blending clip to base translate([r_out + fillet_radius, 0]) difference() { square([fillet_radius * 1.5, fillet_radius * 1.5], center=false); translate([0, fillet_radius]) circle(r=fillet_radius); } translate([-r_out - fillet_radius - fillet_radius * 1.5, 0]) difference() { translate([fillet_radius * 1.5, 0]) square([fillet_radius * 1.5, fillet_radius * 1.5], center=false); translate([fillet_radius * 1.5, fillet_radius]) circle(r=fillet_radius); } // Lead-in entry tabs (flared lips for easy snap insertion) for (side = [-1, 1]) { // Tip start point on the outer wall x_tip = side * (r_out - 0.2) * sin(tip_angle); y_tip = cy + (r_out - 0.2) * cos(tip_angle); translate([x_tip, y_tip]) rotate([0, 0, -side * (tip_angle + flare_angle)]) hull() { circle(r=wall_thickness / 2); translate([0, flare_length]) circle(r=wall_thickness / 2.5); } } } // Inner cable cutout translate([cx, cy]) circle(r=r_in); // Top snap opening sector cutout polygon(points=[ [cx, cy], [cx + 3 * r_out * sin(tip_angle), cy + 3 * r_out * cos(tip_angle)], [cx + 3 * r_out * sin(tip_angle), cy + 4 * r_out], [cx - 3 * r_out * sin(tip_angle), cy + 4 * r_out], [cx - 3 * r_out * sin(tip_angle), cy + 3 * r_out * cos(tip_angle)] ]); } // Rounded tip ends for soft, smooth snap for (side = [-1, 1]) { x_inner = side * r_in * sin(tip_angle); y_inner = cy + r_in * cos(tip_angle); x_outer = side * r_out * sin(tip_angle); y_outer = cy + r_out * cos(tip_angle); // Soft bead at the inner edge hull() { translate([(x_inner + x_outer)/2, (y_inner + y_outer)/2]) circle(r=wall_thickness / 2); } } } // Render the assembly cable_clip();