include boxHelper(45, 53, "Reaper", "Zyklop", "Megaslime"); translate([ 88.5, 39, 0 ]) zrot(180, cp=[0, 0, 0]) boxHelper(45, 53, "Drache", "Medusa", "Träumer"); module boxHelper(x, z, frontName, middleName, backName) { difference() { cube([ x, 39, z ], false); translate([ 1.5, 1.5, 1.5 ]) cube([ x - 3, 36, z - 1 ], false); // windows window(x / 2, 39, z, "Schleim", "Reaper"); // floor xInner = x - 10; yInner = 39 - 10; if (xInner >= 6 && yInner >= 6) { xSpace = 5 + (((xInner + 2) % 8) / 2); xAmount = (((xInner + 2) - xSpace + 5) / 8); ySpace = 5 + (((yInner + 2) % 8) / 2); yAmount = (((yInner + 2) - ySpace + 5) / 8); for (i = [0:xAmount - 1], j = [0:yAmount - 1]) translate([ xSpace + i * 8, ySpace + j * 8, -1 ]) cube([ 6, 6, 3.5 ], false); } translate([ 0.6, 19.5, z / 2 ]) rotate([ 0, -90, 0 ]) linear_extrude(height = 1.6) text( middleName, size = 4, font = "Arial:style=Bold", halign="center" ); } difference() { union() { translate([ 0, 12.5, 0 ]) cube([ x, 1.5, z ], false); translate([ 0, 25, 0 ]) cube([ x, 1.5, z ], false); } windowHelper(x / 2, 12.5, z, ""); windowHelper(x / 2, 25, z, ""); } } module window(x, y, z, frontName, backName) { windowHelper(x, 0, z, frontName); zrot(180, cp=[x, y / 2, 0]) windowHelper(x, 0, z, backName); } module windowHelper(x, y, z, name) { translate([ 7, y - 1, 8 ]) cuboid( [ 2 * (x - 7), 3.5, z - 8 ], anchor = [-1, -1, -1], rounding = 3, edges = [ BOTTOM + LEFT, BOTTOM + RIGHT ] ); difference() { translate([ 1.5, y - 1, z - 5 ]) cube([ 2 * (x - 1.5), 3.5, 6 ], false); translate([ 1, y - 1, z - 6 ]) cuboid( [ 6, 3.5 , 6 ], anchor = [-1, -1, -1], rounding = 5, edges = TOP + RIGHT ); translate([ 2 * x - 7, y - 1, z - 6 ]) cuboid( [ 6, 3.5 , 6 ], anchor = [-1, -1, -1], rounding = 5, edges = TOP + LEFT ); } translate([ x, y + 0.6, 4 ]) rotate([ 90, 0, 0 ]) linear_extrude(height = 1.6) text( name, size = 4, font = "Arial:style=Bold", halign="center", valign="center" ); }