<?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: ce.getAttribute returns wrong street width in ArcGIS CityEngine Questions</title>
    <link>https://community.esri.com/t5/arcgis-cityengine-questions/ce-getattribute-returns-wrong-street-width/m-p/463688#M6296</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to convert it to a string first using 'str'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Souce_Type = ce.getAttributeSource(..)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if str(Souce_Type) == 'DEFAULT' : &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 8&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if str(Souce_Type) == "USER" : &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return value of getObjectAttr(..) &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Jun 2015 04:19:33 GMT</pubDate>
    <dc:creator>BlakeHarcourt</dc:creator>
    <dc:date>2015-06-17T04:19:33Z</dc:date>
    <item>
      <title>ce.getAttribute returns wrong street width</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/ce-getattribute-returns-wrong-street-width/m-p/463683#M6291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If I use ce.getAttribute to get a street width, it will return a wrong value under these circumstances:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Select a street&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Change the default street width value to something else in the inspector (i.e. 8 to 20 or whatever)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. Change the street width back to "default value" in the inspector &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4. if I use ce.getAttribute after this, it *always* pulls the street width value that I entered as a user value, no matter what the default is. For example, if my default street width is 8, and I changed it as a user value to 16, then selected "use default value" in the inspector (so back to 8), the streetWidth attribute is still reported to me as "16" if I use ce.getAttribute( shape, '/ce/street/streetWidth' ). It does this even after closing and reopening CE! &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any thoughts?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Rob&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 May 2013 21:56:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/ce-getattribute-returns-wrong-street-width/m-p/463683#M6291</guid>
      <dc:creator>RobHoward</dc:creator>
      <dc:date>2013-05-13T21:56:46Z</dc:date>
    </item>
    <item>
      <title>Re: ce.getAttribute returns wrong street width</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/ce-getattribute-returns-wrong-street-width/m-p/463684#M6292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My last post here : &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/82684-Graph-object-export-scripts"&gt;http://forums.arcgis.com/threads/82684-Graph-object-export-scripts&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;answers your question in a slightly different contect.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ok ?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 12:40:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/ce-getattribute-returns-wrong-street-width/m-p/463684#M6292</guid>
      <dc:creator>MatthiasBuehler1</dc:creator>
      <dc:date>2013-05-14T12:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: ce.getAttribute returns wrong street width</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/ce-getattribute-returns-wrong-street-width/m-p/463685#M6293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks, I read that thread and it did make things more clear.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a way to delete the user attr after it is set then? That is, to restore the attribute to its state before the user changed it? Or is the answer to just be careful when using python to pull streetWidth (or other attribute values), in the sense that if a user, in the gui, makes a user attribute and then selects "use default" in the inspector, you are just going to have to live with wrong values? I could definitely see problems down the line with that, especially in a multi-user environment (say you have a person manually adjusting streetWidths, then switching back and forth from default to user). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I suppose one way to handle the issue is to tell users to never set a something back to default!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 15:33:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/ce-getattribute-returns-wrong-street-width/m-p/463685#M6293</guid>
      <dc:creator>RobHoward</dc:creator>
      <dc:date>2013-05-14T15:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: ce.getAttribute returns wrong street width</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/ce-getattribute-returns-wrong-street-width/m-p/463686#M6294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi !&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;There's no way to get rid of that created attribute any more.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The only way to handle this is to create a heuristic which checks the attr SOURCE first.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Means you have to handle the case where the user may have set something once ( thus that value is stored as an attr ), though then goes back to the SOURCE = DEFAULT.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;E.g.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;if ce.getAttributeSource(..) == "DEFAULT" :
&amp;nbsp;&amp;nbsp;&amp;nbsp; return 8 ( or whatever the default is ), return this as hardcoded value
if ce.getAttributeSource(..) == "USER" :
&amp;nbsp;&amp;nbsp;&amp;nbsp; return value of getObjectAttr(..)
..&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ok ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Matt&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:35:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/ce-getattribute-returns-wrong-street-width/m-p/463686#M6294</guid>
      <dc:creator>MatthiasBuehler1</dc:creator>
      <dc:date>2021-12-11T20:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: ce.getAttribute returns wrong street width</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/ce-getattribute-returns-wrong-street-width/m-p/463687#M6295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That seems like a sensible solution, though how do I actually use the result of getAttributeSource to check for Default or&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;User? Unlike most of the other "get" functions that return a STR type that I can easily check, this seems to return a var&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;of type: &amp;lt;type 'com.procedural.ceattribute.ScriptInterfaceAttributes$AttributeSource'&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So when I use "DEFAULT" as the string to check against in the IF statement, it never resolves to true. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yet, when I call print ce.getAttributeSource(...), the correct string DEFAULT or USER prints to the log? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again for your help on this, Matthias. For now, we're just making sure that street segments aren't switched back to default&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from user, but it would be good to have a working failsafe in place. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Rob&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 May 2013 18:26:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/ce-getattribute-returns-wrong-street-width/m-p/463687#M6295</guid>
      <dc:creator>RobHoward</dc:creator>
      <dc:date>2013-05-15T18:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: ce.getAttribute returns wrong street width</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/ce-getattribute-returns-wrong-street-width/m-p/463688#M6296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to convert it to a string first using 'str'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Souce_Type = ce.getAttributeSource(..)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if str(Souce_Type) == 'DEFAULT' : &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 8&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if str(Souce_Type) == "USER" : &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return value of getObjectAttr(..) &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Jun 2015 04:19:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/ce-getattribute-returns-wrong-street-width/m-p/463688#M6296</guid>
      <dc:creator>BlakeHarcourt</dc:creator>
      <dc:date>2015-06-17T04:19:33Z</dc:date>
    </item>
  </channel>
</rss>

