<?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: Ability to use conditional command  (case and else) in @Range annotaion in ArcGIS CityEngine Questions</title>
    <link>https://community.esri.com/t5/arcgis-cityengine-questions/ability-to-use-conditional-command-case-and-else/m-p/1037831#M10135</link>
    <description>&lt;P&gt;I wonder if you could use an table lookup/array initialization on your "subtypes" to do something like this?&lt;/P&gt;&lt;P&gt;&lt;A href="https://doc.arcgis.com/en/cityengine/latest/tutorials/tutorial-21-csv-import.htm" target="_blank" rel="noopener"&gt;Tutorial 21: CSV import—ArcGIS CityEngine Resources | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Maybe it could do a first row lookup [A,B,C] from your types, and report back rows [2,3,4] (first row is A, second row 2 is A1, etc.) for values?&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;I couldn't figure out a way to use conditional statements with attributes either.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Mar 2021 21:21:08 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2021-03-17T21:21:08Z</dc:date>
    <item>
      <title>Ability to use conditional command  (case and else) in @Range annotaion</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/ability-to-use-conditional-command-case-and-else/m-p/1036445#M10125</link>
      <description>&lt;P&gt;Hi, is there a way to do this when i select an option from the Scenario_Type attribute then only its subset appears in the SubScenario_Type attribute.In other words when i select A in Scenario_Type attribute Only appear A1 ,A2,A3 in SubScenario_Type attribute . also for B and C&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;@Range("A","B","C")&lt;BR /&gt;attr Scenario_Type ="A"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;@Range("A1","A2","A3","B1","B2","B3","C1","C2","C3")&lt;BR /&gt;attr SubScenario_Type =""&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Parcel--&amp;gt;&lt;BR /&gt;extrude(rand(5,25))&lt;BR /&gt;Building&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Building --&amp;gt;&lt;BR /&gt;case Scenario_Type =="A" :&lt;BR /&gt;case SubScenario_Type =="A1" :&lt;BR /&gt;color(1,0,0)&lt;BR /&gt;case SubScenario_Type =="A2" :&lt;BR /&gt;color(0.5,0,0)&lt;BR /&gt;else :&lt;BR /&gt;color(0.3,0,0)&lt;BR /&gt;&lt;BR /&gt;case Scenario_Type =="B" :&lt;BR /&gt;case SubScenario_Type =="B1" :&lt;BR /&gt;color(1,1,0)&lt;BR /&gt;case SubScenario_Type =="B2" :&lt;BR /&gt;color(1,0.4,0)&lt;BR /&gt;else :&lt;BR /&gt;color(1,0.6,1)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;else :&lt;BR /&gt;&lt;BR /&gt;case SubScenario_Type =="C1" :&lt;BR /&gt;color(0,1,0)&lt;BR /&gt;case SubScenario_Type =="C2" :&lt;BR /&gt;color(0,0.5,0)&lt;BR /&gt;else :&lt;BR /&gt;color(0,0.3,0)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#-----------------------------------------------------------&lt;/P&gt;&lt;P&gt;for example :&lt;BR /&gt;#---&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;@Range("A","B","C")&lt;BR /&gt;attr Scenario_Type ="A"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;@Range(case Scenario_Type =="A" :"A1;A2;A3" case Scenario_Type =="B" :"B1;B2;B3" else :"C1;C2;C3" )&lt;BR /&gt;attr SubScenario_Type =""&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Parcel--&amp;gt;&lt;BR /&gt;extrude(rand(5,25))&lt;BR /&gt;Building&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Building --&amp;gt;&lt;BR /&gt;case Scenario_Type =="A" :&lt;BR /&gt;case SubScenario_Type =="A1" :&lt;BR /&gt;color(1,0,0)&lt;BR /&gt;case SubScenario_Type =="A2" :&lt;BR /&gt;color(0.5,0,0)&lt;BR /&gt;else :&lt;BR /&gt;color(0.3,0,0)&lt;BR /&gt;&lt;BR /&gt;case Scenario_Type =="B" :&lt;BR /&gt;case SubScenario_Type =="B1" :&lt;BR /&gt;color(1,1,0)&lt;BR /&gt;case SubScenario_Type =="B2" :&lt;BR /&gt;color(1,0.4,0)&lt;BR /&gt;else :&lt;BR /&gt;color(1,0.6,1)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;else :&lt;BR /&gt;&lt;BR /&gt;case SubScenario_Type =="C1" :&lt;BR /&gt;color(0,1,0)&lt;BR /&gt;case SubScenario_Type =="C2" :&lt;BR /&gt;color(0,0.5,0)&lt;BR /&gt;else :&lt;BR /&gt;color(0,0.3,0)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Mar 2021 03:13:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/ability-to-use-conditional-command-case-and-else/m-p/1036445#M10125</guid>
      <dc:creator>maziaryousefi</dc:creator>
      <dc:date>2021-03-15T03:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: Ability to use conditional command  (case and else) in @Range annotaion</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/ability-to-use-conditional-command-case-and-else/m-p/1037831#M10135</link>
      <description>&lt;P&gt;I wonder if you could use an table lookup/array initialization on your "subtypes" to do something like this?&lt;/P&gt;&lt;P&gt;&lt;A href="https://doc.arcgis.com/en/cityengine/latest/tutorials/tutorial-21-csv-import.htm" target="_blank" rel="noopener"&gt;Tutorial 21: CSV import—ArcGIS CityEngine Resources | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Maybe it could do a first row lookup [A,B,C] from your types, and report back rows [2,3,4] (first row is A, second row 2 is A1, etc.) for values?&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;I couldn't figure out a way to use conditional statements with attributes either.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Mar 2021 21:21:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/ability-to-use-conditional-command-case-and-else/m-p/1037831#M10135</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-03-17T21:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Ability to use conditional command  (case and else) in @Range annotaion</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/ability-to-use-conditional-command-case-and-else/m-p/1037895#M10136</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/462107"&gt;@maziaryousefi&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Turns out you can use arrays to limit what is shown in the attribute function.&amp;nbsp; Look at this code to see how it is done.&amp;nbsp; I would be glad to answer further questions.&amp;nbsp; &amp;nbsp;But that doesn't preclude that maybe there is a way that you can use&amp;nbsp; conditional statements.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;version "2020.1"

