/********************************************************************** * Bolt Macro for Povray 3.1e by M.Schimmler 2.5.1999 * * schimmler@ica.uni-stuttgart.de * **********************************************************************/ #macro Bolt(TS,BL,TL) #local WS = 1.5*TS; #local NH = TS/2; #local SH = NH/4; #local Pitch = TS/8; #local TLen = 0.8 * Pitch; #local TOff = TS/2 - 0.86603*Pitch/4 - 0.54127*Pitch; #local PAng = degrees( atan2( Pitch/(pi * TS),1)); #local SLen = (WS)/sin(pi/3); //length of a nutside #local CAng = pi/6; //angle of intersection cone #local CHt = 0.1 + NH + tan(CAng)*WS/2.0;//heigth of intsec. cone #local TObj = (ceil(TL/Pitch) + 2)*72;//num. of Thread obj. #local TBegin = BL + Pitch; #local Thread = object{ prism{ linear_sweep linear_spline -(TLen/2), (TLen/2), 4, <-Pitch/2,0>, <0,Pitch>, , <-Pitch/2,0> } translate <0,0,TOff> rotate <0,0,90 - PAng> } object{ union{ intersection{ prism{ linear_sweep linear_spline 0, NH, 7, , , <-SLen/4.0, WS/2.0>, <-SLen/2.0, 0>, <-SLen/4.0, -WS/2.0>, , } cone {<0, NH + (tan(CAng)*WS/2.0), 0>, 0.0 <0, -0.1, 0>, CHt/tan(CAng)} } cylinder {<0,0.1*NH,0>, <0,-(BL-TL-Pitch),0>, TS/2} cylinder {<0,0,0>,<0,-SH,0>,WS/2} difference { cylinder {<0,-SH,0>,<0,-SH-Pitch,0>,TS/2+Pitch} torus {TS/2 + Pitch,Pitch translate <0,-SH-Pitch,0>} } cone {<0,-(BL-TL-Pitch),0>,TS/2, <0,-(BL-TL),0>,(TS-1.22687*Pitch)/2} intersection{ cylinder {<0,-(BL-TL),0>, <0,-BL-1.0001*Pitch,0>,(TS-1.22687*Pitch)/2} cone {<0,-BL - Pitch,0>,(TS/2)-Pitch, <0,-(BL - TL - Pitch),0>,TL+2*Pitch} } #local i = 0; #while (i < TObj) intersection { object{Thread rotate <0,-i*5,0> translate <0,((i/72))*Pitch - TBegin, 0>} cylinder {<0,-BL-Pitch,0>, <0,-BL+TL+2*Pitch,0>, TS/2} } #local i = i + 1; #end } translate <0,SH,0> } #end /********************************************************************** * Nut Macro for Povray 3.1e by M.Schimmler 2.5.1999 * * schimmler@ica.uni-stuttgart.de * **********************************************************************/ #macro Nut(TS) #local WS = 1.5*TS; #local NH = 0.9*TS; #local Pitch = TS/8; #local TLen = 0.8 * Pitch; #local TOff = (0.125*cos(pi/6)*Pitch) + TS/2; #local Flank = 0.54127 * Pitch; #local PAng = degrees( atan2( Pitch/(pi * TS),1)); #local SLen = (WS)/sin(pi/3); //length of a nutside #local CAng = pi/6; //angle of intersection cone #local CHt = 0.1 + NH + tan(CAng)*WS/2.0;//heigth of intsec. cone #local TObj = (floor(NH / Pitch) + 2) * 72; #local COff = TOff / tan(pi/3); #local CBase = (COff + 2*Pitch) * tan(pi/3); #local Thread = object{ prism{ linear_sweep linear_spline -(TLen/2), (TLen/2), 4, <-Pitch/2,0>, <0,-Pitch>, , <-Pitch/2,0> } translate <0,0,TOff> rotate <0,0,90 - PAng> } object{ union{ intersection{ difference{ prism{ linear_sweep linear_spline 0, NH, 7, , , <-SLen/4.0, WS/2.0>, <-SLen/2.0, 0>, <-SLen/4.0, -WS/2.0>, , } cylinder {<0,-0.1,0>, <0,NH+0.1,0>, TS/2} } cone {<0, NH + (tan(CAng)*WS/2.0), 0>, 0.0 <0, -0.1, 0>, CHt/tan(CAng)} cone {<0, -1.0*(tan(CAng)*WS/2.0), 0>, 0.0 <0, -1.0*(tan(CAng)*WS/2.0)+CHt, 0>, CHt/tan(CAng)} } union{ #local i = 0; #while (i < TObj) difference{ object {Thread rotate <0,-i*5,0> translate <0, ((i/72)-1)*Pitch, 0>} cone {<0,COff,0>,0,<0,-2*Pitch,0>,CBase} cone {<0,NH - COff,0>,0 <0,NH + 2*Pitch,0>,CBase} cylinder {<0,-2*Pitch,0>,<0,NH + 2*Pitch,0>, TS/2 - Flank} cylinder {0,<0,-2*Pitch,0>,WS} cylinder {<0,NH,0>,<0,NH+2*Pitch,0>,WS} } #local i = i + 1; #end } } scale <1,-1,1> } #end #macro Stud (TS,BL,TL) #local Pitch = TS/8; #local TLen = 0.8 * Pitch; #local TOff = TS/2 - 0.86603*Pitch/4 - 0.54127*Pitch; #local PAng = degrees( atan2( Pitch/(pi * TS),1)); #local TObj = (ceil(TL/Pitch) + 2)*72;//num. of Thread obj. #local TBegin = BL + Pitch; #local Thread = object{ prism{ linear_sweep linear_spline -(TLen/2), (TLen/2), 4, <-Pitch/2,0>, <0,Pitch>, , <-Pitch/2,0> } translate <0,0,TOff> rotate <0,0,90 - PAng> } object{ union{ cylinder {<0,0,0>, <0,-(BL-TL-Pitch),0>, TS/2} cone {<0,-(BL-TL-Pitch),0>,TS/2, <0,-(BL-TL),0>,(TS-1.22687*Pitch)/2} intersection{ cylinder {<0,-(BL-TL),0>, <0,-BL-1.0001*Pitch,0>,(TS-1.22687*Pitch)/2} cone {<0,-BL - Pitch,0>,(TS/2)-Pitch, <0,-(BL - TL - Pitch),0>,TL+2*Pitch} } #local i = 0; #while (i < TObj) intersection { object{Thread rotate <0,-i*5,0> translate <0,((i/72))*Pitch - TBegin, 0>} cylinder {<0,-BL-Pitch,0>, <0,-BL+TL+2*Pitch,0>, TS/2} } #local i = i + 1; #end } } #end