<?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: Change front on a dynamic shape in ArcGIS CityEngine Questions</title>
    <link>https://community.esri.com/t5/arcgis-cityengine-questions/change-front-on-a-dynamic-shape/m-p/1176811#M10510</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/67894"&gt;@PeterVickerman&lt;/a&gt;&lt;/P&gt;&lt;P&gt;The default first edge is not the longest edge along a street, it is calculated from the &lt;A href="https://doc.arcgis.com/en/cityengine/latest/help/help-layers-street-parameters.htm" target="_blank" rel="noopener"&gt;streetWidth&lt;/A&gt; paramter. So in your corner case if the &lt;EM&gt;streetWidth&lt;/EM&gt; of the segment A is set to 12 and the &lt;EM&gt;streetWidth&lt;/EM&gt; of the segment B is set 12.001 the first edge will be at the side of segment B.&lt;/P&gt;&lt;P&gt;for each lot in a block a &lt;EM&gt;streetWidth[] &lt;/EM&gt;object attribute containing all the streetWidths from the surrounding block is &lt;A href="https://doc.arcgis.com/en/cityengine/latest/help/help-layers-block-parameters.htm#ESRI_SECTION2_5A91A7408D2240929B5EDA53D6B21FA3" target="_self"&gt;automatically generated.&amp;nbsp;&lt;/A&gt;You can access this &lt;EM&gt;streetWidth[]&lt;/EM&gt; object attribute inside your cga code, see here:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-cityengine-questions/streetwidth-used-in-setback/m-p/725486/highlight/true#M9595" target="_blank" rel="noopener"&gt;https://community.esri.com/t5/arcgis-cityengine-questions/streetwidth-used-in-setback/m-p/725486/highlight/true#M9595&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-cityengine-questions/designate-multiple-street-edges/m-p/166129/highlight/true#M2230" target="_blank" rel="noopener"&gt;https://community.esri.com/t5/arcgis-cityengine-questions/designate-multiple-street-edges/m-p/166129/highlight/true#M2230&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&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>Tue, 24 May 2022 15:23:19 GMT</pubDate>
    <dc:creator>JonasObertuefer</dc:creator>
    <dc:date>2022-05-24T15:23:19Z</dc:date>
    <item>
      <title>Change front on a dynamic shape</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/change-front-on-a-dynamic-shape/m-p/1154336#M10445</link>
      <description>&lt;P&gt;I am trying to create a rule file for a building that will only occur on a corner lot.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The default first edge is the longest edge along a street and this sets the front of the building and the corresponding setback.&lt;/P&gt;&lt;P&gt;Is there a way to change this default first edge and corresponding front of the building to the street edge with the shortest dimension rather than the longest dimension?&lt;/P&gt;&lt;P&gt;On the attached image, I want the blue face to be the front and the red face to be the side but the default is the opposite.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2022 15:54:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/change-front-on-a-dynamic-shape/m-p/1154336#M10445</guid>
      <dc:creator>PeterVickerman</dc:creator>
      <dc:date>2022-03-16T15:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: Change front on a dynamic shape</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/change-front-on-a-dynamic-shape/m-p/1176811#M10510</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/67894"&gt;@PeterVickerman&lt;/a&gt;&lt;/P&gt;&lt;P&gt;The default first edge is not the longest edge along a street, it is calculated from the &lt;A href="https://doc.arcgis.com/en/cityengine/latest/help/help-layers-street-parameters.htm" target="_blank" rel="noopener"&gt;streetWidth&lt;/A&gt; paramter. So in your corner case if the &lt;EM&gt;streetWidth&lt;/EM&gt; of the segment A is set to 12 and the &lt;EM&gt;streetWidth&lt;/EM&gt; of the segment B is set 12.001 the first edge will be at the side of segment B.&lt;/P&gt;&lt;P&gt;for each lot in a block a &lt;EM&gt;streetWidth[] &lt;/EM&gt;object attribute containing all the streetWidths from the surrounding block is &lt;A href="https://doc.arcgis.com/en/cityengine/latest/help/help-layers-block-parameters.htm#ESRI_SECTION2_5A91A7408D2240929B5EDA53D6B21FA3" target="_self"&gt;automatically generated.&amp;nbsp;&lt;/A&gt;You can access this &lt;EM&gt;streetWidth[]&lt;/EM&gt; object attribute inside your cga code, see here:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-cityengine-questions/streetwidth-used-in-setback/m-p/725486/highlight/true#M9595" target="_blank" rel="noopener"&gt;https://community.esri.com/t5/arcgis-cityengine-questions/streetwidth-used-in-setback/m-p/725486/highlight/true#M9595&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-cityengine-questions/designate-multiple-street-edges/m-p/166129/highlight/true#M2230" target="_blank" rel="noopener"&gt;https://community.esri.com/t5/arcgis-cityengine-questions/designate-multiple-street-edges/m-p/166129/highlight/true#M2230&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&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>Tue, 24 May 2022 15:23:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/change-front-on-a-dynamic-shape/m-p/1176811#M10510</guid>
      <dc:creator>JonasObertuefer</dc:creator>
      <dc:date>2022-05-24T15:23:19Z</dc:date>
    </item>
    <item>
      <title>Re: Change front on a dynamic shape</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/change-front-on-a-dynamic-shape/m-p/1177017#M10511</link>
      <description>&lt;P&gt;Thank you Jonas. I was able to make it work by adjusting the streetWidth parameter, although this caused some other challenges with the overall model (shifting orientation of some of the automatically created lots).&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know if CE automatically calculate the length of each of the edges along a road so I could compare and set the shortest as the first edge?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2022 20:54:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/change-front-on-a-dynamic-shape/m-p/1177017#M10511</guid>
      <dc:creator>PeterVickerman</dc:creator>
      <dc:date>2022-05-24T20:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: Change front on a dynamic shape</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/change-front-on-a-dynamic-shape/m-p/1177216#M10512</link>
      <description>&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;I think for your case you don't need to rely on the firstEdge at all. Here is a cga snippet that handles the street facades according to their lenght:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;const getStreetFrontEdgeLenghts = comp(fe) { street.front : scope.sx }

