// ERROR: The given mesh is not closed! Unable to convert to CGAL_Nef_Polyhedron. eps = 0.01; $fn = 100;cb = 15; // width of collimator border around LEDs ch = 25;; // height (thickness) of collimator g = 3; // horizontal gap inches = 25.4; module BigShape2D(di) { // crossection of collimator square([di/2, 2]); translate([di/2 - g, 2]) square([g, 6]); square([di/2- cb, ch]); polygon([ [di/2 - cb, 2], [di/2 - cb/2, 2], [di/2 - cb, ch/2] ]); } BigShape2D(150.6); module LEDPattern(n, di) { // circular array of "n" LEDs of diameter "D" an = 360/n; r = di/2 / sin(an/2); echo(n, r); for (a = [0:an:359]) rotate([0, 0, a]) translate([r, 0, 0]) { // reduce circle sizes to keep disks from touching circle(d = 0.90 * di); * rotate([0, 0, -a]) square([0.7 * di, 0.7 * di], center = true); * rotate([0, 0, -a]) square([0.8 * di, 0.6 * di], center = true); * rotate([0, 0, -a]) polygon([for (a = [0:60:359]) [0.45 * sin(a) * di, 0.5 * cos(a) * di]]); } } module LEDs2D(di) { // LED array diameter, in inches LEDPattern( 5, 17.5); LEDPattern(12, 17.5); if (di > 5 * inches) { LEDPattern(18, 17.5); } // registration holes translate([0, di/2 - cb/2, 0]) circle(2); translate([0, -di/2 + cb/2, 0]) circle(2); translate([di/2 - cb/2, 0, 0]) circle(2); } module Collimator(di) difference() { rotate_extrude(angle = 360, convexity = 10) BigShape2D(di); translate([0, 0, -eps]) linear_extrude(ch + 2*eps) LEDs2D(di); } !Collimator(115.9);