I want to create building footprints in City Engine programmatically and specify the density of lots in a specific region and assign a height attribute for the buildings to each lot? I need to achieve all this using CGA rules and python. Can anyone point me in the right direction? I'm new to CityEngine.
If you are new to the software, have you seen the help topics and help files.
The rules are covered within and can be searched
This should help you getting started. It creates a 500x500 rectangle, gives it an attribute plus value, assigns a CGA rule and triggers model creation. Create the CGA rule ("extruder.cga") first.
Python
rect1x1 = [0,0,0, 0,0,500, 500,0,500, 500,0,0]
shape = ce.createShape(None, rect1x1)
ce.setAttribute(shape, 'Height', 50)
shapeRule = "rules/extruder.cga"
ce.setRuleFile(shape, shapeRule)
ce.setStartRule(shape, 'Lot')
ce.generateModels(shape, False)
ce.waitForUIIdle()
CGA
attr Height = 0
@StartRule
Lot -->
extrude(Height)