| // Torus with 72mm Inner Diameter (ID) and 6mm tube diameter, plus four 3mm holes going through torus
|
|
|
| $fn = 360; // smoothness (increase for a smoother torus)
|
|
|
| inner_diameter = 72; // Inner diameter of the hole
|
| tube_diameter = 6; // Diameter of the tube
|
| major_r = (inner_diameter + tube_diameter) / 2; // Distance from center to center of tube
|
| minor_r = tube_diameter / 2; // Radius of the tube
|
|
|
| hole_diameter = 3;
|
| hole_radius = hole_diameter / 2;
|
| hole_count = 4;
|
| hole_length = tube_diameter * 2; // Make sure hole is longer than tube thickness
|
|
|
| module torus() {
|
| rotate_extrude(angle = 360)
|
| translate([major_r, 0, 0])
|
| circle(r = minor_r, $fn = $fn);
|
| }
|
|
|
| module holes() {
|
| for (i = [0:hole_count-1]) {
|
| angle = i * 360/hole_count;
|
| // Position the hole at the correct location, pointing outward
|
| rotate([0,90,angle])
|
| translate([major_r, 0, 0])
|
| cylinder(h = hole_length, r = hole_radius, center=true, $fn=60);
|
| }
|
| }
|
|
|
| difference() {
|
| torus();
|
| holes();
|
| }
|