Andre Le

23 Jan 2014

 

 

BuildingBuilder by @Andre_Le. An #OpenSCAD project that procedurally creates a 3D building model.

andrele_building_generator

 

frame00002
frame00000

This project was built with the intention of it being a springboard for entire procedurally generated cities. This was my first foray into anything 3D and wrapping my head around 3D coordinates and transforms using algorithms was a little tricky at first, so I opted to keep this project relatively simple. All of the properties of the building has been parameterized, so height, width, depth, number of windows in a row, and even spacing between windows can be changed.

Thingiverse

Github Link

// OpenSCAD Building Generator
// Written by Andre Le
// for Golan Levin's Interactive Art and Computational Design 2014
 
height = 900;
width = 10000*sin($t)+1000;
depth = 10000*sin($t)+1000;
gutter = .2;
floorHeight = 10;
windowColumns = 10;
windowSize = width*(1-gutter)/windowColumns;
tHeight = height*($t+1);
 
// Determine how many floors fit
floors = floor(tHeight / ((windowSize)+(gutter*width/(windowColumns+1))));
 
translate([-width/2,-depth/2,0]){
	difference(){
		cube([width,depth,tHeight]);
 
		// Create floors
		for(j = [0:floors-1]) {
 
			translate([0,0,j*(windowSize)+((j +1)*(gutter*width/(windowColumns+1)))]){
				// Create row of windows along width
				for(i = [0:windowColumns-1]) {
					translate([i*(windowSize)+((i+1)*(gutter*width/(windowColumns+1))),-1,(gutter*width/windowColumns)]){
						cube([windowSize,15,windowSize]);
					}
				}
				translate([0,depth-13,0]){
					for(i = [0:windowColumns-1]) {
						translate([i*(windowSize)+((i+1)*(gutter*width/(windowColumns+1))),-1,(gutter*width/windowColumns)]){
							cube([windowSize,15,windowSize]);
						}
					}
				}
				// Create row of windows long depth
				rotate([0,0,90]){
					translate([0,-13,0]){
						for(f = [0:windowColumns-1]) {
							translate([f*(depth*(1-gutter)/windowColumns)+((f+1)*(gutter*depth/(windowColumns+1))),-1,(gutter*width/windowColumns)]){
								cube([depth*(1-gutter)/windowColumns,15,windowSize]);
							}
 
						}
						translate([0,-width+13,0]){
							for(f = [0:windowColumns-1]) {
								translate([f*(depth*(1-gutter)/windowColumns)+((f+1)*(gutter*depth/(windowColumns+1))),-1,(gutter*width/windowColumns)]){
									cube([depth*(1-gutter)/windowColumns,15,windowSize]);
								}
 
							}
						}
					}
				}
			}
		}
	}
}

IMG_1065