const Types_filename = "data/TypesAttr.csv"
const Types_data = readStringTable(Types_filename)
const rowLookup = nRows(Types_data)
const colLookup = nColumns(Types_data)

## Hidden Attributes

@Hidden
attr ScenarioType = Types_data[0,0:colLookup-1]
@Hidden
attr ColumnIndex = float(findFirst(ScenarioType,TypeAssign))
@Hidden
attr getSubType = Types_data[1:rowLookup-1,ColumnIndex]  //You could unhide this to expose the array for modification

## Exposed Attributes

@Order(1) @Enum(valuesAttr=ScenarioType)
attr TypeAssign = "unassigned"	

@Order(2) @Enum(valuesAttr=getSubType)
attr SubType = ""	


###########################################################

@StartRule
Start--&amp;gt;
	extrude(3)
	Building
	
Building--&amp;gt;
	case SubType == "R1": 	color(1,0,0,1) 
	case SubType == "R2":  color(1,0,0,.5) 
	case SubType == "R3":  color(1,0,0,.1) 
	case SubType == "MU1" :	color(0.5,0,1,1)
	case SubType == "MU2" :	color(0.5,0,1,.5)
	case SubType == "MU3" :	color(0.5,0,1,.1)
	case SubType == "H1" :	color(1,1,0,1)
	case SubType == "H2" :	color(1,1,0,.5)
	case SubType == "H3" :	color(1,1,0,.1)
	else :	NIL	&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is how my table was designed to make this work.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Table Design" style="width: 275px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/8741iF7EA55B631A7162F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Table.PNG" alt="Table Design" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Table Design&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;You'll have to save your table as .csv and localize your filepath to the code.&amp;nbsp; &amp;nbsp;Note that my headers go across the top, and trying to transpose your table would require a different CGA code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 01:33:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/ability-to-use-conditional-command-case-and-else/m-p/1037895#M10136</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-03-18T01:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: Ability to use conditional command  (case and else) in @Range annotaion</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/ability-to-use-conditional-command-case-and-else/m-p/1037941#M10139</link>
      <description>&lt;P&gt;Hello Brian Wamsley .thanks for your replay&amp;nbsp;&lt;/P&gt;&lt;P&gt;. It's a good idea- can you send me the excel file? I save the excel file in csv format but when using the excel file in the rule file, the options inside the excel file do not appear in the attribute in the inspector&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 09:28:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/ability-to-use-conditional-command-case-and-else/m-p/1037941#M10139</guid>
      <dc:creator>maziaryousefi</dc:creator>
      <dc:date>2021-03-18T09:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: Ability to use conditional command  (case and else) in @Range annotaion</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/ability-to-use-conditional-command-case-and-else/m-p/1038011#M10141</link>
      <description>&lt;P&gt;The .csv file is pretty simple, what you see in that image is all.&amp;nbsp; So if your not seeing the options you will need to make sure that the filepath is localized to your folder structure.&amp;nbsp; &amp;nbsp;A simple drag and drop of the csv should do the trick.&amp;nbsp; I saved my csv in the project/data folder, yours might be different.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Mar 2021 13:28:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/ability-to-use-conditional-command-case-and-else/m-p/1038011#M10141</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-03-18T13:28:35Z</dc:date>
    </item>
    <item>
      <title>Re: Ability to use conditional command  (case and else) in @Range annotaion</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/ability-to-use-conditional-command-case-and-else/m-p/1062474#M10164</link>
      <description>&lt;P&gt;Brian is right, using &lt;FONT face="courier new,courier"&gt;valuesAttr&lt;/FONT&gt; in an &lt;FONT face="courier new,courier"&gt;Enum&lt;/FONT&gt; is the way to do this.&amp;nbsp; You don't necessarily need a csv file if you want to hard code it, but maybe the csv file makes it easier for you to extend.&amp;nbsp; It depends on your needs.&lt;/P&gt;&lt;P&gt;Here's a simple version with hard coded values in a case statement.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;@Enum("A", "B", "C")
