AnsweredAssumed Answered

Align buildings to streets

Question asked by crrybski on Mar 12, 2014
Latest reply on Apr 24, 2014 by MBuehler-esristaff
Hi!
I'm very new to CityEngine, and I'm trying to write a CGA rule to create a basic house with a detached garage at the rear of the property.  I'm using real world lot and street network data which has been imported (separately) into CE.  Due to this, the lots don't naturally recognize the nearby streets. This is an issue as I would like the houses to be setback from the street, with the garage at the rear of the lot. 

Currently my rule file looks like this:
version "2010.3"  attr height = 10 attr blue = "#0066ff" attr angle = rand(35,45)  Lot-->    setback(10) { street.front : NIL | street.back: Backyard | remainder : Building }                 Building -->  s(10,height,10)  center(x)  extrude(height) comp(f) { side :  Facade | top(0):  Roof }    Backyard -->  setback(2) { street.back: NIL | remainder : Garage }      Garage -->   s(5,5,5)   center(x)   extrude(5) comp(f) { side :  Facade | top(0):  Roof }     Facade -->  color(blue)  Roof --> roofHip(angle) color(blue)


I discovered I am able to select and manually set one lot edge as the Street Front (shapes > Set Street Edges) and this mostly solves the problem. This is less than ideal when trying to apply a script to an entire city though! 

Wondering if someone could provide me with some tips on a more efficient way of achieving my goal?!

Attached are images of what my code produces, as well as what I'm aiming for (although fancy facades are not a priority).
Cheers!

Outcomes