findMax(array) = sortIndices(array)[size(array)-1]
max(array) = array[findMax(array)]

Lot --&amp;gt;
	extrude(15)
	comp(f) { side : Facades }
	
Facades --&amp;gt;
	case getStreetFrontEdgeLenghts[comp.index] &amp;gt; 0:			// street facades
		case scope.sx == max(getStreetFrontEdgeLenghts):	// longer street facade
			color("#FF0000")							
			MainStreetFacade
		else:												// shorter street facade
			color("#FFFF00")
			SecondaryStreetFacade
	else: 													//non street Facades
		BackFacade&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You probably need to edit it a bit to make it work for your rule, but this should do the trick!&lt;/P&gt;&lt;P&gt;Cheers&lt;BR /&gt;Jonas&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2022 15:11:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/change-front-on-a-dynamic-shape/m-p/1177216#M10512</guid>
      <dc:creator>JonasObertuefer</dc:creator>
      <dc:date>2022-05-25T15:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: Change front on a dynamic shape</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/change-front-on-a-dynamic-shape/m-p/1177228#M10513</link>
      <description>&lt;P&gt;Thank you so much for sharing this, I do appreciate it!&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2022 15:32:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/change-front-on-a-dynamic-shape/m-p/1177228#M10513</guid>
      <dc:creator>PeterVickerman</dc:creator>
      <dc:date>2022-05-25T15:32:21Z</dc:date>
    </item>
    <item>
      <title>Re: Change front on a dynamic shape</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/change-front-on-a-dynamic-shape/m-p/1177656#M10514</link>
      <description>&lt;P&gt;Jonas, you have been so helpful, I do appreciate it!&lt;/P&gt;&lt;P&gt;I copied this code into a new rule file but it is identifying both street sides as the SecondaryStreetFacade and I am struggling to understand why.&lt;/P&gt;&lt;P&gt;I added a new constant based on the max in the array and printed this to double check but it still doesn't want to id the longer street facade differently. Here is the code (not sure how to copy it in like you did):&lt;/P&gt;&lt;P&gt;const getStreetFrontEdgeLenghts = comp(fe) { street.front : scope.sx }&lt;BR /&gt;findMin(array) = sortIndices(array)[0]&lt;BR /&gt;findMax(array) = sortIndices(array)[size(array)-1]&lt;/P&gt;&lt;P&gt;min(array) = array[findMin(array)]&lt;BR /&gt;max(array) = array[findMax(array)]&lt;/P&gt;&lt;P&gt;const streetFrontMin = min(getStreetFrontEdgeLenghts)&lt;/P&gt;&lt;P&gt;const streetFrontMax = max(getStreetFrontEdgeLenghts)&lt;BR /&gt;&lt;BR /&gt;Lot --&amp;gt;&lt;BR /&gt;extrude(15)&lt;BR /&gt;comp(f) { side : Facades }&lt;BR /&gt;print (getStreetFrontEdgeLenghts)&lt;BR /&gt;print (streetFrontMin)&lt;BR /&gt;print (streetFrontMax)&lt;BR /&gt;&lt;BR /&gt;Facades --&amp;gt;&lt;BR /&gt;case getStreetFrontEdgeLenghts[comp.index] &amp;gt; 0: // street facades&lt;BR /&gt;case scope.sx == streetFrontMax: // longer street facade&lt;BR /&gt;color("#00a1d9")&lt;BR /&gt;MainStreetFacade&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;else: // shorter street facade&lt;BR /&gt;color("#FF0000")&lt;BR /&gt;SecondaryStreetFacade&lt;BR /&gt;else: //non street Facades&lt;BR /&gt;BackFacade&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the console print:&lt;/P&gt;&lt;P&gt;(4)[&lt;STRONG&gt;57.71571731567383&lt;/STRONG&gt;,0,0,30.6853084564209]&lt;BR /&gt;0&lt;BR /&gt;&lt;STRONG&gt;57.71571731567383&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;So the scope.sx does indeed match streetFrontMax but it isn't coloring the sides any different.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PeterVickerman_0-1653588395983.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/42218i3DDCC38D5566B802/image-size/large?v=v2&amp;amp;px=999" role="button" title="PeterVickerman_0-1653588395983.png" alt="PeterVickerman_0-1653588395983.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2022 18:09:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/change-front-on-a-dynamic-shape/m-p/1177656#M10514</guid>
      <dc:creator>PeterVickerman</dc:creator>
      <dc:date>2022-05-26T18:09:01Z</dc:date>
    </item>
    <item>
      <title>Re: Change front on a dynamic shape</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/change-front-on-a-dynamic-shape/m-p/1177878#M10515</link>
      <description>&lt;P&gt;thats because of floating point inprecision. the scope.sx returned from the comp function can be slightly different to the one you get from the comp operation. You can see this if you add print(scope.sx) after all case statements. So &lt;EM&gt;case scope.sx == streetFrontMax &lt;/EM&gt;was to true for one of the sides.&lt;/P&gt;&lt;P&gt;You need to handle this somehow e.g comparing aginst the values after ceil() or floor() or by against a certain range.&lt;/P&gt;&lt;P&gt;btw. &lt;EM&gt;findMin(getStreetFrontEdgeLenghts )&lt;/EM&gt; will always return 0 because &lt;EM&gt;comp(fe) { street.front : scope.sx } &lt;/EM&gt;does return an array containing all the values from the initial shape. edges which are not part of the street.front selector will be returned as 0. See &lt;A href="https://doc.arcgis.com/en/cityengine/latest/cga/cga-comp-function.htm" target="_self"&gt;comp function&lt;/A&gt; in the help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 08:28:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/change-front-on-a-dynamic-shape/m-p/1177878#M10515</guid>
      <dc:creator>JonasObertuefer</dc:creator>
      <dc:date>2022-05-27T08:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: Change front on a dynamic shape</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/change-front-on-a-dynamic-shape/m-p/1177989#M10516</link>
      <description>&lt;P&gt;Thank you, I changed the following:&lt;/P&gt;&lt;P&gt;case ceil(scope.sx) == ceil(streetFrontMax): // longer street facade&lt;/P&gt;&lt;P&gt;So far this has worked with all the corner lots I have tested.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really appreciate you taking this time to help me understand this!&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2022 15:15:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/change-front-on-a-dynamic-shape/m-p/1177989#M10516</guid>
      <dc:creator>PeterVickerman</dc:creator>
      <dc:date>2022-05-27T15:15:36Z</dc:date>
    </item>
  </channel>
</rss>

