<?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 Using Python to add a list of reports to object attributes in ArcGIS CityEngine Questions</title>
    <link>https://community.esri.com/t5/arcgis-cityengine-questions/using-python-to-add-a-list-of-reports-to-object/m-p/1090304#M10263</link>
    <description>&lt;P&gt;&lt;U&gt;Wait a minute, I think I'm about to crack it&lt;/U&gt;&lt;BR /&gt;Hi this is a follow up on my:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-cityengine-questions/create-list-index-from-values/m-p/1089507#M10261" target="_blank" rel="noopener"&gt;https://community.esri.com/t5/arcgis-cityengine-questions/create-list-index-from-values/m-p/1089507#M10261&lt;/A&gt;&amp;nbsp;post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;EM&gt;NOTE: this is a simple example I have a lot of buildings with architectural freedom.&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I need to get shapes to be indexed depending on the distance to the ground or to each other.&lt;/P&gt;&lt;P&gt;The models are not created in CE but is CAD export to shp. It's one shape, but it contains floors:&amp;nbsp;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KennethLindhardt1_0-1629365214113.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/21138iFCF016CFFA19C1E4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KennethLindhardt1_0-1629365214113.png" alt="KennethLindhardt1_0-1629365214113.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I'm able to do a component split and get the facades and floors isolated, but a building can have multiple floor parts in the same level, and in this simple example it get's confused on what's actually are the order of the comp.split.&lt;/P&gt;&lt;P&gt;So I need to be able to pick out a specific index, and therefor I need it to be indexed as below (likek we are use to)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KennethLindhardt1_2-1629365271170.png" style="width: 741px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/21140i6E7BAB56863DD634/image-dimensions/741x427?v=v2" width="741" height="427" role="button" title="KennethLindhardt1_2-1629365271170.png" alt="KennethLindhardt1_2-1629365271170.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I've created a&amp;nbsp;rint(scope.elevation-elevation) after a component split, and created a loop so I get it in the right sort order. Like elevation = 3,6,9,12 etc. but since it's an component split I can't compare them to each other, so CE don't know that in this case the elevation on 12 is equal index 3.&lt;BR /&gt;and if i have a building with a floor height on 4 meters the elevation 12 would be index 2.&lt;/P&gt;&lt;P&gt;If I could only get those elevation into a sorted list, and remove dublicated values, then I could use the list capabilities + the elevation information to pick the right floor.&lt;/P&gt;&lt;P&gt;Right now my thought is to create a rule:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;Next(floorHeight,BlHeight,meterMeasure,ZeroIndex) --&amp;gt;

//print(listAdd(str(floorHeight),str(floorHeight)))
case	floorHeight	==	0	:	report("A",floorHeight)
case	floorHeight	==	1	:	report("B",floorHeight)
case	floorHeight	==	2	:	report("C",floorHeight)
case	floorHeight	==	3	:	report("D",floorHeight)
case	floorHeight	==	4	:	report("E",floorHeight)
case	floorHeight	==	5	:	report("F",floorHeight)
case	floorHeight	==	6	:	report("G",floorHeight)
case	floorHeight	==	7	:	report("H",floorHeight)
case	floorHeight	==	8	:	report("I",floorHeight)
case	floorHeight	==	9	:	report("J",floorHeight)
case	floorHeight	==	10	:	report("K",floorHeight)
case	floorHeight	==	11	:	report("L",floorHeight)
case	floorHeight	==	12	:	report("M",floorHeight)
case	floorHeight	==	13	:	report("N",floorHeight)
case	floorHeight	==	14	:	report("O",floorHeight)
case	floorHeight	==	15	:	report("P",floorHeight)
case	floorHeight	==	16	:	report("Q",floorHeight)
case	floorHeight	==	17	:	report("R",floorHeight)
case	floorHeight	==	18	:	report("S",floorHeight)
case	floorHeight	==	19	:	report("T",floorHeight)
case	floorHeight	==	20	:	report("U",floorHeight)
case	floorHeight	==	21	:	report("V",floorHeight)
case	floorHeight	==	22	:	report("X",floorHeight)
case	floorHeight	==	23	:	report("Y",floorHeight)
case	floorHeight	==	24	:	report("Z",floorHeight)

