<?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: Selecting within a selection in ArcGIS CityEngine Questions</title>
    <link>https://community.esri.com/t5/arcgis-cityengine-questions/selecting-within-a-selection/m-p/1542370#M11462</link>
    <description>&lt;P&gt;To follow up on this, I recorded a quick video to showcase the workflow:&lt;/P&gt;
&lt;P&gt;&lt;div class="lia-vid-container video-embed-center"&gt;&lt;div id="lia-vid-6362428984112w994h540r334" class="lia-video-brightcove-player-container"&gt;&lt;video-js data-video-id="6362428984112" data-account="6161463677001" data-player="default" data-embed="default" class="vjs-fluid" controls="" data-application-id="" style="width: 100%; height: 100%;"&gt;&lt;/video-js&gt;&lt;/div&gt;&lt;script src="https://players.brightcove.net/6161463677001/default_default/index.min.js"&gt;&lt;/script&gt;&lt;script&gt;(function() {  var wrapper = document.getElementById('lia-vid-6362428984112w994h540r334');  var videoEl = wrapper ? wrapper.querySelector('video-js') : null;  if (videoEl) {     if (window.videojs) {       window.videojs(videoEl).ready(function() {         this.on('loadedmetadata', function() {           this.el().querySelectorAll('.vjs-load-progress div[data-start]').forEach(function(bar) {             bar.setAttribute('role', 'presentation');             bar.setAttribute('aria-hidden', 'true');           });         });       });     }  }})();&lt;/script&gt;&lt;a class="video-embed-link" href="https://community.esri.com/t5/video/gallerypage/video-id/6362428984112"&gt;(view in My Videos)&lt;/a&gt;&lt;/div&gt;&lt;/P&gt;
&lt;P&gt;Additional resources:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://doc.arcgis.com/en/cityengine/2024.0/cga/cga-context-queries.htm" target="_self"&gt;Context and occlusion queries—ArcGIS CityEngine Resources | Documentation &lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://doc.arcgis.com/en/cityengine/latest/cga/cga-inside-function.htm" target="_self"&gt;inside / overlaps / touches function (occlusion queries)—ArcGIS CityEngine Resources | Documentation &lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://doc.arcgis.com/en/cityengine/latest/python/python-script-based-export.htm" target="_self"&gt;Script-based export—ArcGIS CityEngine Resources | Documentation &lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;</description>
    <pubDate>Wed, 25 Sep 2024 09:11:19 GMT</pubDate>
    <dc:creator>JonasObertuefer</dc:creator>
    <dc:date>2024-09-25T09:11:19Z</dc:date>
    <item>
      <title>Selecting within a selection</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/selecting-within-a-selection/m-p/1539926#M11452</link>
      <description>&lt;P&gt;I have a file with land use and building footprints. I have gotten to the point in python of selecting all the land use shps from the object attributes. In this picture:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MonicaClayton_0-1726665109527.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/115369i1BCAEF0A8892217E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MonicaClayton_0-1726665109527.png" alt="MonicaClayton_0-1726665109527.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have written code that has selected everything tagged as residential in the object attributes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def selectByAttribute(attr, value):
    shapes = getObjectsFrom(ce.scene)
    selection = []
    for s in shapes:
        attrvalue = ce.getAttribute(s, attr)
        if attrvalue  ==  value:
            selection.append(s)
        
    ce.setSelection(selection)

if __name__ == '__main__':
    selectByAttribute("landuse","residential")
    pass&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question then becomes, how do I select the footprints within those already selected polygons, and nothing else? This is where I have gotten stuck.&lt;/P&gt;&lt;P&gt;Please help? And help me like I have no coding knowledge what so ever. I have an art degree, and the above took me almost 2 days to figure out.&lt;/P&gt;&lt;P&gt;Thanks in advance!!!!&lt;/P&gt;&lt;P&gt;Monica&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: Essentially, I would like to "Select by Location" like I would in ArcPRO. Which, would be a nice feature to have in general.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2024 16:05:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/selecting-within-a-selection/m-p/1539926#M11452</guid>
      <dc:creator>MonicaClayton</dc:creator>
      <dc:date>2024-09-18T16:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting within a selection</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/selecting-within-a-selection/m-p/1540234#M11453</link>
      <description>&lt;P&gt;I have referred to the link below.&lt;/P&gt;&lt;H2&gt;&lt;A href="https://doc.arcgis.com/en/cityengine/2023.1/python/ce.htm#ESRI_SECTION1_0C4CC2D98D3F45B181A70830F63F2966" target="_self"&gt;getObjectsFrom&lt;/A&gt;&lt;/H2&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="desert_1-1726716844128.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/115419iB6ED4644360B27BC/image-size/large?v=v2&amp;amp;px=999" role="button" title="desert_1-1726716844128.png" alt="desert_1-1726716844128.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;change&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;shapes = getObjectsFrom(ce.scene)&lt;/LI-CODE&gt;&lt;P&gt;to&lt;/P&gt;&lt;LI-CODE lang="python"&gt;shapes = getObjectsFrom(ce.selection, ce.isShape)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2024 03:39:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/selecting-within-a-selection/m-p/1540234#M11453</guid>
      <dc:creator>desert</dc:creator>
      <dc:date>2024-09-19T03:39:51Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting within a selection</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/selecting-within-a-selection/m-p/1542005#M11455</link>
      <description>&lt;P&gt;I did, and it gave me the same results. I want to select the footprints that are within the already selected land use polygons. Like my edit, a "Select by Location" option and the location being within my already selected polygons. Is this possible? There isn't any specific or differentiating attribute on the footprints that I can use to pick them out, the only thing they all have in common is the fact they are within a polygon tagged as "landuse, residential".&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the help!!&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2024 15:57:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/selecting-within-a-selection/m-p/1542005#M11455</guid>
      <dc:creator>MonicaClayton</dc:creator>
      <dc:date>2024-09-24T15:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting within a selection</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/selecting-within-a-selection/m-p/1542015#M11456</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/167876"&gt;@MonicaClayton&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;There is way to do this in CityEngine although it is a rather complex workflow:&lt;/P&gt;