attr type = "A"

@Enum(valuesAttr=subtypeValues)
attr subtype = subtypeValues[0]

@Hidden
attr subtypeValues =
	case type=="A":		["A1", "A2", "A3"]
	case type=="B":		["B1", "B2", "B3"]
	else:				["C1", "C2", "C3"]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Instead of a case statement, you could also make it more extendable for the future, for example, by putting all the possible subtype values in an array and then creating the &lt;FONT face="courier new,courier"&gt;subtypeValues&lt;/FONT&gt; array by only choosing those values from the big list that begin with &lt;FONT face="courier new,courier"&gt;type&lt;/FONT&gt;.&amp;nbsp; Again, not sure this strategy would work for you; it depends what values you have and what your needs are.&lt;/P&gt;</description>
      <pubDate>Thu, 27 May 2021 17:56:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/ability-to-use-conditional-command-case-and-else/m-p/1062474#M10164</guid>
      <dc:creator>CherylLau</dc:creator>
      <dc:date>2021-05-27T17:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: Ability to use conditional command  (case and else) in @Range annotaion</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/ability-to-use-conditional-command-case-and-else/m-p/1082437#M10216</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;CherylLau &lt;/SPAN&gt;&lt;SPAN class="UserName lia-user-name lia-user-rank-Esri-Regular-Contributor lia-component-message-view-widget-author-username"&gt;&lt;SPAN&gt;&amp;nbsp;. very thanks for your answer . very good .&amp;nbsp;Is this method applicable to numeric attributes as well?&amp;nbsp;For example, a numeric attribute to control three other attributes, such as building window width, window length, and window depth.That is, when we select the window width option in the building window attribute, we control the window width through a numeric attribute, and then select the window height option and change the window height value without changing the window width and depth numbers.&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Jul 2021 09:08:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/ability-to-use-conditional-command-case-and-else/m-p/1082437#M10216</guid>
      <dc:creator>Hadi_yousefi</dc:creator>
      <dc:date>2021-07-24T09:08:58Z</dc:date>
    </item>
    <item>
      <title>Re: Ability to use conditional command  (case and else) in @Range annotaion</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/ability-to-use-conditional-command-case-and-else/m-p/1083122#M10224</link>
      <description>&lt;P&gt;Sorry, I don't understand what you mean.&lt;/P&gt;&lt;P&gt;It is possible to have separate attributes for window width, height, and depth, and changing one of them will not affect the others.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;attr window_width = 1
