<?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 Select Streets or Sidewalks based on width in ArcGIS CityEngine Questions</title>
    <link>https://community.esri.com/t5/arcgis-cityengine-questions/select-streets-or-sidewalks-based-on-width/m-p/1189312#M10566</link>
    <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm hoping this one is relatively straightforward - I've looked through documentation and articles but couldn't quite find an answer.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I'm looking to automatically select streets or sidewalks based on their widths (actually, within a certain range of widths), so I can apply certain attributes using the complete streets rules.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This seems like a job for a python script?&lt;BR /&gt;&lt;BR /&gt;Wondering if any has any suggestions for this.&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
    <pubDate>Tue, 05 Jul 2022 09:22:15 GMT</pubDate>
    <dc:creator>MattOlsen</dc:creator>
    <dc:date>2022-07-05T09:22:15Z</dc:date>
    <item>
      <title>Select Streets or Sidewalks based on width</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/select-streets-or-sidewalks-based-on-width/m-p/1189312#M10566</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm hoping this one is relatively straightforward - I've looked through documentation and articles but couldn't quite find an answer.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I'm looking to automatically select streets or sidewalks based on their widths (actually, within a certain range of widths), so I can apply certain attributes using the complete streets rules.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This seems like a job for a python script?&lt;BR /&gt;&lt;BR /&gt;Wondering if any has any suggestions for this.&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2022 09:22:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/select-streets-or-sidewalks-based-on-width/m-p/1189312#M10566</guid>
      <dc:creator>MattOlsen</dc:creator>
      <dc:date>2022-07-05T09:22:15Z</dc:date>
    </item>
    <item>
      <title>Re: Select Streets or Sidewalks based on width</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/select-streets-or-sidewalks-based-on-width/m-p/1189725#M10569</link>
      <description>&lt;P&gt;Hi Matt,&lt;/P&gt;&lt;P&gt;hereunder a python script to select graph segments by streetWidth attribute, just replace the min and max values (without quotes) in the last line by your desired range values:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;'''
Created on 06 Jul 2022
@author: PFontes
'''
from scripting import *

# get a CityEngine instance
ce = CE()

def selectByAttribute(attr, minValue, maxValue):
    objects = ce.getObjectsFrom(ce.scene, ce.isGraphSegment)
    selection = []
    
    for item in objects:
        attribute = ce.getAttribute(item, attr)
        if attribute &amp;gt;=  minValue and attribute &amp;lt;= maxValue:
                selection.append(item)
        
    ce.setSelection(selection)

if __name__ == '__main__':
    selectByAttribute("/ce/street/streetWidth", "(minimum value inclusive)", "(maximum value inclusive)")&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;Hope this is what you're looking for.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 10:18:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/select-streets-or-sidewalks-based-on-width/m-p/1189725#M10569</guid>
      <dc:creator>plfontes</dc:creator>
      <dc:date>2022-07-06T10:18:13Z</dc:date>
    </item>
    <item>
      <title>Re: Select Streets or Sidewalks based on width</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/select-streets-or-sidewalks-based-on-width/m-p/1189741#M10570</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/488390"&gt;@plfontes&lt;/a&gt;&amp;nbsp;- thank you for the quick response on this. This does look like what I'm looking for, however it isn't currently working so I think I'm missing a step somewhere along the way..&lt;/P&gt;&lt;P&gt;I've created a new python module (with your code), in the same cityengine project as the scene file - for testing's sake I've tried very large values (0 to 1500) and smaller ones (0 to 15).&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run the script (Python &amp;gt; Run Script?), no streets are selected. In the screenshot below I've manually selected one of the streets with a width of 10, so this should in theory be selected by the script.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MattOlsen_0-1657099151736.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/45262iE4FED540A3A2CA87/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MattOlsen_0-1657099151736.png" alt="MattOlsen_0-1657099151736.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you see any steps I've missed here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 09:23:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/select-streets-or-sidewalks-based-on-width/m-p/1189741#M10570</guid>
      <dc:creator>MattOlsen</dc:creator>
      <dc:date>2022-07-06T09:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: Select Streets or Sidewalks based on width</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/select-streets-or-sidewalks-based-on-width/m-p/1189742#M10571</link>
      <description>&lt;P&gt;Yes, my bad.&lt;/P&gt;&lt;P&gt;just include a "/" at the beginning of the attribute name in the last line to look like this "/ce/street/streetWidth"&lt;/P&gt;&lt;P&gt;Should work now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 09:35:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/select-streets-or-sidewalks-based-on-width/m-p/1189742#M10571</guid>
      <dc:creator>plfontes</dc:creator>
      <dc:date>2022-07-06T09:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: Select Streets or Sidewalks based on width</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/select-streets-or-sidewalks-based-on-width/m-p/1189746#M10572</link>
      <description>&lt;P&gt;Works like a charm. Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 10:12:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/select-streets-or-sidewalks-based-on-width/m-p/1189746#M10572</guid>
      <dc:creator>MattOlsen</dc:creator>
      <dc:date>2022-07-06T10:12:33Z</dc:date>
    </item>
  </channel>
</rss>

