import processing.pdf.*; int resolution = 72; //box dimensions in inches float boxWInches = 1.5; float boxHInches = 2; float boxDInches = 3; float boxThicknessInches = .13; float stemHeightInches = 3; float kerfInches = 0.008; //box dimensions in pixels int boxW = round(boxWInches * resolution); int boxH = round(boxHInches * resolution); int boxD = round(boxDInches * resolution); int boxThickness = round(boxThicknessInches * resolution); int kerf = round(kerfInches * resolution); int center = round((boxD + 25)/2); void setup(){ size(boxD*2+50,boxW*3 + 50); noLoop(); beginRecord(PDF, "lampshade"+boxWInches+"x"+boxHInches+"x"+boxDInches+".pdf"); } void draw(){ int upLeftX = center - (boxD/2); int upLeftY = 5; makeSide(upLeftX, upLeftY); // makeSide(upLeftX+boxSize+10, upLeftY); // makeTop(upLeftX,upLeftY); endRecord(); } void makeSide(int upLeftX,int upLeftY){ beginShape(); noFill(); vertex(upLeftX, upLeftY); //top center vertex(upLeftX + boxW/2+kerf, upLeftY); vertex(upLeftX + boxW/2+kerf, upLeftY + boxThickness); //up right vertex(upLeftX + boxW, upLeftY + boxThickness); vertex(upLeftX + boxW, upLeftY + boxH/2+kerf); vertex(upLeftX + boxW - boxThickness, upLeftY + boxH/2+kerf); vertex(upLeftX + boxW - boxThickness, upLeftY + boxH - boxThickness); vertex(upLeftX + boxW, upLeftY + boxH - boxThickness); //bottom right vertex(upLeftX + boxW, upLeftY + boxH); vertex(upLeftX + boxW/2-kerf, upLeftY + boxH); vertex(upLeftX + boxW/2-kerf, upLeftY + boxH - boxThickness); vertex(upLeftX, upLeftY + boxH - boxThickness); vertex(upLeftX, upLeftY + boxH/2-kerf); vertex(upLeftX + boxThickness, upLeftY + boxH/2-kerf); vertex(upLeftX + boxThickness, upLeftY + boxThickness); vertex(upLeftX, upLeftY + boxThickness); endShape(CLOSE); } /* void makeTop(int upLeftX,int upLeftY){ beginShape(); noFill(); vertex(upLeftX + boxThickness, upLeftY); //top center vertex(upLeftX + boxSize/2, upLeftY); vertex(upLeftX + boxSize/2, upLeftY + boxThickness); //up right vertex(upLeftX + boxSize, upLeftY + boxThickness); vertex(upLeftX + boxSize, upLeftY + boxSize/2); vertex(upLeftX + boxSize - boxThickness, upLeftY + boxSize/2); //bottom right vertex(upLeftX + boxSize - boxThickness, upLeftY + boxSize); vertex(upLeftX + boxSize/2, upLeftY + boxSize); vertex(upLeftX + boxSize/2, upLeftY + boxSize - boxThickness); vertex(upLeftX, upLeftY + boxSize - boxThickness); vertex(upLeftX, upLeftY + boxSize/2); vertex(upLeftX + boxThickness, upLeftY + boxSize/2); endShape(CLOSE); } */