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.
- 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<SPAN class="punctuation token">(</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">)</SPAN>
attr floorHeight <SPAN class="operator token">=</SPAN> <SPAN class="number token">3.5</SPAN>
@Order<SPAN class="punctuation token">(</SPAN><SPAN class="number token">2</SPAN><SPAN class="punctuation token">)</SPAN>
attr floorCount <SPAN class="operator token">=</SPAN> <SPAN class="number token">0</SPAN>
@Order<SPAN class="punctuation token">(</SPAN><SPAN class="number token">3</SPAN><SPAN class="punctuation token">)</SPAN>
attr buildingHeight <SPAN class="operator token">=</SPAN> floorHeight<SPAN class="operator token">*</SPAN>floorCount
@Order<SPAN class="punctuation token">(</SPAN><SPAN class="number token">4</SPAN><SPAN class="punctuation token">)</SPAN> @Hidden
attr testerH <SPAN class="operator token">=</SPAN> floorHeight<SPAN class="operator token">*</SPAN>floorCount
@Order<SPAN class="punctuation token">(</SPAN><SPAN class="number token">5</SPAN><SPAN class="punctuation token">)</SPAN>@Hidden
attr testerF <SPAN class="operator token">=</SPAN> buildingHeight<SPAN class="operator token">/</SPAN>floorHeight
@StartRule
Building <SPAN class="operator token">-</SPAN><SPAN class="operator token">-</SPAN><SPAN class="operator token">></SPAN>
alignScopeToAxes<SPAN class="punctuation token">(</SPAN>y<SPAN class="punctuation token">)</SPAN>
extrude<SPAN class="punctuation token">(</SPAN>buildingHeight<SPAN class="punctuation token">)</SPAN>
split<SPAN class="punctuation token">(</SPAN>y<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">{</SPAN><SPAN class="operator token">~</SPAN>floorHeight<SPAN class="punctuation token">:</SPAN> Legal<SPAN class="punctuation token">}</SPAN><SPAN class="operator token">*</SPAN>
Legal <SPAN class="operator token">-</SPAN><SPAN class="operator token">-</SPAN><SPAN class="operator token">></SPAN>
case inside<SPAN class="punctuation token">:</SPAN> color<SPAN class="punctuation token">(</SPAN>"<SPAN class="comment token">#000fff")</SPAN>
<SPAN class="keyword token">else</SPAN><SPAN class="punctuation token">:</SPAN> color<SPAN class="punctuation token">(</SPAN>"<SPAN class="comment token">#ffff11")</SPAN>
Input
Input <SPAN class="operator token">-</SPAN><SPAN class="operator token">-</SPAN><SPAN class="operator token">></SPAN>
case testerH <SPAN class="operator token">==</SPAN> testerF <SPAN class="punctuation token">:</SPAN> set<SPAN class="punctuation token">(</SPAN>buildingHeight<SPAN class="punctuation token">,</SPAN> testerH<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">else</SPAN><SPAN class="punctuation token">:</SPAN> set <SPAN class="punctuation token">(</SPAN>floorCount<SPAN class="punctuation token">,</SPAN> testerF<SPAN class="punctuation token">)</SPAN>
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>