//SCALE,ROTATE,TRANSLATE// #macro SRT (aScale, aRot, aTrans) scale aScale rotate aRot translate aTrans #end //SPHERE// #macro aSphere (diameter) sphere{ <0,0,0>, diameter/2 } #end //CUBE// #macro aCube (theX, theY, theZ) box { <-theX/2, -theY/2, -theZ/2>, } #end //TORUS// #macro aTorus (major, minor) torus { major/2, minor/2 scale <1,1,1> rotate<0,0,0> translate<0,0,0> } #end //CYLINDERS// //WIDE// #macro aCylinderW (height, theDiameter) cylinder { <-height/2,0,0>, , theDiameter/2 } #end //HIGH// #macro aCylinderH (height, theDiameter) cylinder { <0,-height/2,0>, <0,height/2,0>, theDiameter/2 } #end //DEEP// #macro aCylinderD (height, theDiameter) cylinder { <0,0,-height/2>, <0,0,height/2>, theDiameter/2 } #end //SETCAPS// #macro aCylinder2 (theBase, theCap, theDiameter) cylinder { theBase, theCap, theDiameter/2 } #end //CONE// #macro aCone (theBase, baseDiameter, theCap, capDiameter) cone { theBase, baseDiameter/2, theCap, capDiameter/2 } #end //HEXAGON// #macro aHexagon (theSize) object{ Hexagon scale theSize } // end of object #end /////////////// //**// //HOLLOWS// //HOLLOW SPHERE// #macro hollowSphere (diameter, innerPc) difference { object { aSphere (diameter) } object { aSphere (diameter*innerPc) } } #end //HOLLOW SPHERE HALF// #macro hollowSphereHalf (diameter, innerPc) difference { object { hollowSphere (diameter, innerPc) } object { aCube ( diameter*1.01, diameter*1.01, (diameter/2)*1.01 ) SRT(<1,1,1>, <0,0,0>, <0,0,-(diameter/4)*1.01>) } } #end //HOLLOW CUBE// #macro hollowCube (theX, theY, theZ, innerPc) difference { object { aCube (theX, theY, theZ) } object { aCube (theX*innerPc, theY*innerPc, theZ*innerPc) } } #end //HOLLOW CUBE OPEN// #macro boxOpenFace (theX, theY, theZ, innerPc) difference { //union{ object { hollowCube (theX, theY, theZ, innerPc) } object { aCube ( theX*1.01, theY*1.01, (theZ-(theZ*innerPc))*1.01 ) SRT(<1,1,1>, <0,0,0>, <0,0,-theZ/2>) } } #end //HOLLOW TORUS// #macro hollowTorus (major, minor, innerPc) difference { object { aTorus (major, minor) } object { aTorus (major, minor*innerPc) } } #end //HOLLOW TORUS OPEN// #macro hollowTorusHalf (major, minor, innerPc) difference { //union{ object { aTorus (major, minor) } object { aTorus (major, minor*innerPc) } object { aCube ( ((major+minor)*2)*1.01, (minor*2)*1.01, ((major+minor)*2)*1.01 ) SRT(<1,1,1>, <0,0,0>, <0,-(minor)*1.01,0>) } } #end ///////// //HOLLOW CYL W// #macro hollowCylW (height, outer, innerPc) difference { object{ aCylinderW (height, outer) } object{ aCylinderW (height*1.01, outer*innerPc) } } #end //HOLLOW CYL H// #macro hollowCylH (height, outer, innerPc) difference { object{ aCylinderH (height, outer) } object{ aCylinderH (height*1.01, outer*innerPc) } } #end //HOLLOW CYL D// #macro hollowCylD (height, outer, innerPc) difference { object{ aCylinderD (height, outer) } object{ aCylinderD (height*1.01, outer*innerPc) } } #end //HOLLOW CYL 2// #macro hollowCyl2 (theBase, theCap, theDiameter, innerPc) difference { object{ aCylinder2 (theBase, theCap, theDiameter) } object{ aCylinder2 (theBase-0.01, theCap+0.01, theDiameter*innerPc) } } #end //HOLLOW CONE// #macro hollowCone (theBase, baseDiameter, theCap, capDiameter, innerPc) difference { object{ aCone (theBase, baseDiameter, theCap, capDiameter) } object{ aCone (theBase-0.01, baseDiameter*innerPc, theCap+0.01, capDiameter*innerPc) } } #end //HOLLOW HEXAGON// #macro hollowHexagon (theSize, innerPc) difference { object{ aHexagon (theSize) } object{ aHexagon (theSize*<1.01, 1*innerPc, 1*innerPc>) } } #end //////// //HOLES// //SPHERE HOLE// #macro hollowSphereWithHole (diameter, innerPc, holeDiam) difference { object { hollowSphere (diameter, innerPc) } object { aCylinderD (diameter*1.01, holeDiam) } } #end //BOX HOLE// #macro boxWithHole (theX, theY, theZ, innerPc, holeDiam) difference { object { hollowCube (theX, theY, theZ, innerPc) } object { aCylinderD (theZ*1.01, holeDiam) } } #end //COMPLEX OBJECTS// #macro cylOuterBoltRing (height, outer, innerPc, boltNum, boltSizePc, boltThickness) union { object{ hollowCylD (height, outer, innerPc) } #declare Teta=0; #while (Teta<360) object{ aHexagon () texture{boltTex} scale<1,1,1> rotate<0,0,90> translate <0,outer/2,0> rotate <0,0,Teta> } #declare Teta=Teta+(360/boltNum); #end } #end #macro FIXcylOuterBoltRing (height, outer, innerPc, boltNum) union { object{ hollowCylD (height, outer, innerPc) } #declare Teta=0; #while (Teta<360) object{ aHexagon () scale<1,1,1> rotate<90,0,0> translate <0,outer,0> rotate <0,0,Teta> } #declare Teta=Teta+(360/boltNum); #end } #end #macro quickElbow (major,minor, innerPc) union { difference { //union{ object{hollowTorus (major, minor, innerPc) } //main //w, d, h object{aCube ( major*1.01, minor*1.01, major*1.01) //topHide //pigment{color Orange} SRT(<1,1,1>,<0,0,0>,<(major*1.01)/2, 0, -(major)/2>) } //-(major*1.01)/2 object{aCube ( (major+minor)*1.01, minor*1.01, major*1.01) //botHide //pigment{color Yellow} SRT(<1,1,1>,<0,0,0>,<0,0,(major*1.01)/2>) } } object{aTorus (minor,minor*0.1) //pigment{color Red} SRT(<1,1,1>,<0,0,90>,<0,0,-major/2>) } object{aTorus (minor,minor*0.1) //pigment{color Blue} SRT(<1,1,1>,<90,0,0>,<-major/2,0,0>) } SRT(<1,1,1>,<0,0,0>,<0,0,(major/2)>)//(major/2)-(minor/2) } #end #macro ribIndentSet (height, ribOuter) union { object{ aCylinderH (height, ribOuter) SRT(<1,1,1>,<0,0,0>,<-ribOuter,0,0>) } object{ aCylinderH (height, ribOuter) SRT(<1,1,1>,<0,0,0>,) } difference { object{ aCube(ribOuter*3, height, (ribOuter*1.01)/2)/*theX, theY, theZ*/ SRT(<1,1,1>,<0,0,0>,<0,0,(ribOuter*1.01)/4>) } object{ aCylinderH (height*1.01, ribOuter*1.01) } } } #end #macro ribIndent (height, ribOuter) difference { //union{ union { object{ aCylinderH (height, ribOuter) } object{ aCube(ribOuter*2, height, (ribOuter/2)*1.01)/*theX, theY, theZ*/ SRT(<1,1,1>,<0,0,0>,<0,0,(ribOuter/4)*1.01>) } } union { object{ aCylinderH (height*1.01, ribOuter) SRT(<1,1,1>,<0,0,0>,<-ribOuter,0,0>) } object{ aCylinderH (height*1.01, ribOuter) SRT(<1,1,1>,<0,0,0>,) } } } #end #macro cubeWithRibIndent (theX, theY, theZ, ribPc) difference { //union{ object { aCube (theX, theY, theZ) } #declare ribSize = ribPc*(theZ/2); object { ribIndent (theY*1.01, ribSize)//(height, ribOuter) // pigment{color Red} SRT(<1,1,1>,<0,180,0>,<0,0, -( (theZ/2) - (ribSize/2) )>) }// +((ribPc*theZ/2)/2) // -( (theY/4)-((ribPc*theY/4)/2) ) //-( (theY/2)-(ribPc*theY/2) ) //-(ribPc*(theY)) } #end #macro canister1 (cylLength, diameter, innerPc, sphereDepthPc) union { object { hollowCylW (cylLength, diameter, innerPc) }//(width, outer, innerPc) object {hollowSphereHalf (diameter, innerPc)//(diameter, innerPc) SRT(<1,1,sphereDepthPc>,<0,-90,0>,<-cylLength/2,0,0>) } object {hollowSphereHalf (diameter, innerPc)//(diameter, innerPc) SRT(<1,1,sphereDepthPc>,<0,90,0>,) } } #end #macro canister2 (cylLength, diameter, innerPc, sphereDepthPc, ringThickPc, boltNum, boltSizePc, boltThickness) union { object { hollowCylW (cylLength, diameter, innerPc) }//(width, outer, innerPc) object {hollowSphereHalf (diameter, innerPc)//(diameter, innerPc) SRT(<1,1,sphereDepthPc>,<0,-90,0>,<-cylLength/2,0,0>) } object {hollowSphereHalf (diameter, innerPc)//(diameter, innerPc) SRT(<1,1,sphereDepthPc>,<0,90,0>,) } #declare ringThick = ringThickPc*cylLength; object {cylOuterBoltRing(ringThick, diameter*1.05, innerPc, boltNum, boltSizePc, boltThickness) /*height, outer, innerPc, boltNum, boltSizePc boltThickness*/ texture { quickCopper } SRT(<1,1,1>,<0,-90,0>,<-( (cylLength/2)-(ringThick/2) ),0,0>) } object {cylOuterBoltRing(ringThick, diameter*1.05, innerPc, boltNum, boltSizePc, boltThickness) /*height, outer, innerPc, boltNum, boltSizePc boltThickness*/ texture { quickCopper } SRT(<1,1,1>,<0,90,0>,<( (cylLength/2)-(ringThick/2) ),0,0>) } } #end #macro braceBeam (theX, theY, theZ) union { object{ aCube (theX, theY, theZ) } object {aCylinderD(theZ, theY)/*depth, theDiameter*/ SRT(<1,1,1>,<0,0,0>,<-theX/2,0,0>)} object {aCylinderD(theZ, theY)/*depth, theDiameter*/ SRT(<1,1,1>,<0,0,0>,)} } #end #macro braceBeamHoll (theX, theY, theZ, innerPc, jutPc) union { difference { object{ aCube (theX, theY, theZ) } object {aCylinderD(theZ*1.01, theY)/*depth, theDiameter*/ SRT(<1,1,1>,<0,0,0>,<-theX/2,0,0>)} object {aCylinderD(theZ*1.01, theY)/*depth, theDiameter*/ SRT(<1,1,1>,<0,0,0>,)} } object {hollowCylD(theZ+(theZ*jutPc), theY, innerPc)/*depth, outer, innerPc*/ texture { quickCopper } SRT(<1,1,1>,<0,0,0>,<-theX/2,0,0>) } object {hollowCylD(theZ+(theZ*jutPc), theY, innerPc)/*depth, outer, innerPc*/ texture { quickCopper } SRT(<1,1,1>,<0,0,0>,) } } #end #macro aCubeZrounded (theX, theY, theZ) union { object{ aCube (theX, theY, theZ) } object {aCylinderH(theY, theX)/*height, theDiameter*/ SRT(<1,1,1>,<0,0,0>,<0,0,-theZ/2>)} object {aCylinderH(theY, theX)/*height, theDiameter*/ SRT(<1,1,1>,<0,0,0>,<0,0,theZ/2>)} } #end #macro roundedDiscWithHole(thick, outer, innerDiam) union { object { aTorus (outer-thick, thick) //majorD, minorD SRT(<1,1,1>,<0,0,90>,<0,0,0>) } object { aTorus (innerDiam+thick, thick) //majorD, minorD SRT(<1,1,1>,<0,0,90>,<0,0,0>) } difference { object{ aCylinderW (thick, outer-thick) } //width, theDiameter object{ aCylinderW (thick*1.01, innerDiam+thick) } } } #end #macro roundedCylinderWithHole(totLength, outer, innerDiam, roundPc) #declare toriMinor = (outer*roundPc); #declare toriHalf = (outer*roundPc)/2; #declare toriOffset = (totLength/2)-toriHalf; #declare innerCyl = difference { object{ aCylinderW (totLength-roundPc, outer) } //width, theDiameter object{ aCylinderW ( (totLength-roundPc)*1.01, innerDiam) } } union { object { innerCyl } difference { union { object{ roundedDiscWithHole (roundPc, outer, innerDiam) //(thick, outer, innerDiam) SRT(<1,1,1>,<0,0,0>,<(totLength/2)-toriMinor,0,0>) } object{ roundedDiscWithHole (roundPc, outer, innerDiam) //(thick, outer, innerDiam) SRT(<1,1,1>,<0,0,0>,<-((totLength/2)-(toriMinor)),0,0>) } } object { innerCyl } } } #end #macro indentedWall(wide, tall, thick, indentPc, numHoriz, numVert) #declare ribSize = indentPc*(thick/2); union { //Main Union difference { //Main Diff //merge{ object{ aCube(wide, tall, thick)/*theX, theY, theZ*/ SRT(<1,1,1>,<0,0,0>,<0,0,0>) } union { //Indent Union #declare horizIndent=0; #while (horizIndent SRT(<1,1,1>,<180,0,0>,<0,-(tall/2)+(horizIndent+((tall/numHoriz)/2)), -( (thick/2) - (ribSize/2) )>) } #declare horizIndent=horizIndent+(tall/numHoriz); #end #declare vertIndent=0; #while (vertIndent,<180,0,0>,<-(wide/2)+(vertIndent+((wide/numVert)/2)), 0, -( (thick/2) - (ribSize/2) )>) } #declare vertIndent=vertIndent+(wide/numVert); #end }//END Indent Union } //END Main Diff } //End Main Union #end #macro wallCubeIndent(wide, tall, thick, indentWide, indentDeep, numHoriz, numVert) union { //Main Union difference { //Main Diff //merge{ object{ aCube(wide, tall, thick)//theX, theY, theZ SRT(<1,1,1>,<0,0,0>,<0,0,0>) } union { //Indent Union #declare horizIndent=0; #while (horizIndent,<0,0,0>,<0,-(tall/2)+(horizIndent+((tall/numHoriz)/2)), -thick/2>) } #declare horizIndent=horizIndent+(tall/numHoriz); #end #declare vertIndent=0; #while (vertIndent,<0,0,0>,<-(wide/2)+(vertIndent+((wide/numVert)/2)), 0, -(thick/2)*0.999>) } #declare vertIndent=vertIndent+(wide/numVert); #end texture{Chrome_Metal} }//END Indent Union } //END Main Diff } //End Main Union #end #macro wallCubeIndent2(wide, tall, thick, indentWide, indentDeep, numHoriz, numVert) union { //Main Union difference { //Main Diff //merge{ union { #declare horizIndent0=0; #while (horizIndent0,<0,0,0>,<0,-(indentWide/2), indentDeep>) } object {aCube(wide, indentWide*0.5, indentDeep*0.2)//theX, theY, theZ pigment {color Black} //texture{Chrome_Metal} SRT(<1,1,1>,<0,0,0>,<0,(indentWide/2), indentDeep>) } //texture{Chrome_Metal}//-(tall/2)+(horizIndent+((tall/numHoriz)/2)) //SRT(<1,1,1>,<0,0,0>,<0,horizIndent-(tall+(tall/numhoriz))/2, -thick/2>) SRT(<1,1,1>,<0,0,0>,<0,horizIndent0-(tall/2)+((tall/numHoriz)/2), -(thick/2+indentDeep)>) //SRT(<1,1,1>,<0,0,0>,<0,-(tall/2)+(horizIndent0+((tall/numHoriz)/2)), -(thick/2+indentDeep)>) } #declare horizIndent0=horizIndent0+(tall/numHoriz); #end #declare vertIndent0=0; #while (vertIndent0,<0,0,0>,<-(indentWide/2), 0, indentDeep>) } object {aCube(indentWide*0.5, tall, indentDeep*0.2)//theX, theY, theZ pigment {color Black} //texture{Chrome_Metal} SRT(<1,1,1>,<0,0,0>,<(indentWide/2), 0, indentDeep>) } SRT(<1,1,1>,<0,0,0>,) //SRT(<1,1,1>,<0,0,0>,<-(wide/2)+(vertIndent0+((wide/numVert)/2)), 0, -(thick/2+indentDeep)*0.999>) } #declare vertIndent0=vertIndent0+(wide/numVert); #end object{ aCube(wide, tall, thick)//theX, theY, theZ SRT(<1,1,1>,<0,0,0>,<0,0,0>) } } union { //Indent Union #declare horizIndent=0; #while (horizIndent,<0,0,0>,<0,horizIndent-(tall/2)+((tall/numHoriz)/2), -(thick/2)>) //SRT(<1,1,1>,<0,0,0>,<0,-(tall/2)+(horizIndent+((tall/numHoriz)/2)), -thick/2>) } #declare horizIndent=horizIndent+(tall/numHoriz); #end #declare vertIndent=0; #while (vertIndent,<0,0,0>,) //SRT(<1,1,1>,<0,0,0>,<-(wide/2)+(vertIndent+((wide/numVert)/2)), 0, -(thick/2)*0.999>) } #declare vertIndent=vertIndent+(wide/numVert); #end texture{Chrome_Metal} }//END Indent Union } //END Main Diff } //End Main Union #end /* //declarations for iBeam #declare iLength = 4; //x #declare iHeight = 0.2; //y #declare iWidth = 0.22; //z #declare iThick = 0.02; //bar thickness (z on main, y on crosses) #declare iCylPc = 0.3*iHeight; //z #declare crossOffset = (iHeight/2)-(iThick/2); #declare quarterRound = difference { object{ aCube(iLength, iCylPc/2, iCylPc/2)//theX, theY, theZ //texture { quickCopper } SRT(<1,1,1>,<0,0,0>,<0,iCylPc/4,iCylPc/4>) } object {aCylinderW(iLength*1.01, iCylPc)//width, theDiameter //pigment{color Red} SRT( <1,1,1>,<0,0,0>,<0,0,0> )} SRT( <1,1,1>,<0,0,0>,<0,0,0> ) } #declare iBeam = union { //main upright object{ aCube(iLength, iHeight-(iThick*2), iThick)//theX, theY, theZ //texture { quickCopper } SRT(<1,1,1>,<0,0,0>,<0,0,0>) } //crosses object{ aCube(iLength, iThick, iWidth)//theX, theY, theZ //texture { quickCopper } SRT(<1,1,1>,<0,0,0>,<0,crossOffset,0>) } object{ aCube(iLength, iThick, iWidth)//theX, theY, theZ //texture { quickCopper } SRT(<1,1,1>,<0,0,0>,<0,-crossOffset,0>) } object {quarterRound SRT( <1,1,1>,<0,0,0>,<0, crossOffset-(iThick/2)-(iCylPc/2), -(iThick+iCylPc)/2> ) } object {quarterRound SRT( <1,1,1>,<270,0,0>,<0, crossOffset-(iThick/2)-(iCylPc/2), (iThick+iCylPc)/2> ) } object {quarterRound SRT( <1,1,1>,<90,0,0>,<0, -( crossOffset-(iThick/2)-(iCylPc/2) ), -(iThick+iCylPc)/2> ) } object {quarterRound SRT( <1,1,1>,<180,0,0>,<0, -( crossOffset-(iThick/2)-(iCylPc/2) ), (iThick+iCylPc)/2> ) } } */