<?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: Working with Arrays and Lists in ArcGIS CityEngine Questions</title>
    <link>https://community.esri.com/t5/arcgis-cityengine-questions/working-with-arrays-and-lists/m-p/1249418#M10840</link>
    <description>&lt;P&gt;Hi Jonas&lt;/P&gt;&lt;P&gt;Thanks for the solution, it didnt really work for my case, it crashes CE without as such as a notice. As result I think I might have flooded the memory. The purpose of this exercise really trying to find the resultant setback distance from edge&amp;nbsp; in order to calculate setbacks for extrudes to allow sky view.&lt;/P&gt;&lt;P&gt;As for the second question can you please provide a proper&amp;nbsp;&lt;SPAN&gt;setbackPerEdge&lt;/SPAN&gt;&amp;nbsp; example for&amp;nbsp; the white polygon in the image below, as each colour representing&amp;nbsp; zone requires a specific setback distance.&amp;nbsp; Here where none of the setback selectors have a solid relationship with the adjacent polygon. except for manually changing the &lt;A href="https://doc.arcgis.com/en/cityengine/latest/cga/cga-edge-attr-function.htm" target="_self"&gt;edgeAttr function&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="zoning.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/60719i1B1DDF84173C650B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="zoning.png" alt="zoning.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
    <pubDate>Thu, 19 Jan 2023 11:33:27 GMT</pubDate>
    <dc:creator>Kevin_Z</dc:creator>
    <dc:date>2023-01-19T11:33:27Z</dc:date>
    <item>
      <title>Working with Arrays and Lists</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/working-with-arrays-and-lists/m-p/1247545#M10831</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would like to know how to work with arrays and lists, it seems to me that they can only work in a global setting through declaration, and not within a function. So is there a way to work with arrays and lists in a function similar to working with constants and integers.&lt;/P&gt;&lt;P&gt;As such through a recursive setback; the length of the face edge changes&amp;nbsp; after each iteration, this can be shown via printing the array after a setback iteration. What I would like to do is to store&amp;nbsp; the results of each iteration onto a fresh array&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also is there a way to write to the edge attributes array set via cga?&amp;nbsp; as edge attributes can be edited manually?&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 10:10:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/working-with-arrays-and-lists/m-p/1247545#M10831</guid>
      <dc:creator>Kevin_Z</dc:creator>
      <dc:date>2023-01-12T10:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Arrays and Lists</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/working-with-arrays-and-lists/m-p/1247950#M10833</link>
      <description>&lt;P&gt;Good morning &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/115456"&gt;@Kevin_Z&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Not sure if I 100% understand what you want to achieve, a code snippet or screenshot would probably help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;There was a similar question a couple of days ago where you will find an &lt;A href="https://community.esri.com/t5/arcgis-cityengine-questions/cga-for-add-array/m-p/1245532#M10821" target="_self"&gt;answer&lt;/A&gt; with a basic example where an array is passed as an argument for each iteration.&lt;/P&gt;&lt;P&gt;Another way would be to define an attribute and then set the value using the set operation on each iteration. For a code snippet see second example on the doc page of the &lt;A href="https://doc.arcgis.com/en/cityengine/2020.1/cga/cga-set.htm" target="_self"&gt;set operation.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;hope this helps!&lt;/P&gt;&lt;P&gt;Cheers&lt;BR /&gt;Jonas&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 07:54:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/working-with-arrays-and-lists/m-p/1247950#M10833</guid>
      <dc:creator>JonasObertuefer</dc:creator>
      <dc:date>2023-01-13T07:54:22Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Arrays and Lists</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/working-with-arrays-and-lists/m-p/1248015#M10835</link>
      <description>&lt;P&gt;Thank you Jonas for replying, as you can see from the image below , the console results of the rectangle is something of the first step I want to achieve as the intial state of the polygon have the same amount of edges as the final stage and that there are two arrays showing there initialand final edge lengths. But in real life the polygon we get are  more like the polygon on the right and hence there is more stages in between to reach the final stage. Hence I would like to know how to store the arrays of the inbetween stages.While having the ability to reuse it t later stages or until it is overwriten.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sample.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/60383i58F0C6B49D36C5E7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sample.png" alt="sample.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Attached are the sample file thats similar to what I am currently using. Using set attribute operation to create a simple lookup table, but it is only good if the polygon doesnt have a many edges, and that at the later stages the extruded level are limited to single digits. Other wise it will be very messy and creates so much redundancies handful.&lt;/P&gt;&lt;P&gt;So if an array can be used in a function(rather than as a global declearation) while its result is global and be used any level child of the parent polygon like the Set operation for constants and floats,&amp;nbsp;&lt;/P&gt;&lt;P&gt;as such:&lt;/P&gt;&lt;P&gt;arrayA= &lt;STRONG&gt;comp&lt;/STRONG&gt;(fe) { all : &lt;STRONG&gt;scope.sx&lt;/STRONG&gt; }&amp;nbsp;&lt;/P&gt;&lt;P&gt;@StartRule&lt;/P&gt;&lt;P&gt;saveArray--&amp;gt;&lt;/P&gt;&lt;P&gt;cleanupGeometry(all, 0)&lt;/P&gt;&lt;P&gt;set( arrayB, arrayA)&lt;/P&gt;&lt;P&gt;godosomethingelse.&lt;/P&gt;&lt;P&gt;X.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sample1.png" style="width: 1871px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/60384i63D12A3B4F2A8F31/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sample1.png" alt="sample1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;i&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;The Second question&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;My understand of in order to use the&amp;nbsp;setback per edge&amp;nbsp;we must first edit the&amp;nbsp;edge attribute function&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and for a hand full of test samples working with the way as suggested by the page would be ok.&lt;/P&gt;&lt;P&gt;However when trying to use&amp;nbsp; it on a large scale of dataset of say 50K -500k polygon set with an average of 4-8 edges per polygon, where do you think it will be sitting on this graph?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://doc.arcgis.com/en/cityengine/latest/get-started/GUID-5449E36B-FE0A-461E-8624-77E0DDEA9178-web.png" border="0" /&gt;&lt;/P&gt;&lt;P&gt;Hence my second question of; is there any code based way of altering the edge attribute array?&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2023 13:07:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/working-with-arrays-and-lists/m-p/1248015#M10835</guid>
      <dc:creator>Kevin_Z</dc:creator>
      <dc:date>2023-01-13T13:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Arrays and Lists</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/working-with-arrays-and-lists/m-p/1248459#M10838</link>
      <description>&lt;P&gt;Hi again &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/115456"&gt;@Kevin_Z&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Below you find a code snippet which gets you the same results as in your rule. Instead of going through each value recursivly it just passes on the return of &lt;EM&gt;ar_length&lt;/EM&gt; as parameter:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;lot--&amp;gt; 
    cleanupGeometry(all, 0) 
    innerRectangle(edge) { shape : LoType(ar_length) X. | remainder = NIL }