else : NIL&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If a floor is 3 meters, I'll get&amp;nbsp; a report called D, with the height.&lt;/P&gt;&lt;P&gt;In the first part of the tutorial 12 that will create a list like:&lt;/P&gt;&lt;P&gt;{'D': [3.0], 'G': [6.0], 'J': [9.0], 'M': [12.0], 'P': [15.0], 'R': [17.0]}&lt;/P&gt;&lt;P&gt;So if I can get that converted into a list like:&amp;nbsp;&lt;/P&gt;&lt;P&gt;3;6;9;12;15;17 and add it to the object attribute of all my models so I can link it back to the attributes, then I'm sure I can get it to work.&lt;/P&gt;&lt;P&gt;I've been looking through tutorial 12 &amp;amp;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/145747"&gt;@CherylLau&lt;/a&gt;&amp;nbsp;guide:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-cityengine-questions/using-python-to-create-an-object-attribute-from-a/m-p/539821" target="_blank" rel="noopener"&gt;https://community.esri.com/t5/arcgis-cityengine-questions/using-python-to-create-an-object-attribute-from-a/m-p/539821&lt;/A&gt;&lt;/P&gt;&lt;P&gt;But I can't get it to work. If this can be done without Python, it's preferable, but I don't think so.&lt;/P&gt;&lt;P&gt;Thanks, Kenneth.&lt;/P&gt;</description>
    <pubDate>Thu, 19 Aug 2021 13:10:24 GMT</pubDate>
    <dc:creator>KennethLindhardt1</dc:creator>
    <dc:date>2021-08-19T13:10:24Z</dc:date>
    <item>
      <title>Using Python to add a list of reports to object attributes</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/using-python-to-add-a-list-of-reports-to-object/m-p/1090304#M10263</link>
      <description>&lt;P&gt;&lt;U&gt;Wait a minute, I think I'm about to crack it&lt;/U&gt;&lt;BR /&gt;Hi this is a follow up on my:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-cityengine-questions/create-list-index-from-values/m-p/1089507#M10261" target="_blank" rel="noopener"&gt;https://community.esri.com/t5/arcgis-cityengine-questions/create-list-index-from-values/m-p/1089507#M10261&lt;/A&gt;&amp;nbsp;post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;EM&gt;NOTE: this is a simple example I have a lot of buildings with architectural freedom.&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I need to get shapes to be indexed depending on the distance to the ground or to each other.&lt;/P&gt;&lt;P&gt;The models are not created in CE but is CAD export to shp. It's one shape, but it contains floors:&amp;nbsp;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KennethLindhardt1_0-1629365214113.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/21138iFCF016CFFA19C1E4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KennethLindhardt1_0-1629365214113.png" alt="KennethLindhardt1_0-1629365214113.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I'm able to do a component split and get the facades and floors isolated, but a building can have multiple floor parts in the same level, and in this simple example it get's confused on what's actually are the order of the comp.split.&lt;/P&gt;&lt;P&gt;So I need to be able to pick out a specific index, and therefor I need it to be indexed as below (likek we are use to)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KennethLindhardt1_2-1629365271170.png" style="width: 741px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/21140i6E7BAB56863DD634/image-dimensions/741x427?v=v2" width="741" height="427" role="button" title="KennethLindhardt1_2-1629365271170.png" alt="KennethLindhardt1_2-1629365271170.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I've created a&amp;nbsp;rint(scope.elevation-elevation) after a component split, and created a loop so I get it in the right sort order. Like elevation = 3,6,9,12 etc. but since it's an component split I can't compare them to each other, so CE don't know that in this case the elevation on 12 is equal index 3.&lt;BR /&gt;and if i have a building with a floor height on 4 meters the elevation 12 would be index 2.&lt;/P&gt;&lt;P&gt;If I could only get those elevation into a sorted list, and remove dublicated values, then I could use the list capabilities + the elevation information to pick the right floor.&lt;/P&gt;&lt;P&gt;Right now my thought is to create a rule:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;Next(floorHeight,BlHeight,meterMeasure,ZeroIndex) --&amp;gt;

//print(listAdd(str(floorHeight),str(floorHeight)))
case	floorHeight	==	0	:	report("A",floorHeight)
case	floorHeight	==	1	:	report("B",floorHeight)
case	floorHeight	==	2	:	report("C",floorHeight)
case	floorHeight	==	3	:	report("D",floorHeight)
case	floorHeight	==	4	:	report("E",floorHeight)
case	floorHeight	==	5	:	report("F",floorHeight)
case	floorHeight	==	6	:	report("G",floorHeight)
case	floorHeight	==	7	:	report("H",floorHeight)
case	floorHeight	==	8	:	report("I",floorHeight)
case	floorHeight	==	9	:	report("J",floorHeight)
case	floorHeight	==	10	:	report("K",floorHeight)
case	floorHeight	==	11	:	report("L",floorHeight)
case	floorHeight	==	12	:	report("M",floorHeight)
case	floorHeight	==	13	:	report("N",floorHeight)
case	floorHeight	==	14	:	report("O",floorHeight)
case	floorHeight	==	15	:	report("P",floorHeight)
case	floorHeight	==	16	:	report("Q",floorHeight)
case	floorHeight	==	17	:	report("R",floorHeight)
case	floorHeight	==	18	:	report("S",floorHeight)
case	floorHeight	==	19	:	report("T",floorHeight)
case	floorHeight	==	20	:	report("U",floorHeight)
case	floorHeight	==	21	:	report("V",floorHeight)
case	floorHeight	==	22	:	report("X",floorHeight)
case	floorHeight	==	23	:	report("Y",floorHeight)
case	floorHeight	==	24	:	report("Z",floorHeight)

