AnsweredAssumed Answered

Two attributes changing each other in the Inspector

Question asked by k.karamitov@esribulgaria.com on May 4, 2018
Latest reply on May 21, 2018 by k.karamitov@esribulgaria.com

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. Here is a link to the second and a link to the third one.

  1. 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. 

    @Order(1)
    attr floorHeight = 3.5
    @Order(2)
    attr floorCount = 0
    @Order(3)
    attr buildingHeight = floorHeight*floorCount
    @Order(4) @Hidden
    attr testerH = floorHeight*floorCount
    @Order(5)@Hidden
    attr testerF = buildingHeight/floorHeight

    @StartRule
    Building -->
         alignScopeToAxes(y)    
         extrude(buildingHeight)
         split(y){~floorHeight: Legal}*

    Legal -->
         case inside: color("#000fff")
         else: color("#ffff11")
         Input
        
    Input -->
         case  testerH == testerF : set(buildingHeight, testerH)
         else: set (floorCount, testerF)

     

Outcomes