#include "colors.inc" // Units are based on 1 being the distance between two holes (half an inch) #declare hole_diameter = 0.156225*2; #declare slot_length = 0.34375*2; #declare plate_thickness = hole_diameter/5; #declare collar_diameter = 0.75; #macro Axle(length) cylinder { <0.5, 0.5, (- 0.5)>, <0.5, 0.5, (length - 0.5) >, hole_diameter/2 texture { pigment { color Grey } } } #end #macro HoleGrid(x_holes, y_holes) #declare xh=0; #while (xh < x_holes) #declare yh=0; #while (yh < y_holes) object { Axle(1) translate x*xh translate y*yh } #declare yh=yh+1; #end #declare xh=xh+1; #end #end #macro SlotRow(x_slots) #declare xs=0; #while (xs < x_slots) object { Axle(1) translate x*xs } object { Axle(1) translate x*xs translate y*(slot_length-hole_diameter) } box { , texture { pigment { color Grey } } } #declare xs=xs+1; #end #end #macro Plate(x_holes, y_holes, corner00, corner01, corner10, corner11) difference { box { <0, 0, 0>, } HoleGrid(x_holes, y_holes) # if (corner00) difference { // Bottom left corner box { <0.5, 0.5, 0.5>, <-0.1, -0.1, -0.5> } cylinder { <0.5, 0.5, -0.6>, <0.5, 0.5, 0.6>, 0.5 } } #end # if (corner01) difference { // Bottom right corner box { <(x_holes-0.5), 0.5, 0.5>, <(x_holes+0.1), -0.1, -0.5> } cylinder { <(x_holes-0.5), 0.5, -0.6>, <(x_holes-0.5), 0.5, 0.6>, 0.5 } } #end # if (corner10) difference { // Top left corner box { <0.5, (y_holes-0.5), 0.5>, <-0.1, y_holes+0.1, -0.5> } cylinder { <0.5, (y_holes-0.5), -0.6>, <0.5, (y_holes-0.5), 0.6>, 0.5 } } #end # if (corner11) difference { // Top right corner box { <(x_holes-0.5), (y_holes-0.5), 0.5>, } cylinder { <(x_holes-0.5), (y_holes-0.5), -0.6>, <(x_holes-0.5), (y_holes-0.5), 0.6>, 0.5 } } #end texture { pigment { color Yellow } } } #end #macro Slotstrip(x_slots, corner00, corner01, corner10, corner11) difference { box { <0, 0, 0>, } SlotRow(x_slots) # if (corner00) difference { // Bottom left corner box { <0.5, 0.5, 0.5>, <-0.1, -0.1, -0.5> } cylinder { <0.5, 0.5, -0.6>, <0.5, 0.5, 0.6>, 0.5 } } #end # if (corner01) difference { // Bottom right corner box { <(x_slots-0.5), 0.5, 0.5>, <(x_slots+0.1), -0.1, -0.5> } cylinder { <(x_slots-0.5), 0.5, -0.6>, <(x_slots-0.5), 0.5, 0.6>, 0.5 } } #end # if (corner10) difference { // Top left corner box { <0.5, (0.5+(slot_length-hole_diameter)), 0.5>, <-0.1, 1+(slot_length-hole_diameter)+0.1, -0.5> } cylinder { <0.5, (1+(slot_length-hole_diameter)-0.5), -0.6>, <0.5, (1+(slot_length-hole_diameter)-0.5), 0.6>, 0.5 } } #end # if (corner11) difference { // Top right corner box { <(x_slots-0.5), (0.5+(slot_length-hole_diameter)), 0.5>, } cylinder { <(x_slots-0.5), (1+(slot_length-hole_diameter)-0.5), -0.6>, <(x_slots-0.5), (1+(slot_length-hole_diameter)-0.5), 0.6>, 0.5 } } #end texture { pigment { color Yellow } } } #end #macro DoubleStrip(x_holes) union { Plate(x_holes, 1, 1,1,0,0) object { Slotstrip(x_holes, 0,0,1,1) translate y*0.99 } } #end #macro AngleGirder(x_holes) union { Plate(x_holes, 1, 0,0,1,1) object { Slotstrip(x_holes, 0,0,1,1) rotate -90*x } } #end camera { location <-4, 3, -7> look_at <4, 3, 0> } light_source { <2, 4, -6> color White} light_source { <-2, 6, -1> color White} object { AngleGirder(50) } object { DoubleStrip(50) translate y*1.5 } object { Plate(50, 1, 1,1,1,1) translate y*4.4 }