else : NIL&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If a floor is 3 meters, I'll get&amp;nbsp; a report called D, with the height.&lt;/P&gt;&lt;P&gt;In the first part of the tutorial 12 that will create a list like:&lt;/P&gt;&lt;P&gt;{'D': [3.0], 'G': [6.0], 'J': [9.0], 'M': [12.0], 'P': [15.0], 'R': [17.0]}&lt;/P&gt;&lt;P&gt;So if I can get that converted into a list like:&amp;nbsp;&lt;/P&gt;&lt;P&gt;3;6;9;12;15;17 and add it to the object attribute of all my models so I can link it back to the attributes, then I'm sure I can get it to work.&lt;/P&gt;&lt;P&gt;I've been looking through tutorial 12 &amp;amp;&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/145747"&gt;@CherylLau&lt;/a&gt;&amp;nbsp;guide:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-cityengine-questions/using-python-to-create-an-object-attribute-from-a/m-p/539821" target="_blank" rel="noopener"&gt;https://community.esri.com/t5/arcgis-cityengine-questions/using-python-to-create-an-object-attribute-from-a/m-p/539821&lt;/A&gt;&lt;/P&gt;&lt;P&gt;But I can't get it to work. If this can be done without Python, it's preferable, but I don't think so.&lt;/P&gt;&lt;P&gt;Thanks, Kenneth.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Aug 2021 13:10:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/using-python-to-add-a-list-of-reports-to-object/m-p/1090304#M10263</guid>
      <dc:creator>KennethLindhardt1</dc:creator>
      <dc:date>2021-08-19T13:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: Using Python to add a list of reports to object attributes</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/using-python-to-add-a-list-of-reports-to-object/m-p/1090795#M10264</link>
      <description>&lt;P&gt;Hi Kenneth,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Conceptually, I think your approach could work.&amp;nbsp; I think, if I understand your strategy, you are:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Getting horizontal comp.index&lt;/LI&gt;&lt;LI&gt;Setting scope.elevation of the comp.index shape to a new parameter = floor elevation&lt;/LI&gt;&lt;LI&gt;Setting the ground floor's scope.elevation to a new shape parameter = ground elevation&lt;/LI&gt;&lt;LI&gt;Getting the difference between the floor height and ground per shape, and setting that to a parameter = floor elevation - ground elevation = floor height&lt;/LI&gt;&lt;LI&gt;Sorting the floors based on elevation difference (#4) and labeling them to a letter.&amp;nbsp; = conditional statement = If floor height = #, then letter "A"&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Is that correct?&lt;/P&gt;&lt;P&gt;Keep in mind, your shapes with created and stored parameters are an array of sorts, just not in a tabularized form.&amp;nbsp; Depending on your strategy, and if you can 'label' your floors a letter using a height from elevation (your floor index), you might have already created the floor index parameter that you need, and a array table creation and table lookup is redundant. I&lt;SPAN&gt;f you have the floor index created and parameterized to a shape, maybe you just need to operate another conditional statement to send each floor on there way to new functions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Also, I&amp;nbsp; just want to comment that you don't necessarily need python for the ideas you explained so far.&amp;nbsp; &amp;nbsp;In latest CGA versions (2019+) you can create and store a "list" array in an attribute.&amp;nbsp; &amp;nbsp;You can then create array lookup functions to find first row/column and report second row/column attribute (or similar).&amp;nbsp; See the CSV tutorial for example of how to do that.&amp;nbsp; And you can then use the set function to create a floor index parameter (your letter identifications) if your shape did not already have the array or index stored as a parameter.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Aug 2021 12:16:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/using-python-to-add-a-list-of-reports-to-object/m-p/1090795#M10264</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-08-24T12:16:58Z</dc:date>
    </item>
  </channel>
</rss>

