<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Conditional rule + reporting in ArcGIS CityEngine Questions</title>
    <link>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rule-reporting/m-p/385690#M5310</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Wow it worked! I see, so in this function, we have to define every possibilities included in an else. Thanks, you've saved my life!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 27 Mar 2014 11:34:39 GMT</pubDate>
    <dc:creator>HafidhIhromi</dc:creator>
    <dc:date>2014-03-27T11:34:39Z</dc:date>
    <item>
      <title>Conditional rule + reporting</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rule-reporting/m-p/385688#M5308</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, I am new to this forum. I have been working on my project in urban design/planning using City Engine. I have a problem writing CGA rules, specifically writing conditional rule consisting reporting.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's the code I wrote (this is just basics, the whole codes is too lengthy to show here. But this shows the essential part)&amp;nbsp; :&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;@Range("A","B","C","D","E") attr groundfloorUse = "A"&amp;nbsp; @Range("A","B","C","D","E") attr upperfloorUse = "A"&amp;nbsp; reporting --&amp;gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; case groundfloorUse == "A" : report("F", 1) &amp;nbsp;&amp;nbsp;&amp;nbsp; case groundfloorUse == "B" : report("G", 2) &amp;nbsp;&amp;nbsp;&amp;nbsp; case groundfloorUse == "C" : report("H", 3) &amp;nbsp;&amp;nbsp;&amp;nbsp; case groundfloorUse == "D" : report("I", 4) &amp;nbsp;&amp;nbsp;&amp;nbsp; case groundfloorUse == "E" : report("J", 5) &amp;nbsp;&amp;nbsp;&amp;nbsp; else: reporting2&amp;nbsp; reporting2 --&amp;gt; case upperfloorUse == "A" : report("A", 1) &amp;nbsp;&amp;nbsp;&amp;nbsp; case upperfloorUse == "B" : report("B", 2) &amp;nbsp;&amp;nbsp;&amp;nbsp; case upperfloorUse == "C" : report("C", 3) &amp;nbsp;&amp;nbsp;&amp;nbsp; case upperfloorUse == "D" : report("D", 4) &amp;nbsp;&amp;nbsp;&amp;nbsp; case upperfloorUse == "E" : report("E", 5) &amp;nbsp;&amp;nbsp;&amp;nbsp; else: NIL&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now, the frustation begins.. When I apply that code to a lot, it shows 2 parameters as I wrote on CGA rules (just the way I wanted), but when I apply two different attributes to a lot, it only shows result just from one of them. For example; if I apply a lot's groundfloorUse = "A" and upperfloorUse = "B", the reporting window only shows the result regarding to just one of the attributes instead of showing the result from 2 different attributes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have been trying many things, writing the whole code in one function, separate it into two functions (just like I showed), using ||, and &amp;amp;&amp;amp;. But it didn't work well.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can somebody help me? Any answers is much appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Pardon my English&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Mar 2014 14:14:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rule-reporting/m-p/385688#M5308</guid>
      <dc:creator>HafidhIhromi</dc:creator>
      <dc:date>2014-03-25T14:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional rule + reporting</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rule-reporting/m-p/385689#M5309</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think the problem lies in the logic of the case.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;the first case for groundfloorUse will stop execution and not reach the else&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think you just need the two functions included in a lot call&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;reporting1 --&amp;gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; case groundfloorUse == "A" : report("F", 1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; case groundfloorUse == "B" : report("G", 2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; case groundfloorUse == "C" : report("H", 3)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; case groundfloorUse == "D" : report("I", 4)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else groundfloorUse == "E" : report("J", 5) # or other default&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;reporting2 --&amp;gt; case upperfloorUse == "A" : report("A", 1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; case upperfloorUse == "B" : report("B", 2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; case upperfloorUse == "C" : report("C", 3)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; case upperfloorUse == "D" : report("D", 4)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else upperfloorUse == "E" : report("E", 5) # or other default&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Lot--&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;reporting1 &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;reporting2&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Mar 2014 17:59:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rule-reporting/m-p/385689#M5309</guid>
      <dc:creator>curtedmonds</dc:creator>
      <dc:date>2014-03-25T17:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional rule + reporting</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rule-reporting/m-p/385690#M5310</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Wow it worked! I see, so in this function, we have to define every possibilities included in an else. Thanks, you've saved my life!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Mar 2014 11:34:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rule-reporting/m-p/385690#M5310</guid>
      <dc:creator>HafidhIhromi</dc:creator>
      <dc:date>2014-03-27T11:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional rule + reporting</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rule-reporting/m-p/385691#M5311</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Thanks, you've saved my life!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;No Problem, life saving and making cups of tea are just part of the job.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 29 Mar 2014 16:29:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rule-reporting/m-p/385691#M5311</guid>
      <dc:creator>curtedmonds</dc:creator>
      <dc:date>2014-03-29T16:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional rule + reporting</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rule-reporting/m-p/385692#M5312</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, I've created more complex code using the previous template, works fine. But now I face another problem, here's the rules I make :&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

