<?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: Getting the smallest area with sorting array of geometry.area function in ArcGIS CityEngine Questions</title>
    <link>https://community.esri.com/t5/arcgis-cityengine-questions/getting-the-smallest-area-with-sorting-array-of/m-p/1606464#M11554</link>
    <description>&lt;P&gt;Welp ofc did the linking to the post not work so here we go again:&amp;nbsp;&lt;LI-MESSAGE title="Getting the smallest area with sorting array of geometry.area function" uid="1606462" url="https://community.esri.com/t5/arcgis-cityengine-questions/getting-the-smallest-area-with-sorting-array-of/m-p/1606462#U1606462" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 16 Apr 2025 13:47:17 GMT</pubDate>
    <dc:creator>LittleLemon</dc:creator>
    <dc:date>2025-04-16T13:47:17Z</dc:date>
    <item>
      <title>Getting the smallest area with sorting array of geometry.area function</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/getting-the-smallest-area-with-sorting-array-of/m-p/1606462#M11553</link>
      <description>&lt;P class=""&gt;Hi everyone! First time posting, so please let me know if I missed any important information!&lt;/P&gt;&lt;P class=""&gt;I'm currently working on creating facade models for a project and I'm really stuck on how to get the smallest areas of a building level. My goal is to use the smallest areas to decide whether or not to split them for window tiles (I'm importing custom-made models that only fit within a certain area).&lt;/P&gt;&lt;P class=""&gt;I saw this thread &lt;EM&gt;"Find the face with the largest area"&lt;/EM&gt; and got some results using the code:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;sizes = comp(f){ all : geometry.area() }
indices = sortIndices(sizes)
largestIndex = indices[size(indices)&lt;SPAN class=""&gt;-1&lt;/SPAN&gt;]&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P class=""&gt;^ This is written outside of StartRule&amp;nbsp;and in my subdivided ground floor the code looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;GroundLevel --&amp;gt;
    comp(f) { side = comp(f) { largestIndex : color(&lt;SPAN class=""&gt;1&lt;/SPAN&gt;,&lt;SPAN class=""&gt;0&lt;/SPAN&gt;,&lt;SPAN class=""&gt;1&lt;/SPAN&gt;) fa. } }
    print(sizes)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P class=""&gt;As you can see, I tried to print out the array to check what areas exist and got:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;[672.235005617142,672.&lt;/SPAN&gt;&lt;SPAN&gt;235005617142,56.9623955950849,&lt;/SPAN&gt;&lt;SPAN&gt;65.0227577575442,0.&lt;/SPAN&gt;&lt;SPAN&gt;651960614471675,0.&lt;/SPAN&gt;&lt;SPAN&gt;653950613834463,27.&lt;/SPAN&gt;&lt;SPAN&gt;0863178546652,0.&lt;/SPAN&gt;&lt;SPAN&gt;651960614471657,91.&lt;/SPAN&gt;&lt;SPAN&gt;997532132469,0.&lt;/SPAN&gt;&lt;SPAN&gt;651960614471657,30.&lt;/SPAN&gt;&lt;SPAN&gt;1915471392886,37.&lt;/SPAN&gt;&lt;SPAN&gt;9559232293518,0.&lt;/SPAN&gt;&lt;SPAN&gt;639519132401011,88.&lt;/SPAN&gt;&lt;SPAN&gt;6085877364206,0.&lt;/SPAN&gt;&lt;SPAN&gt;602389473175416,26.&lt;/SPAN&gt;&lt;SPAN&gt;3556398606954,0.&lt;/SPAN&gt;&lt;SPAN&gt;59927572603669,19.&lt;/SPAN&gt;&lt;SPAN&gt;7058619671217,0.&lt;/SPAN&gt;&lt;SPAN&gt;651960614471675,0.&lt;/SPAN&gt;&lt;SPAN&gt;605893140155699,61.&lt;/SPAN&gt;&lt;SPAN&gt;1657785006099,25.&lt;/SPAN&gt;&lt;SPAN&gt;1026779969368,6.&lt;/SPAN&gt;&lt;SPAN&gt;14195367158903,7.&lt;/SPAN&gt;&lt;SPAN&gt;84706793669057,1.498212563952,&lt;/SPAN&gt;&lt;SPAN&gt;10.0207031040625,1.&lt;/SPAN&gt;&lt;SPAN&gt;49847461706181,7.&lt;/SPAN&gt;&lt;SPAN&gt;86142905982004,6.&lt;/SPAN&gt;&lt;SPAN&gt;15483418270743,33.&lt;/SPAN&gt;&lt;SPAN&gt;4894580774452,2.&lt;/SPAN&gt;&lt;SPAN&gt;29956137631535,23.&lt;/SPAN&gt;&lt;SPAN&gt;1626854369825,2.2989816671091,&lt;/SPAN&gt;&lt;SPAN&gt;6.45603386387014,13.&lt;/SPAN&gt;&lt;SPAN&gt;3447547574518,8.&lt;/SPAN&gt;&lt;SPAN&gt;79932702753264,7.&lt;/SPAN&gt;&lt;SPAN&gt;80603914136429,1.398090426035,&lt;/SPAN&gt;&lt;SPAN&gt;10.0135336878099,1.&lt;/SPAN&gt;&lt;SPAN&gt;39960999591291,7.&lt;/SPAN&gt;&lt;SPAN&gt;84833177362034,6.&lt;/SPAN&gt;&lt;SPAN&gt;27738294607007]&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P class=""&gt;But I can't for the life of me figure out:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P class=""&gt;How to use reverse array from the documentation?&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class=""&gt;Why isn't the list sorted??&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P class=""&gt;How to loop through the array and filter only the ones bigger than &lt;STRONG&gt;X&lt;/STRONG&gt; square meters?&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;HR /&gt;&lt;P class=""&gt;&lt;STRONG&gt;Note:&lt;/STRONG&gt; I wanted to upload images, but I can't for some reason… (sorry!)&lt;/P&gt;</description>
      <pubDate>Wed, 16 Apr 2025 13:44:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/getting-the-smallest-area-with-sorting-array-of/m-p/1606462#M11553</guid>
      <dc:creator>LittleLemon</dc:creator>
      <dc:date>2025-04-16T13:44:06Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the smallest area with sorting array of geometry.area function</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/getting-the-smallest-area-with-sorting-array-of/m-p/1606464#M11554</link>
      <description>&lt;P&gt;Welp ofc did the linking to the post not work so here we go again:&amp;nbsp;&lt;LI-MESSAGE title="Getting the smallest area with sorting array of geometry.area function" uid="1606462" url="https://community.esri.com/t5/arcgis-cityengine-questions/getting-the-smallest-area-with-sorting-array-of/m-p/1606462#U1606462" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Apr 2025 13:47:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/getting-the-smallest-area-with-sorting-array-of/m-p/1606464#M11554</guid>
      <dc:creator>LittleLemon</dc:creator>
      <dc:date>2025-04-16T13:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the smallest area with sorting array of geometry.area function</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/getting-the-smallest-area-with-sorting-array-of/m-p/1607298#M11555</link>
      <description>&lt;P&gt;it's in the doc nonetheless:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;reverse(array) = array[size(array)-1:-1:0] &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;sortAsc(array) = array[sortIndices(array)] &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;sortDesc(array) = reverse(sortAsc(array)) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Example:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;const a = ["a", "c", "b"] &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;const b = sortAsc(a) // [a,b,c] &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;const c = sortDesc(a) // [c,b,a]&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Apr 2025 15:35:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/getting-the-smallest-area-with-sorting-array-of/m-p/1607298#M11555</guid>
      <dc:creator>romainjanil</dc:creator>
      <dc:date>2025-04-18T15:35:23Z</dc:date>
    </item>
  </channel>
</rss>

