<?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: Update an attribute from a report in ArcGIS CityEngine Questions</title>
    <link>https://community.esri.com/t5/arcgis-cityengine-questions/update-an-attribute-from-a-report/m-p/648110#M8617</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Export the report and read the values.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 Sep 2017 19:12:48 GMT</pubDate>
    <dc:creator>LR</dc:creator>
    <dc:date>2017-09-11T19:12:48Z</dc:date>
    <item>
      <title>Update an attribute from a report</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/update-an-attribute-from-a-report/m-p/648109#M8616</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been wondering if there is a way to make python update an attribute from a report in CE. I have declared a start value to an attribute, which is used throughout the script, I then want to change this attribute to a number that is reported when the whole script has run, and instead of doing this for a 100 startshapes it would be easier to run a script.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kristian&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Sep 2017 13:06:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/update-an-attribute-from-a-report/m-p/648109#M8616</guid>
      <dc:creator>KristianMortensen1</dc:creator>
      <dc:date>2017-09-11T13:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: Update an attribute from a report</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/update-an-attribute-from-a-report/m-p/648110#M8617</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Export the report and read the values.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Sep 2017 19:12:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/update-an-attribute-from-a-report/m-p/648110#M8617</guid>
      <dc:creator>LR</dc:creator>
      <dc:date>2017-09-11T19:12:48Z</dc:date>
    </item>
    <item>
      <title>Re: Update an attribute from a report</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/update-an-attribute-from-a-report/m-p/648111#M8618</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So there is no way to do it without having to export the report out of CE?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Sep 2017 17:01:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/update-an-attribute-from-a-report/m-p/648111#M8618</guid>
      <dc:creator>KristianMortensen1</dc:creator>
      <dc:date>2017-09-12T17:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: Update an attribute from a report</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/update-an-attribute-from-a-report/m-p/648112#M8619</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;AFAIK no, unless there was some change in the last version. It's annoying but since you're automating it anyway, it shouldn't be a big problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Sep 2017 21:29:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/update-an-attribute-from-a-report/m-p/648112#M8619</guid>
      <dc:creator>LR</dc:creator>
      <dc:date>2017-09-14T21:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: Update an attribute from a report</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/update-an-attribute-from-a-report/m-p/648113#M8620</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You might be able to do this using an extra Python export script similar to what was suggested as Option 2 in this post (but adding an extra step to retrieve the reported value):&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" class="link-titled" href="https://community.esri.com/thread/172315#comment-587903" title="https://community.esri.com/thread/172315#comment-587903" target="_blank"&gt;https://community.esri.com/thread/172315#comment-587903&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1)&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Create an export python script.&amp;nbsp; Right click on the scripts folder -&amp;gt; New -&amp;gt; Python Module -&amp;gt; Select Module:Export (Reporting) and choose a name (e.g. export_script.py).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) In the finishModel() function, add code to retrieve the reported value, set the attribute value, and set the attribute source to USER.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; r = model.getReports()['myReport'][0]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # read value of report (need to report value in cga code)

&amp;nbsp;&amp;nbsp;&amp;nbsp; ce.setAttribute(shape, '/ce/rule/height', r)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # can set attr val like this

&amp;nbsp;&amp;nbsp;&amp;nbsp; ce.setAttributeSource(shape, '/ce/rule/height', 'USER')&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # set source of attr val to user since we changed it and also so we can access it in the other python script that calls this one
‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) In your first python script, add code (lines 4-7 below) to call the export script.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; # get list of selected shapes
&amp;nbsp;&amp;nbsp;&amp;nbsp; shapeList = ce.getObjectsFrom(ce.selection, ce.isShape)

&amp;nbsp;&amp;nbsp;&amp;nbsp; # run export script to set attributes to reported values
&amp;nbsp;&amp;nbsp;&amp;nbsp; expSettings = ScriptExportModelSettings()
&amp;nbsp;&amp;nbsp;&amp;nbsp; expSettings.setScript("export_script.py")
&amp;nbsp;&amp;nbsp;&amp;nbsp; ce.export(shapeList, expSettings)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; for shape in shapeList:

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # print rule attribute
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print(ce.getAttributeSource(shape, '/ce/rule/height'))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print(ce.getAttribute(shape, '/ce/rule/height'))
&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:29:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/update-an-attribute-from-a-report/m-p/648113#M8620</guid>
      <dc:creator>CherylLau</dc:creator>
      <dc:date>2021-12-12T03:29:16Z</dc:date>
    </item>
  </channel>
</rss>