const far_divider = 1000
const hdens_divider = 100
const junction_count = 5
const crossing_count = 5
const junction_multiplier = 3
const crossing_multiplier = 4

@Range (0,1)
attr envelope_transparency = 0.5

@Range ("living", "commercial", "services", "industrial", "institutional", "recreational", "other", "water")
attr groundfloorUse = "commercial"

@Range ("living", "commercial", "services", "industrial", "institutional", "recreational", "other", "water")
attr upperfloorUse = "living"

@Range(1,2,3,4,5,6,7,8,9,10)
attr groundfloorUse_floorcount = 3

@Range(1,2,3,4,5,6,7,8,9,10)
attr upperfloorUse_floorcount = 3

attr floorheight = 4

@Range (0-20)
attr frontSetback = 0
@Range (0-20)
attr sideStreetback = 0
@Range (0-20)
attr backStreetback = 0

lot --&amp;gt; shape
&amp;nbsp; report ("con", (junction_count * junction_multiplier) + (crossing_count * crossing_multiplier))
&amp;nbsp;&amp;nbsp; report ("ent", 0) #I leave it like this for now
&amp;nbsp; report1
&amp;nbsp; report2
&amp;nbsp; report3

shape --&amp;gt; s('1,0,'1)
 setback(frontSetback) { street.front: NIL | remainder: 
&amp;nbsp; setback(backStreetback) { street.back: NIL | remainder: 
&amp;nbsp;&amp;nbsp;&amp;nbsp; setback(sideStreetback) { street.side: NIL | remainder:
&amp;nbsp;&amp;nbsp;&amp;nbsp; ZoningShell 
&amp;nbsp;&amp;nbsp; }
&amp;nbsp; }
 }&amp;nbsp; 

height = floorheight * ( groundfloorUse_floorcount * upperfloorUse_floorcount )

ZoningShell --&amp;gt; envelope(height, 0, 90)
&amp;nbsp;&amp;nbsp;&amp;nbsp; color

zone1height = floorheight * groundfloorUse_floorcount
zone2height = floorheight * upperfloorUse_floorcount

floor_multiplier = groundfloorUse_floorcount + upperfloorUse_floorcount

#living, commercial, services, industrial, institutional, recreational, other, water

