add sma_open
This commit is contained in:
		
							parent
							
								
									a83fcd74c8
								
							
						
					
					
						commit
						80ea4acde5
					
				
							
								
								
									
										265
									
								
								cad/sma_open.scad
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										265
									
								
								cad/sma_open.scad
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,265 @@ | |||||||
|  | include <threads.scad>; | ||||||
|  | //$fn=128; | ||||||
|  | 
 | ||||||
|  | /*[ Array parameters ]*/ | ||||||
|  | // Last parameter is for support attach. | ||||||
|  | 
 | ||||||
|  | // sphere radius (mm): | ||||||
|  | r = [150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 270]; | ||||||
|  | 
 | ||||||
|  | // microphones zenith coordinates (°): | ||||||
|  | theta = [0., 90., 90., 90., 90., 180., 54.7356, 54.7356, 54.7356, 54.7356, 125.264, 125.264, 125.264, 125.264, 45., 45., 45., 45., 90., 90., 90., 90., 135., 135., 135., 135., 180]; | ||||||
|  | 
 | ||||||
|  | // microphone azimuth coordinates (°): | ||||||
|  | phi = [0., 0., 90., 180., 270., 0., 45., 135., 225., 315., 45., 135., 225., 315., 0., 90., 180., 270., 45., 135., 225., 315., 0., 90., 180., 270., 0]; | ||||||
|  | 
 | ||||||
|  | // connection matrix | ||||||
|  | neighbors =  | ||||||
|  | [ | ||||||
|  | [14, 15, 16, 17], //0 | ||||||
|  | [14, 21, 22, 18], //1 | ||||||
|  | [15, 18, 23, 19], //2 | ||||||
|  | [16, 19, 24, 20], //3 | ||||||
|  | [17, 21, 25, 20], //4 | ||||||
|  | [22, 23, 24, 25], //5 | ||||||
|  | [14, 15, 18], //6 | ||||||
|  | [15, 16, 19], //7 | ||||||
|  | [16, 17, 20], //8 | ||||||
|  | [17, 14, 21], //9 | ||||||
|  | [22, 23, 18, 26], //10 | ||||||
|  | [23, 24, 19, 26], //11 | ||||||
|  | [24, 25, 20, 26], //12 | ||||||
|  | [21, 22, 25, 26], //13 | ||||||
|  | [0, 1, 6, 9], //14 | ||||||
|  | [0, 2, 6, 7], //15 | ||||||
|  | [0, 3, 7, 8], //16 | ||||||
|  | [0, 4, 8, 9], //17 | ||||||
|  | [1, 2, 6, 10], //18 | ||||||
|  | [2, 3, 7, 11], //19 | ||||||
|  | [3, 4, 8, 12], //20 | ||||||
|  | [4, 1, 9, 13], //21 | ||||||
|  | [1, 5, 10, 13], //22 | ||||||
|  | [2, 5, 10, 11], //23 | ||||||
|  | [3, 5, 11, 12], //24 | ||||||
|  | [4, 5, 12, 13], //25 | ||||||
|  | [10, 11, 12, 13], // support | ||||||
|  | ]; | ||||||
|  | 
 | ||||||
