<?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 Get split.index of a certain segment in ArcGIS CityEngine Questions</title>
    <link>https://community.esri.com/t5/arcgis-cityengine-questions/get-split-index-of-a-certain-segment/m-p/1231046#M10737</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I am trying to get a split.index of an intersected shape (red in picture) in order to use it later as a trigger for deleting all segments that are going after the trigger. I am planning to use this algorithm for X and Z axes as well, so height-related solutions are not suitable for me.&lt;/P&gt;&lt;P&gt;I tried to get the value of this particular (red) segments of splitted extrusion by setting them to attribute, but this didn't work. I am a total newbie, so maybe there is something important in work with indexes and attributes that I am missing? Or is it impossible in general?&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;attr CellSize = 50

@Hidden
attr CellID = 0
@Hidden
attr totalCellNR = 0
@Hidden
attr badCell = 0

EndMass --&amp;gt; label("stop") color(1,1,0)

Lot --&amp;gt;
	extrude(CellSize*10)
	split(y) { ~CellSize : Split }*

Split --&amp;gt; set(CellID, split.index) set(totalCellNR, split.total) Check

Check --&amp;gt;
	case minimumDistance(all,"stop") == 0 : color(1,0,0) label("theEnd") set(badCell, split.index)
	else : X.
	
Delete --&amp;gt;
	case badCell &amp;lt; CellID : NIL
	else: X.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 12 Nov 2022 16:24:22 GMT</pubDate>
    <dc:creator>ViDi</dc:creator>
    <dc:date>2022-11-12T16:24:22Z</dc:date>
    <item>
      <title>Get split.index of a certain segment</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/get-split-index-of-a-certain-segment/m-p/1231046#M10737</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I am trying to get a split.index of an intersected shape (red in picture) in order to use it later as a trigger for deleting all segments that are going after the trigger. I am planning to use this algorithm for X and Z axes as well, so height-related solutions are not suitable for me.&lt;/P&gt;&lt;P&gt;I tried to get the value of this particular (red) segments of splitted extrusion by setting them to attribute, but this didn't work. I am a total newbie, so maybe there is something important in work with indexes and attributes that I am missing? Or is it impossible in general?&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;attr CellSize = 50

@Hidden
attr CellID = 0
@Hidden
attr totalCellNR = 0
@Hidden
attr badCell = 0

EndMass --&amp;gt; label("stop") color(1,1,0)

Lot --&amp;gt;
	extrude(CellSize*10)
	split(y) { ~CellSize : Split }*

Split --&amp;gt; set(CellID, split.index) set(totalCellNR, split.total) Check

Check --&amp;gt;
	case minimumDistance(all,"stop") == 0 : color(1,0,0) label("theEnd") set(badCell, split.index)
	else : X.
	
Delete --&amp;gt;
	case badCell &amp;lt; CellID : NIL
	else: X.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Nov 2022 16:24:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/get-split-index-of-a-certain-segment/m-p/1231046#M10737</guid>
      <dc:creator>ViDi</dc:creator>
      <dc:date>2022-11-12T16:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: Get split.index of a certain segment</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/get-split-index-of-a-certain-segment/m-p/1237169#M10767</link>
      <description>&lt;P&gt;Hi &lt;SPAN class=""&gt;&lt;A href="https://community.esri.com/t5/user/viewprofilepage/user-id/636007" target="_self"&gt;&lt;SPAN class=""&gt;ViDi,&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;You try to use the attribute badCell as global variable to exchange information between shapes. Unfortunately, this is not possible. If you set an attribute, this value is only applied to the current shape and its successors.&lt;/P&gt;&lt;P&gt;Maybe you can achieve the same thing differently using the resetGeometry function:&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;attr CellSize = 50

EndMass --&amp;gt; label("stop") color(1,1,0)

Lot --&amp;gt;
	extrude(CellSize*10)
	split(y) { ~CellSize : Check }*

Redo(badCellIdx) --&amp;gt;
	resetGeometry
	extrude(CellSize*10)
	split(y) { ~CellSize : Delete(badCellIdx) }*


Check --&amp;gt;
	case minimumDistance(all,"stop") == 0: t(0,'-1, 0) CheckIsLowestIntersection
	else : NIL
	
// so we only Redo once. 
CheckIsLowestIntersection--&amp;gt;
	case minimumDistance(all,"stop") == 0: NIL
	else: Redo(split.index)
	
Delete(badCellIdx) --&amp;gt;
	case badCellIdx &amp;lt; split.index : NIL
	else: X.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if that helps.&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Niklaus&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2022 10:16:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/get-split-index-of-a-certain-segment/m-p/1237169#M10767</guid>
      <dc:creator>Houskan</dc:creator>
      <dc:date>2022-12-02T10:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: Get split.index of a certain segment</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/get-split-index-of-a-certain-segment/m-p/1246293#M10822</link>
      <description>&lt;P&gt;Hi Houskan,&lt;BR /&gt;Thank you for your suggestion! However, we decided to try to achieve the same result it in totally another way. I am sorry that we missed an occasion to try your code. Hope it helps somebody in the future.&lt;/P&gt;</description>
      <pubDate>Sun, 08 Jan 2023 00:06:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/get-split-index-of-a-certain-segment/m-p/1246293#M10822</guid>
      <dc:creator>ViDi</dc:creator>
      <dc:date>2023-01-08T00:06:52Z</dc:date>
    </item>
  </channel>
</rss>

