I am working on designing a "typical" city block that includes basic row houses. I have managed to figure out the general shape grammar and even add unique cases for when the block borders a commercial street (see image below).
The problem is that, right now, these unique cases are essentially just hard-coded in based on a user-specified typology. What I would like instead is for the block to be able to draw information from adjacent streets. Ie, it should know when the "type" of an adjacent street is "COMMERCIAL" (for example) and use that information to trigger the new block shape.
Is there a way to access street attributes in the CGA script? There are clearly width values stored as Object Attributes called streetWidth(0), streetWidth(1), etc....but how do you reference these in your code?
I was able to recreate your results for blocks that use built-in subdivision tools (recursive, offset, etc). Unfortunately, the rules we are developing are all built on full lots with no subdivision...essentially giving us control of the size and shape of "parcels."
When I try the same approach on this block, all elements of the block take on the same streetWidth(i) attributes, even if they are subsequently split apart and no longer touch the streets. See the image below for what I mean: [ATTACH=CONFIG]13644[/ATTACH]
Is there a way, perhaps, to identify which side of the block is actually touching the largest street? Even returning a direction (N,S,E, or W) could work.
so I understand yo correct : that Block was actually subdivided using CGA, right ?
a few inputs you may not yet have known :
- if your Block is not subdivided (but dynamic), the resulting Lot's 'First Edge' always is on the widest street side. thus, the index of the 'widest side' is always 0. plus, the initial scope orientation is always aligned on this 'First Edge'. - if all Widths are equal, the longest Edge becomes the 'First Edge'. - Dynamic City Layouts give you no visual indicator where that First Edge actually is compared to if you draw a Static Shape manually or import it somehow. - if you have a Static Shape selected, you'll see a tiny finey orange line on one of the edges. that is the First Edge. the edge between vertex 0 and 1. - you can always convert a specific Dynamic Shape - as for example from your Block - to a Static Shape via the RMB command 'Convert to Static Shapes'. [ move the shape up a little, then delete it later on together with the layer it's been created on. ]
important : Attributes on Start Shapes, such your specific Lot's StreetWidth attributes are constant for the Model since those Attributes are specific INPUTS for CGA to create the Model on this shape. Once the Model Generation is started, CGA works just with the input it gets. CGA just executes a series of geometric operations, thus it has no 'knowledge of the semantic content' of the instructions you give it. So to CGA there's no difference between if you just : 1] extrude a Lot directly to get a Building Model or 2] first split the Lot into smaller Lots via CGA operations and then extrude some of those to individual Buildings. --> the result in both 1] and 2] is both 'just a Model'. --> Once the Model Generation is started, CGA can not go back and check the environment around the shape and read more info to further process that data in the current Model. That is currently not possible, but may change with an upcoming release. [same is true with sampled map layer information: it is constant during the Model Generation process.]
--> All MetaInformation (geometric, semantic) you're interested in must be passed on via the Rules. --> Think of it as follows : Once you hit the Generate Button, a Shape goes blind and sees nothing else around itself but the information it was given to build the Model.