<?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: read from csv file and loop through list  in ArcGIS CityEngine Questions</title>
    <link>https://community.esri.com/t5/arcgis-cityengine-questions/read-from-csv-file-and-loop-through-list/m-p/438048#M5985</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you! I worked this out&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Nov 2017 01:24:21 GMT</pubDate>
    <dc:creator>awei</dc:creator>
    <dc:date>2017-11-10T01:24:21Z</dc:date>
    <item>
      <title>read from csv file and loop through list</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/read-from-csv-file-and-loop-through-list/m-p/438046#M5983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm looking to populate my scene by runtime generating points and assign them with tree objects.&amp;nbsp;A sample&amp;nbsp;tree data looks like this:&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="383030" alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/383030_trees.PNG" style="width: 620px; height: 52px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my first try.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HEIGHT=57.17676&lt;BR /&gt;Init--&amp;gt;&lt;/P&gt;&lt;P&gt;scatter(surface, 20, gaussian) { TREE }&lt;BR /&gt; scatter(surface, 10, gaussian) { TREE }&lt;BR /&gt; scatter(surface, 10, gaussian) { TREE }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TREE --&amp;gt; &lt;BR /&gt; alignScopeToAxes(y) &lt;BR /&gt; s(0,HEIGHT,0) &lt;BR /&gt; i(getAssetPath) &lt;BR /&gt; center(xz) &lt;BR /&gt; Tree.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;getAssetPath = ( "assets/Plants/&lt;SPAN&gt;QuakingAspen&lt;/SPAN&gt;/QuakingAspen_Model_0.obj" )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So as a first step, I would want to have a set of lists&amp;nbsp;(species, height, number of trees etc.),&amp;nbsp;so that my TREE function and scatter function can loop through all of them, unlike above, where I manually type in each entry. Because I have thousands of entries like this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And the ultimate goal is to directly read the csv file. I went through 3D vegetation with lumenRT rules,&amp;nbsp;&lt;A class="link-titled" href="https://www.arcgis.com/home/item.html?id=0fd3bbe496c14844968011332f9f39b7" title="https://www.arcgis.com/home/item.html?id=0fd3bbe496c14844968011332f9f39b7"&gt;https://www.arcgis.com/home/item.html?id=0fd3bbe496c14844968011332f9f39b7&lt;/A&gt;, and&amp;nbsp;seems they just typed in all the species name, height, etc to the cga files, so I have no idea how to do this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help with the following two steps is much appreciated!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@&lt;A _jive_internal="true" data-containerid="-1" data-containertype="-1" data-objectid="35348" data-objecttype="3" href="https://community.esri.com/people/CWilkins-esristaff" style="color: #287433; background-color: #ffffff; border: 0px; padding: 1px 0px 1px calc(12px + 0.35ex);"&gt;Chris Wilkins&lt;/A&gt;&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A _jive_internal="true" data-containerid="-1" data-containertype="-1" data-objectid="40123" data-objecttype="3" href="https://community.esri.com/people/BPatrick-esristaff" style="color: #287433; background-color: #ffffff; border: 0px; padding: 1px 0px 1px calc(12px + 0.35ex);"&gt;Brooks Patrick&lt;/A&gt;&lt;SPAN style="background-color: #ffffff;"&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;A _jive_internal="true" data-containerid="-1" data-containertype="-1" data-objectid="3171" data-objecttype="3" href="https://community.esri.com/people/GvanMaren-esristaff" style="color: #287433; background-color: #ffffff; border: 0px; padding: 1px 0px 1px calc(12px + 0.35ex);"&gt;Gert Van Maren&lt;/A&gt;&lt;SPAN style="background-color: #ffffff;"&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;A _jive_internal="true" data-containerid="-1" data-containertype="-1" data-objectid="170932" data-objecttype="3" href="https://community.esri.com/people/TFuchs-esristaff" style="color: #287433; background-color: #ffffff; border: 0px; padding: 1px 0px 1px calc(12px + 0.35ex);"&gt;Thomas Fuchs&lt;/A&gt;&lt;SPAN style="background-color: #ffffff;"&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;A _jive_internal="true" data-containerid="-1" data-containertype="-1" data-objectid="172220" data-objecttype="3" href="https://community.esri.com/people/CLau-esristaff" style="color: #287433; background-color: #ffffff; border: 0px; padding: 1px 0px 1px calc(12px + 0.35ex);"&gt;Cheryl Lau&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Nov 2017 23:12:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/read-from-csv-file-and-loop-through-list/m-p/438046#M5983</guid>
      <dc:creator>awei</dc:creator>
      <dc:date>2017-11-08T23:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: read from csv file and loop through list</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/read-from-csv-file-and-loop-through-list/m-p/438047#M5984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, there is no function in cga to read a csv file.&amp;nbsp; One workaround would be to write a python script that reads your data file and writes cga string lists.&amp;nbsp; Then, you access your data in cga using the cga string list functions.&amp;nbsp; If you only need to do this once (i.e. your data won't change), instead of a Python script, you can also manually reformat each column&amp;nbsp;of your data into the cga string list format using a bunch of find/replace operations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From the cga help page:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background-color: #ffffff; font-size: 14.4px;"&gt;Stringlists are a series of strings stored inside one string. The elements are separated by a semicolon (";"). The data type is "string", thus it is not any real type of array as used in other scripting languages.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;The functions listItem() and listIndex() and listSize() are probably useful in accessing the data in a list.&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://cehelp.esri.com/help/topic/com.procedural.cityengine.help/html/cgareference/celib/listItem.html" title="http://cehelp.esri.com/help/topic/com.procedural.cityengine.help/html/cgareference/celib/listItem.html"&gt;listItem&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://cehelp.esri.com/help/topic/com.procedural.cityengine.help/html/cgareference/celib/listIndex.html" title="http://cehelp.esri.com/help/topic/com.procedural.cityengine.help/html/cgareference/celib/listIndex.html"&gt;listIndex&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://cehelp.esri.com/help/topic/com.procedural.cityengine.help/html/cgareference/celib/listSize.html" title="http://cehelp.esri.com/help/topic/com.procedural.cityengine.help/html/cgareference/celib/listSize.html"&gt;listSize&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Nov 2017 11:58:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/read-from-csv-file-and-loop-through-list/m-p/438047#M5984</guid>
      <dc:creator>CherylLau</dc:creator>
      <dc:date>2017-11-09T11:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: read from csv file and loop through list</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/read-from-csv-file-and-loop-through-list/m-p/438048#M5985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you! I worked this out&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Nov 2017 01:24:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/read-from-csv-file-and-loop-through-list/m-p/438048#M5985</guid>
      <dc:creator>awei</dc:creator>
      <dc:date>2017-11-10T01:24:21Z</dc:date>
    </item>
  </channel>
</rss>

