// BOLTNUT / Bolt Nut Sept. '07 // by Tsutomu HIGO URL:http://www.asahi-net.or.jp/~nj2t-hg/ #version 3.6; global_settings { assumed_gamma 2.2 max_trace_level 4 } //BOLTNUT SIZE DATA #declare Sznut = array[2][6][8] { { { 5, 4.134, 5.4, 0.8, 8.79, 4.6, 3.5, 7.9}, { 6, 4.917, 6.4, 1.0,11.05, 5.1, 4.0, 9.9}, { 8, 6.647, 8.4,1.25,14.38, 6.6, 5.3,12.9}, {10, 8.376,10.4, 1.5,17.77, 8.2, 6.4,15.9}, {12,10.106,12.5,1.75,20.03,10.6, 7.5,17.9}, {16,13.835,16.7, 2.0,26.75,14.5,10.0,23.8} }, { { 5, 4.134, 5.4, 0.8, 8.79, 5.0, 3.5, 7.9}, { 6, 4.917, 6.4, 1.0,11.05, 5.6, 4.0, 9.9}, { 8, 6.647, 8.4,1.25,14.38, 7.3, 5.3,12.9}, {10, 8.376,10.4, 1.5,17.77, 9.1, 6.4,15.9}, {12,10.106,12.5,1.75,20.03,11.8, 7.5,17.9}, {16,13.835,16.7, 2.0,26.75,16.1,10.0,23.8} } } //Sznutstle : Sznut [A][*][*] A = 0-standard, 1-thick //Sznutsize : Sznut [*][B][*] B = 0-M5, 1-M6, 2-M8, 3-M10, 4-M12, 5-M16 //NUT #macro Nut (Sznutstle, Sznutsize, Nr0, C) #declare NatD = Sznut[Sznutstle][Sznutsize][4]; #declare NatW = Sznut[Sznutstle][Sznutsize][7]; #declare NatH = Sznut[Sznutstle][Sznutsize][5]; #declare NatId = Sznut[Sznutstle][Sznutsize][2]; #declare BoltH = Sznut[Sznutstle][Sznutsize][6]; #declare BoltD = 0.98*Sznut[Sznutstle][Sznutsize][0]; #declare Pich = Sznut[Sznutstle][Sznutsize][3]; intersection { cylinder {-1*y, 1.2*NatH*y, BoltD/2/0.98-Pich*1.732/1.828/8*4.5 inverse} #if (C = 1) box {<0, -1, -2*NatD/2> <2*NatW/2, 2*NatH, 0> rotate y*30 inverse} #end box {<-NatW/2, 0, -NatD/2> } box {<-NatW/2, -0.1, -NatD/2> rotate y* 60} box {<-NatW/2, -0.1, -NatD/2> rotate y*120} cone {1.00001*NatH*y, 0.99999*NatW/2, -0.00001*y, 0.99999*NatW/2+1.75*NatH} cone {1.00001*NatH*y, 0.99999*NatW/2+1.75*NatH, -0.00001*y, 0.99999*NatW/2} cone {1.00001*NatH*y, 0.99999*NatId/2, (1.00001*NatH-NatH/1.5)*y, 0 inverse} cone {-0.00001*y, 0.99999*NatId/2, (NatH/1.5)*y, 0 inverse} intersection { cylinder {-1*y, 1.2*NatH*y, BoltD/2/0.98} object { union { #declare N = int(1.2*NatH/Pich)+1; #while (N > -1) #declare Nr = Nr0; #while (Nr > 0) box { <-Pich/2, -Pich/2, -Pich/2> < Pich/2, Pich/2, Pich/2> rotate z*45 rotate x*-atan(Pich/(3.14*BoltD))*180/3.14*1.5 scale <1.732/1.828, 1/1.414, 1> translate x*(BoltD/2+Pich*1.732/1.828/8) translate y*(Pich*N-Pich/Nr0*Nr) rotate y*Nr/Nr0*360 } #declare Nr = Nr-1; #end #declare N = N-1; #end } inverse } inverse } } #end //BOLT #macro Bolt (Sznutstle, Sznutsize, Bl, Nbl, Bls, Nbls, Nr0) #declare NatD = Sznut[Sznutstle][Sznutsize][4]; #declare NatW = Sznut[Sznutstle][Sznutsize][7]; #declare NatH = Sznut[Sznutstle][Sznutsize][5]; #declare NatId = Sznut[Sznutstle][Sznutsize][2]; #declare BoltH = Sznut[Sznutstle][Sznutsize][6]; #declare BoltD = 0.98*Sznut[Sznutstle][Sznutsize][0]; #declare Pich = Sznut[Sznutstle][Sznutsize][3]; #declare BoltL = Bl-Nbl*Pich; #declare BoltLs = Bls-(Nbls+1)*Pich; merge { intersection { box {<-NatW/2, 0, -NatD/2> } box {<-NatW/2, -0.1, -NatD/2> rotate y* 60} box {<-NatW/2, -0.1, -NatD/2> rotate y*120} box {<-NatW/2, -0.1, -NatD/2> rotate y*120} cone {1.00001*BoltH*y, 0.99999*NatW/2, -0.00001*y, 0.99999*NatW/2+1.75*BoltH} } cylinder {0.001*y, -BoltLs*y, BoltD/2} intersection { //box {<-2*NatW/2, 1.1*BoltH, -2*NatD/2> <2*NatW/2, -1.1*BoltL, 0> rotate y*30 inverse} //cutting cone { -(BoltL+BoltD/2-Pich*0.7)*y, 0, 0*y, BoltL+BoltD/2-Pich*0.7 } cylinder {-BoltLs*y, -BoltL*y, BoltD/2} object { union { #declare N = int((BoltL-BoltLs)/Pich)+1; #while (N > -1) #declare Nr = Nr0; #while (Nr > 0) #if(N > 2) #declare Dd = 0; #else #declare Dd = Pich*1.732/1.828*7/8*(3*Nr0-N*Nr0-Nr)/2/Nr0; #end box {<-Pich/2, -Pich/2, -Pich/2> < Pich/2, Pich/2, Pich/2> rotate z*45 rotate x*-atan(Pich/(3.14*BoltD))*180/3.14*1.5 scale <1.732/1.828, 1/1.414, 1> translate x*(BoltD/2+Pich*1.732/1.828/8+Dd) translate y*-(BoltLs+Pich*N+Pich/Nr0*Nr) rotate y*Nr/Nr0*360 } #declare Nr = Nr-1; #end #declare N = N-1; #end } inverse } } } #end //MAIN camera { location <0, 30, -160> angle 24 look_at <0, -12, 0> } light_source {<-150, 350, -200> color red 0.5 green 0.5 blue 0.5} #declare Texss = texture { pigment {color rgb <0.8, 0.8, 0.8>} finish { ambient .2 diffuse .5 reflection 0.3 specular 0.4 roughness 0.1 irid { 0.55 thickness 0.5 turbulence 0.1 } } } #declare Texsb = texture { pigment {color rgb <1, 0.8, 0.8>} finish { ambient .2 diffuse .5 reflection 0.3 specular 0.4 roughness 0.1 irid { 0.55 thickness 0.5 turbulence 0.1 } } } #declare Texsc = texture { pigment {color rgb <0.8, 0.8, 1>} finish { ambient .2 diffuse .5 reflection 0.3 specular 0.4 roughness 0.1 irid { 0.55 thickness 0.5 turbulence 0.1 } } } union { object {Bolt (0, 4, 40, 6, 10, 3, 24) rotate y*135 translate <0, 0, 30>} object {Nut (0, 4, 24, 1) rotate y*45 translate <0, -45+Pich*6.25, 30>} object {Nut (0, 4, 24, 0) rotate y*15 translate <0, -47, 30>} texture {Texss} no_shadow } union { object {Bolt (0, 4, 40, 6, 10, 3, 24) rotate y*-12 translate <0, 0, 30>} object {Nut (0, 4, 24, 0) rotate y*-12 translate <0, -45+Pich*11, 30>} object {Nut (0, 4, 24, 0) rotate y*200 translate <0, -47, 30>} translate x*27 texture {Texsc} no_shadow } union { object {Bolt (0, 4, 40, 6, 10, 3, 24) rotate y*170 translate <0,0,30>} object {Nut (0, 4, 24, 0) rotate y*170 translate <0, -45+Pich*14, 30>} object {Nut (0, 4, 24, 0) rotate y*115 translate <0, -47, 30>} translate x*-27 texture {Texsb} no_shadow }