attr window_height = 2
attr window_depth = 0.5&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But, I don't think this answers your question.&amp;nbsp; I don't understand what attributes you want and what behavior you want (i.e. what you want to appear in the drop down box for each attribute).&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 16:30:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/ability-to-use-conditional-command-case-and-else/m-p/1083122#M10224</guid>
      <dc:creator>CherylLau</dc:creator>
      <dc:date>2021-07-27T16:30:47Z</dc:date>
    </item>
    <item>
      <title>Re: Ability to use conditional command  (case and else) in @Range annotaion</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/ability-to-use-conditional-command-case-and-else/m-p/1084709#M10229</link>
      <description>&lt;P&gt;Hello dear CheryILau . very thanks for your answer.&amp;nbsp;In order to be able to control the dimensions of width, depth, height separately through the dimension_control attribute, so that by changing the dimensions of each option in dimension_control attribute, the value of other options in dimension_control attribute does not change .Instead of using three attributes of width, depth and height in inspector separately, use only one attribute to control them.Is this possible? If this method can be done, the inspector will no longer be crowded due to too many attributes&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="5664.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/19846iD8BC9580CABFA025/image-size/large?v=v2&amp;amp;px=999" role="button" title="5664.png" alt="5664.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="010.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/19844iF59EEFC251148179/image-size/large?v=v2&amp;amp;px=999" role="button" title="010.png" alt="010.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="020.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/19845i69B548A19CE020AE/image-size/large?v=v2&amp;amp;px=999" role="button" title="020.png" alt="020.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 31 Jul 2021 16:20:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/ability-to-use-conditional-command-case-and-else/m-p/1084709#M10229</guid>
      <dc:creator>Hadi_yousefi</dc:creator>
      <dc:date>2021-07-31T16:20:40Z</dc:date>
    </item>
    <item>
      <title>Re: Ability to use conditional command  (case and else) in @Range annotaion</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/ability-to-use-conditional-command-case-and-else/m-p/1084854#M10231</link>
      <description>&lt;P&gt;If your goal is to manage the attribute space, consider using the&amp;nbsp;@Group and&amp;nbsp;@Order function to make it more visual intuitive.&amp;nbsp; &amp;nbsp;You can also create a new code and call that it into an existing code and that code will have an "accordion" drop-down, which can be a strategy to save space.&amp;nbsp; If your trying to have one attribute control width, depth, height, your going to overwrite the other two attributes each time.&amp;nbsp; You could use a table for this but it would be more complicated than its worth, in my opinion.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 12:02:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/ability-to-use-conditional-command-case-and-else/m-p/1084854#M10231</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-08-02T12:02:16Z</dc:date>
    </item>
    <item>
      <title>Re: Ability to use conditional command  (case and else) in @Range annotaion</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/ability-to-use-conditional-command-case-and-else/m-p/1086087#M10240</link>
      <description>&lt;P&gt;dear&amp;nbsp;BrianWamsley thank you very much for your helpful answer&lt;/P&gt;</description>
      <pubDate>Thu, 05 Aug 2021 10:23:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/ability-to-use-conditional-command-case-and-else/m-p/1086087#M10240</guid>
      <dc:creator>Hadi_yousefi</dc:creator>
      <dc:date>2021-08-05T10:23:44Z</dc:date>
    </item>
  </channel>
</rss>