|  | module attach(id_mic, rmic=3.82, rstud=1.75, color="yellow"){ | ||||||
|  |     rtp = [r[id_mic], theta[id_mic], phi[id_mic]]; | ||||||
|  |     center = sph2cart(rtp); | ||||||
|  | 
 | ||||||
|  |     difference(){ | ||||||
|  |     union(){ | ||||||
|  |         for (i=[0:len(neighbors[id_mic])-1]){ | ||||||
|  |            neighbor =  | ||||||
|  |             sph2cart( | ||||||
|  |             [ | ||||||
|  |             r[neighbors[id_mic][i]],  | ||||||
|  |             theta[neighbors[id_mic][i]],  | ||||||
|  |             phi[neighbors[id_mic][i]] | ||||||
|  |             ] | ||||||
|  |             ); | ||||||
|  |            rtp2=cart2sph(neighbor-center); | ||||||
|  |            translate(center) | ||||||
|  |            rotate([0, rtp2[1], rtp2[2]]){ | ||||||
|  |            difference(){ | ||||||
|  |                cylinder(r=rstud+2,h=22); | ||||||
|  |                translate([0,0,16]) | ||||||
|  |                cylinder(r=rstud,h=25); | ||||||
|  |            } | ||||||
|  |        } | ||||||
|  |     } | ||||||
|  |     translate(center) | ||||||
|  |     rotate([0, rtp[1], rtp[2]]){ | ||||||
|  |     cylinder(r=rmic+2,h=20,center=true); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |     translate(center) | ||||||
|  |     { | ||||||
|  |     rotate([0, rtp[1], rtp[2]]){ | ||||||
|  |     cylinder(r=rmic,h=40, center=true);  | ||||||
|  |     translate([rmic,0,5]) | ||||||
|  |     rotate([90,0,90]) | ||||||
|  |     linear_extrude(3) | ||||||
|  |     text(str(id_mic+1), size=4, valign="center", halign="center");}} | ||||||
|  | } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | support(); | ||||||
|  | 
 | ||||||
|  | // treaded attach | ||||||
|  | module support(stud=1.75){ | ||||||
|  |         id_mic = len(r)-1; | ||||||
|  |         rtp = [r[id_mic], theta[id_mic], phi[id_mic]]; | ||||||
|  |         center = sph2cart(rtp); | ||||||
|  |         difference(){ | ||||||
|  |         color("red") | ||||||
|  |         hull(){ | ||||||
|  |         for(i=[0:len(neighbors[id_mic])-1]){ | ||||||
|  |         neighbor =  | ||||||
|  |             sph2cart( | ||||||
|  |             [ | ||||||
|  |             r[neighbors[id_mic][i]],  | ||||||
|  |             theta[neighbors[id_mic][i]],  | ||||||
|  |             phi[neighbors[id_mic][i]] | ||||||
|  |             ] | ||||||
|  |             ); | ||||||
|  |         rtp2=cart2sph(neighbor-center);     | ||||||
|  |         translate(center) | ||||||
|  |         rotate([0, rtp2[1], rtp2[2]]){ | ||||||
|  |         cylinder(r=stud+2,h=22); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |     translate(center) | ||||||
|  |     rotate([0, rtp[1], rtp[2]]) | ||||||
|  |     translate([0, 0, -10]) | ||||||
|  |     cylinder(r=6,h=20, center=false); | ||||||
|  | } | ||||||
|  |  for(i=[0:len(neighbors[id_mic])-1]){ | ||||||
|  |         neighbor =  | ||||||
|  |             sph2cart( | ||||||
|  |             [ | ||||||
|  |             r[neighbors[id_mic][i]],  | ||||||
|  |             theta[neighbors[id_mic][i]],  | ||||||
|  |             phi[neighbors[id_mic][i]] | ||||||
|  |             ] | ||||||
|  |             ); | ||||||
|  |         rtp2=cart2sph(neighbor-center);     | ||||||
|  |         translate(center) | ||||||
|  |         rotate([0, rtp2[1], rtp2[2]]){ | ||||||
|  |         translate([0,0,16]) | ||||||
|  |         cylinder(r=stud,h=25); | ||||||
|  |         }; | ||||||
|  |     }; | ||||||
|  |     translate(center) | ||||||
|  |     rotate([0, rtp[1], rtp[2]]) | ||||||
|  |     translate([0,0,-30]) | ||||||
|  |     render() | ||||||
|  |     english_thread(3/8,16,2,internal=true); | ||||||
|  | } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | for (i = [0:len(theta)-2]){ | ||||||
|  |     attach(i); | ||||||
|  |     studs(i); | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | module studs(id_mic, rstud=1.75){ | ||||||
|  |     rtp = [r[id_mic], theta[id_mic], phi[id_mic]]; | ||||||
|  |     center = sph2cart(rtp); | ||||||
|  |     for (i=[0:len(neighbors[id_mic])-1]){ | ||||||
|  |         neighbor = sph2cart([r[neighbors[id_mic][i]], theta[neighbors[id_mic][i]], phi[neighbors[id_mic][i]]]); | ||||||
|  |            rtp2=cart2sph(neighbor-center); | ||||||
|  |            translate(center) | ||||||
|  |            rotate([0, rtp2[1], rtp2[2]]) | ||||||
|  |             color("blue") | ||||||
|  |            translate([0,0,16]) | ||||||
|  |            cylinder(r=rstud,h=norm(neighbor-center)-2*16); | ||||||
|  |            } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | function cart2sph(vec) | ||||||
|  |     = [norm(vec), acos(vec[2]/norm(vec)), atan2(vec[1],vec[0])]; | ||||||
|  | 
 | ||||||
|  | function sph2cart(vec) | ||||||
|  |     = [vec[0]*sin(vec[1])*cos(vec[2]), vec[0]*sin(vec[1])*sin(vec[2]), vec[0]*cos(vec[1])]; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | // Support for mic stand | ||||||
|  | 
 | ||||||
|  | // Mic pointing at center | ||||||
|  | //center = supp; | ||||||
|  | //rtp = cart2sph(center); | ||||||
|  | //echo(rtp); | ||||||
|  | //rotate([0, -rtp[1], 0]) | ||||||
|  | //rotate([0, 0,-rtp[2]]) | ||||||
|  | //attach( | ||||||
|  | //center=supp,neighbourgs=[ | ||||||
|  | //[x[0],y[0],z[0]], | ||||||
|  | //[x[1],y[1],z[1]], | ||||||
|  | //[x[2],y[2],z[2]] | ||||||
|  | //]); | ||||||
|  | 
 | ||||||
|  | // Support attach | ||||||
|  | 
 | ||||||
|  | //attach3(center = support, neighbourgs=[ | ||||||
|  | //[x[1], y[1], z[1]], | ||||||
|  | //[x[2], y[2], z[2]], | ||||||
|  | //[x[3], y[3], z[3]] | ||||||
|  | //]); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | // Mic #0 | ||||||
|  | //attach( | ||||||
|  | //center=[x[0], y[0], z[0]],neighbourgs=[ | ||||||
|  | //supp, | ||||||
|  | //[x[1],y[1],z[1]], | ||||||
|  | //[x[2],y[2],z[2]], | ||||||
|  | //[x[3],y[3],z[3]] | ||||||
|  | //]); | ||||||
|  | 
 | ||||||
|  | // Mic #1 | ||||||
|  | //center = [x[1],y[1],z[1]]; | ||||||
|  | //rtp = cart2sph(center); | ||||||
|  | //echo(rtp); | ||||||
|  | //rotate([0, -rtp[1], 0]) | ||||||
|  | //rotate([0, 0,-rtp[2]]) | ||||||
|  | //attach( | ||||||
|  | //center=[x[1], y[1], z[1]],neighbourgs=[ | ||||||
|  | //supp, | ||||||
|  | //support, | ||||||
|  | //[x[0],y[0],z[0]], | ||||||
|  | //[x[2],y[2],z[2]], | ||||||
|  | //[x[3],y[3],z[3]], | ||||||
|  | //]); | ||||||
|  | 
 | ||||||
|  | module dist(i,j){ | ||||||
|  | echo( | ||||||
|  | sqrt( | ||||||
|  | pow((x[i]-x[j]),2) +  | ||||||
|  | pow((y[i]-y[j]),2) + | ||||||
|  | pow((z[i]-z[j]),2) | ||||||
|  | ) | ||||||
|  | - 2 * 16 | ||||||
|  | ); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | // Mic #2 | ||||||
|  | //center = [x[2],y[2],z[2]]; | ||||||
|  | //rtp = cart2sph(center); | ||||||
|  | //echo(rtp); | ||||||
|  | //rotate([0, -rtp[1], 0]) | ||||||
|  | //rotate([0, 0,-rtp[2]]) | ||||||
|  | //attach( | ||||||
|  | //center=[x[2], y[2], z[2]],neighbourgs=[ | ||||||
|  | //support, | ||||||
|  | //supp, | ||||||
|  | //[x[0],y[0],z[0]], | ||||||
|  | //[x[1],y[1],z[1]], | ||||||
|  | //[x[3],y[3],z[3]], | ||||||
|  | //]); | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | // Mic #3 | ||||||
|  | //center = [x[3],y[3],z[3]]; | ||||||
|  | //rtp = cart2sph(center); | ||||||
|  | //echo(rtp); | ||||||
|  | //rotate([0, -rtp[1], 0]) | ||||||
|  | //rotate([0, 0,-rtp[2]]) | ||||||
|  | //attach( | ||||||
|  | //center=[x[3], y[3], z[3]],neighbourgs=[ | ||||||
|  | //support, | ||||||
|  | //[x[0],y[0],z[0]], | ||||||
|  | //[x[1],y[1],z[1]], | ||||||
|  | //[x[2],y[2],z[2]], | ||||||
|  | //]); | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user