LoType(a) --&amp;gt;
    setbackToArea(area, minDists, maxDists)
    	{ all       = NIL   |
          remainder = showit(a,ar_length) X. }      

showit(a,b) --&amp;gt; 
	print(a)
    print(b)
    print(a.-b)&lt;/LI-CODE&gt;&lt;P&gt;Note: a.-b is calculating array a minus array b (see &lt;A href="https://doc.arcgis.com/en/cityengine/2020.1/cga/cga-array-type-operators.htm" target="_self"&gt;Array type operators&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;Hope this helps you to point you in the right direction, alltough I still don't quite understand how the final result should look like...&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Regarding your second question:&lt;/STRONG&gt; setbackPerEdge operation is not depending on any edge attributes, you simply set the setback distance for each edge of the current shape indvidually.&lt;/P&gt;&lt;P&gt;Cheers,&lt;BR /&gt;Jonas&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2023 13:17:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/working-with-arrays-and-lists/m-p/1248459#M10838</guid>
      <dc:creator>JonasObertuefer</dc:creator>
      <dc:date>2023-01-16T13:17:20Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Arrays and Lists</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/working-with-arrays-and-lists/m-p/1249418#M10840</link>
      <description>&lt;P&gt;Hi Jonas&lt;/P&gt;&lt;P&gt;Thanks for the solution, it didnt really work for my case, it crashes CE without as such as a notice. As result I think I might have flooded the memory. The purpose of this exercise really trying to find the resultant setback distance from edge&amp;nbsp; in order to calculate setbacks for extrudes to allow sky view.&lt;/P&gt;&lt;P&gt;As for the second question can you please provide a proper&amp;nbsp;&lt;SPAN&gt;setbackPerEdge&lt;/SPAN&gt;&amp;nbsp; example for&amp;nbsp; the white polygon in the image below, as each colour representing&amp;nbsp; zone requires a specific setback distance.&amp;nbsp; Here where none of the setback selectors have a solid relationship with the adjacent polygon. except for manually changing the &lt;A href="https://doc.arcgis.com/en/cityengine/latest/cga/cga-edge-attr-function.htm" target="_self"&gt;edgeAttr function&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="zoning.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/60719i1B1DDF84173C650B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="zoning.png" alt="zoning.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 11:33:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/working-with-arrays-and-lists/m-p/1249418#M10840</guid>
      <dc:creator>Kevin_Z</dc:creator>
      <dc:date>2023-01-19T11:33:27Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Arrays and Lists</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/working-with-arrays-and-lists/m-p/1250431#M10845</link>
      <description>&lt;P&gt;Maybe you have to split up your dataset in smaller parts then? Did you got any error message in the log? Anotherway is to do the shape cleanup before applying any rule using "Shapes -&amp;gt; Cleanup shapes..."&amp;nbsp; or via python.&lt;/P&gt;&lt;P&gt;Here is a basic example of setbackPerEdge:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;const setbackDistance = [1,3,6,2,1.5,2] // connect this attribute to the object attribute on your shape with the same name
dist = setbackDistance[comp.index] // or edgeAttr.getFloat() when you want to use edge attributes

Lot --&amp;gt; setbackPerEdge(dist) { all = Green | remainder = Blue}&lt;/LI-CODE&gt;&lt;P&gt;when getting the distance from an object attribute you need to make sure that you define the first edge accordingly.&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;Best,&lt;BR /&gt;Jonas&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2023 16:25:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/working-with-arrays-and-lists/m-p/1250431#M10845</guid>
      <dc:creator>JonasObertuefer</dc:creator>
      <dc:date>2023-01-23T16:25:54Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Arrays and Lists</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/working-with-arrays-and-lists/m-p/1251787#M10850</link>
      <description>&lt;P&gt;Thanks Jonas&amp;nbsp;&lt;BR /&gt;I think the first question was resulted from a bug, that CE doesnt show street direction correctly after Inner Rectangle and convexify function&lt;/P&gt;&lt;P&gt;for the second question I just have to make sure that the I can create a list from Arcpro for each polygon then I'd able to use the comp index as the setback relationship?&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 09:06:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/working-with-arrays-and-lists/m-p/1251787#M10850</guid>
      <dc:creator>Kevin_Z</dc:creator>
      <dc:date>2023-01-26T09:06:53Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Arrays and Lists</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/working-with-arrays-and-lists/m-p/1252775#M10856</link>
      <description>&lt;P&gt;Did you do a matching comp split afterwards? The sampling only works properly when there is something to sample in the outwards direction the face/edge is pointing. If you look at bottom three example in the cga ref about &lt;A href="https://doc.arcgis.com/en/cityengine/latest/cga/cga-edge-attr-function.htm" target="_self"&gt;edgeAttribute functions&lt;/A&gt; the concept should become clearer.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;for the second question I just have to make sure that the I can create a list from Arcpro for each polygon then I'd able to use the comp index as the setback relationship?&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;In theory yes but it could be that the relation from your list is not the same in CE and pro, because the vertices/edges order is the otherway around. So when importing from pro the first edge will be matched to the first edge of pro, but the others are different:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="verticeAndEdgesOrderDifferenceBetweenCEandPro.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/61565i8DDB2D69D32EF7AE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="verticeAndEdgesOrderDifferenceBetweenCEandPro.png" alt="verticeAndEdgesOrderDifferenceBetweenCEandPro.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 07:49:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/working-with-arrays-and-lists/m-p/1252775#M10856</guid>
      <dc:creator>JonasObertuefer</dc:creator>
      <dc:date>2023-01-30T07:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: Working with Arrays and Lists</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/working-with-arrays-and-lists/m-p/1254104#M10857</link>
      <description>&lt;P&gt;combination of set() setElems() and with are indeed the way to go for this kind of stuff. You can do a lot of geometrical calculation in some kind of loop, iterating on the initialShape, storing calculated values in arrays trough comp(), sets feeding arrays, incrementing, resetGeometry and eventually exit the loop when condition are met&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2023 22:32:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/working-with-arrays-and-lists/m-p/1254104#M10857</guid>
      <dc:creator>romainjanil</dc:creator>
      <dc:date>2023-02-01T22:32:27Z</dc:date>
    </item>
  </channel>
</rss>