&lt;P&gt;Asumming you have the landuse and footprint shapes in a different shape layer&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Select all landuse shapes&lt;/LI&gt;
&lt;LI&gt;Apply &amp;amp; Generate the following CGA on them:&lt;BR /&gt;&lt;LI-CODE lang="c"&gt;attr landuse = "residential"

Lot --&amp;gt; 
	t(0,-5,0)  
	extrude(10)
	label(landuse)
	color(1,0,0.5)​&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Connect the object attribute to the landuse attribute in the Inspector, if they are not automatically connected&lt;/LI&gt;
&lt;LI&gt;Select all footprints and assign&amp;amp;generate the following CGA onto them:&lt;BR /&gt;&lt;LI-CODE lang="c"&gt;Lot --&amp;gt;
	contextCheck

contextCheck --&amp;gt;
	case inside(inter, "residential") : 
		color(1,0,1) 
		report("landuse", "residential") 
		extrude(15)
	// add more cases for all usages
	else: extrude(15)​&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Add a new python file to the Scripts folder of the project&lt;BR /&gt;&lt;LI-CODE lang="python"&gt;from scripting import *

# Get a CityEngine instance
ce = CE()
    
# Called for each shape after generation.
def finishModel(exportContextOID, shapeOID, modelOID):
    ctx = ScriptExportModelSettings(exportContextOID)
    shape = Shape(shapeOID)
    model = Model(modelOID)
    
    reports = model.getReports()
    if 'landuse' in reports:
        ce.setAttribute(shape, "landuse", reports['landuse'][0])​&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;With the footprints still selected go to File -&amp;gt; Export -&amp;gt; Script Based Export (Python). Select the previously created python script and click on Finish&lt;/LI&gt;
&lt;LI&gt;All footprints inside a landuse shape will have a new landuse object attribute with the value of their respective surrounding landuse shape.&lt;/LI&gt;
&lt;LI&gt;Select them using your python script from above&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;I hope this is what you want to achieve. Let me know if you have any questions!&lt;/P&gt;
&lt;P&gt;Cheers&lt;BR /&gt;Jonas&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2024 16:09:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/selecting-within-a-selection/m-p/1542015#M11456</guid>
      <dc:creator>JonasObertuefer</dc:creator>
      <dc:date>2024-09-24T16:09:21Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting within a selection</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/selecting-within-a-selection/m-p/1542370#M11462</link>
      <description>&lt;P&gt;To follow up on this, I recorded a quick video to showcase the workflow:&lt;/P&gt;
&lt;P&gt;&lt;div class="lia-vid-container video-embed-center"&gt;&lt;div id="lia-vid-6362428984112w994h540r22" class="lia-video-brightcove-player-container"&gt;&lt;video-js data-video-id="6362428984112" data-account="6161463677001" data-player="default" data-embed="default" class="vjs-fluid" controls="" data-application-id="" style="width: 100%; height: 100%;"&gt;&lt;/video-js&gt;&lt;/div&gt;&lt;script src="https://players.brightcove.net/6161463677001/default_default/index.min.js"&gt;&lt;/script&gt;&lt;script&gt;(function() {  var wrapper = document.getElementById('lia-vid-6362428984112w994h540r22');  var videoEl = wrapper ? wrapper.querySelector('video-js') : null;  if (videoEl) {     if (window.videojs) {       window.videojs(videoEl).ready(function() {         this.on('loadedmetadata', function() {           this.el().querySelectorAll('.vjs-load-progress div[data-start]').forEach(function(bar) {             bar.setAttribute('role', 'presentation');             bar.setAttribute('aria-hidden', 'true');           });         });       });     }  }})();&lt;/script&gt;&lt;a class="video-embed-link" href="https://community.esri.com/t5/video/gallerypage/video-id/6362428984112"&gt;(view in My Videos)&lt;/a&gt;&lt;/div&gt;&lt;/P&gt;
&lt;P&gt;Additional resources:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://doc.arcgis.com/en/cityengine/2024.0/cga/cga-context-queries.htm" target="_self"&gt;Context and occlusion queries—ArcGIS CityEngine Resources | Documentation &lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://doc.arcgis.com/en/cityengine/latest/cga/cga-inside-function.htm" target="_self"&gt;inside / overlaps / touches function (occlusion queries)—ArcGIS CityEngine Resources | Documentation &lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://doc.arcgis.com/en/cityengine/latest/python/python-script-based-export.htm" target="_self"&gt;Script-based export—ArcGIS CityEngine Resources | Documentation &lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Wed, 25 Sep 2024 09:11:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/selecting-within-a-selection/m-p/1542370#M11462</guid>
      <dc:creator>JonasObertuefer</dc:creator>
      <dc:date>2024-09-25T09:11:19Z</dc:date>
    </item>
  </channel>
</rss>

