// ============================================
// SaltyLab — Tether Anchor Point
// 50×50×20mm PETG 100% infill
// For ceiling tether during balance testing
// Must be STRONG — 100% infill mandatory
// ============================================
include <dimensions.scad>

anchor_w = 50;
anchor_d = 50;
anchor_h = 20;
ring_dia = 30;     // Carabiner ring outer
ring_hole = 15;    // Carabiner hook clearance
ring_h = 8;

module tether_anchor() {
    difference() {
        union() {
            // Base (clamps to 2020 extrusion)
            translate([-anchor_w/2, -anchor_d/2, 0])
                cube([anchor_w, anchor_d, anchor_h - ring_h]);
            
            // Tether ring (stands up from base)
            translate([0, 0, anchor_h - ring_h])
                cylinder(d=ring_dia, h=ring_h, $fn=50);
        }
        
        // Ring hole (for carabiner)
        translate([0, 0, anchor_h - ring_h - 1])
            cylinder(d=ring_hole, h=ring_h + 2, $fn=40);
        
        // 2020 extrusion channel (through base)
        translate([-extrusion_w/2 - tol, -extrusion_w/2 - tol, -1])
            cube([extrusion_w + tol*2, extrusion_w + tol*2, anchor_h - ring_h + 2]);
        
        // Clamp bolt holes (M5, through sides)
        for (angle = [0, 90]) {
            rotate([0, 0, angle])
                translate([0, anchor_d/2 + 1, (anchor_h - ring_h)/2])
                    rotate([90, 0, 0])
                        cylinder(d=m5_clear, h=anchor_d + 2, $fn=25);
        }
    }
}

tether_anchor();