report1 --&amp;gt; case groundfloorUse == "commercial" :
&amp;nbsp;&amp;nbsp; report("far1", (geometry.area(top) * floor_multiplier) / far_divider)
&amp;nbsp;&amp;nbsp; case groundfloorUse == "living" :
&amp;nbsp;&amp;nbsp; report ("hdens1", (geometry.area(top) * floor_multiplier) / hdens_divider)
&amp;nbsp;&amp;nbsp; case groundfloorUse == "services" :
&amp;nbsp;&amp;nbsp; report ("-", 0)
&amp;nbsp;&amp;nbsp; case groundfloorUse == "industrial" :
&amp;nbsp;&amp;nbsp; report ("-", 0)
&amp;nbsp;&amp;nbsp; case groundfloorUse == "institutional" :
&amp;nbsp;&amp;nbsp; report ("-", 0)
&amp;nbsp;&amp;nbsp; case groundfloorUse == "recreational" :
&amp;nbsp;&amp;nbsp; report ("-", 0)
&amp;nbsp;&amp;nbsp; case groundfloorUse == "other" :
&amp;nbsp;&amp;nbsp; report ("-", 0)
&amp;nbsp;&amp;nbsp; else :
&amp;nbsp;&amp;nbsp; report ("-", 0)
&amp;nbsp;&amp;nbsp; 
report2 --&amp;gt; case upperfloorUse == "commercial" :
&amp;nbsp;&amp;nbsp; report("far2", (geometry.area(top) * floor_multiplier) / far_divider)
&amp;nbsp;&amp;nbsp; case upperfloorUse == "living" :
&amp;nbsp;&amp;nbsp; report ("hdens2", (geometry.area(top) * floor_multiplier) / hdens_divider)
&amp;nbsp;&amp;nbsp; case upperfloorUse == "services" :
&amp;nbsp;&amp;nbsp; report ("-", 0)
&amp;nbsp;&amp;nbsp; case upperfloorUse == "industrial" :
&amp;nbsp;&amp;nbsp; report ("-", 0)
&amp;nbsp;&amp;nbsp; case upperfloorUse == "institutional" :
&amp;nbsp;&amp;nbsp; report ("-", 0)
&amp;nbsp;&amp;nbsp; case upperfloorUse == "recreational" :
&amp;nbsp;&amp;nbsp; report ("-", 0)
&amp;nbsp;&amp;nbsp; case upperfloorUse == "other" :
&amp;nbsp;&amp;nbsp; report ("-", 0)
&amp;nbsp;&amp;nbsp; else :
&amp;nbsp;&amp;nbsp; report ("-", 0)&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The idea is, I want to report the walkability index by multiplying these factors : &lt;/SPAN&gt;&lt;STRONG&gt;far&lt;/STRONG&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;STRONG&gt;hdens&lt;/STRONG&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;STRONG&gt;con&lt;/STRONG&gt;&lt;SPAN&gt;, and &lt;/SPAN&gt;&lt;STRONG&gt;ent&lt;/STRONG&gt;&lt;SPAN&gt;. I have no problem reporting far and hdens, until I realize I cant combine the value of far1 and far2, and hdens1 and hdens2 using report (or is it possible combining 2 values on report command?). The reason I 'split' this to far1, far2, hdens1, and hdens2(instead only far and hdens) is based on the previous experiment, I have tried to combine all the report (by not making the differences to calculate groundfloorUse and upperfloorUse) but it didn't work. Actually, I am fully aware that I can make tables on Excel to make it easier, but I want to make this all done in City Engine only, if possible, using Excel is my last resort. Any answer will be appreciated. Thanks in advance&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:44:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rule-reporting/m-p/385692#M5312</guid>
      <dc:creator>HafidhIhromi</dc:creator>
      <dc:date>2021-12-11T17:44:01Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional rule + reporting</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rule-reporting/m-p/385693#M5313</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;And also, how does the 'count' function works? Does it work just the way like in the help files? like this :&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;example.1
 count("cityengine", "e")
 # result = 2
 
example.2
 count("cityengine rocks my world; cityengine should rock yours too", "cityengine")
 # result = 2

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can the 'count' function used to count how many 'crossing' and 'junction' are there in the selection, and then report it? I need this to count the &lt;/SPAN&gt;&lt;STRONG&gt;con&lt;/STRONG&gt;&lt;SPAN&gt; value as I mentioned on my previous post. Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:44:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/conditional-rule-reporting/m-p/385693#M5313</guid>
      <dc:creator>HafidhIhromi</dc:creator>
      <dc:date>2021-12-11T17:44:03Z</dc:date>
    </item>
  </channel>
</rss>

