I am currently working on 3D zoning, specifically with planning law and regulation in Bulgaria. I prepared the regulations in ArcMap for the different zones in the fields for setbacks, max heights, max GFA etc with the respective values. I assigned these fields to attributes in Cityengine and they work well. I also adapted the CGA rule from Tutorial 16: Urban Planning for highlighting the building stories which are over the specified 3D volume.
I face 3 issues for which I looked all over the forum, the help documentation and the tutorials and I can't figure out how to solve them. This is the question for the first one.
- Two attributes changing each other in the Inspector.
As you see from the CGA code I have three parameters - floorHeight, floorCount and buildingHeight. I extrude the building based on buildingHeight attribute which = floorHeight * floorCount and when I give the last two new values in the Inspector they affects the buildingHeight. But I want to be able to reverse the process in case the user wants to give value to the buildingHeight, not to the floorCount directly. What I don't achieve up until now is the floorCount to recalculate and show in the Inspector the new value when I manually give new value to buildingHeight. The Viewer shows the changes, but not the Inspector.
Firstly I tried with :
buildingHeight = floorHeight * floorCount
floorCount = buildingHeight / floorHeight
but CGA wants at least two attributes from the three to be defined. Then I added some cases in the attributes, additional attributes and Rules but I still can't manage to get it both ways - the change of floorCount to affect buildingHeight and the change of buildingHeight to affect floorCount both in the Viewer and the Inspector. The attached screenshots show the scene and the changes of the attributies.
FYI - I am an urbanist and GIS user with some basic coding understanding but not Python experience and new to Cityengine and CGA rule grammar. Your help will be highly appreciated.
attr floorHeight = 3.5
attr floorCount = 0
attr buildingHeight = floorHeight*floorCount
attr testerH = floorHeight*floorCount
attr testerF = buildingHeight/floorHeight
case inside: color("#000fff")
case testerH == testerF : set(buildingHeight, testerH)
else: set (floorCount, testerF)