CGA : Mosque

CGA MosqueOkay it’s a bit rough round the edges and if you can help me improve it please leave a comment!

 

Please feel free to copy and paste into a CityEngine rule file!

attr cylinder 	= "assets/Mosque/cyclinder.obj" //create it using SketchUp
attr locateMecca = 220	//degrees depends on where you are in the world!
attr mosqueheight = 6 //Mosque Height

Lot-->
	10% : testarea //you don't want to create a whole residential block of Mosques
	90% : openspace // change this to whatever you want
	else : openspace //just in case the percentages don't add up!

LotInner-->
	openspace // you can do similar to above I just wanted mosques with street access

testarea-->
	case  geometry.area > 500 : MosquePlot //makes sure the plot size is big enough
	else: openspace

MosquePlot-->
	setback(2){ streetSide : frontage | remainder : plot } //splits the lot up and allows a setback for parking maybe?

frontage --> color("#80FF00")

openspace --> color("#BBBB00")

plot -->
	color("#FFFFFF")
	offset(-0.25) mosqueoffset //compound wall thickness

mosqueoffset-->
	comp(f) { inside: mosque | border: mosquewall} //preparing the inside of the wall for a building

mosquewall-->
	extrude(1) //height of the wall set to 1 metre
mosque-->
	report("Mosque",1) // use reporting to make sure it's doing it correctly
	report("Mosque.Plot.Area",geometry.area()) // and so we can get stats on the area
	extrude(100) //I think this is wrong but the building is too thin without a number here
	s('0.45, mosqueheight, '0.45) //scale the building ' denotes percentage rather than number
	rotate(abs, world, 0, locateMecca, 0) //make the building face the right direction
	center(xz)
	split(x) {'0.95 : mosquebuilding | '0.05 : mineret} //split again so we can build a mineret

mosquebuilding-->
	color("#FFFFFF")

mineret -->
	report("Mineret",1)
	color("#FFFFFF")
	t(0,0,0) // for future use
	s(2,12,2) // scale your cylinder to the right size
	i(cylinder) // insert the cylinder

Now I know this isn’t very elegant or perfect, let me know if it can be done better!