Get split.index of a certain segment

498
2
Jump to solution
11-12-2022 08:24 AM
ViDi
by
New Contributor II

Hello,

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.

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?

Thanks in advance!

 

attr CellSize = 50

@Hidden
attr CellID = 0
@Hidden
attr totalCellNR = 0
@Hidden
attr badCell = 0

EndMass --> label("stop") color(1,1,0)

Lot -->
	extrude(CellSize*10)
	split(y) { ~CellSize : Split }*

Split --> set(CellID, split.index) set(totalCellNR, split.total) Check

Check -->
	case minimumDistance(all,"stop") == 0 : color(1,0,0) label("theEnd") set(badCell, split.index)
	else : X.
	
Delete -->
	case badCell < CellID : NIL
	else: X.

 

 

0 Kudos
1 Solution

Accepted Solutions
Houskan
Esri Contributor

Hi ViDi,

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.

Maybe you can achieve the same thing differently using the resetGeometry function:

 

 

attr CellSize = 50

EndMass --> label("stop") color(1,1,0)

Lot -->
	extrude(CellSize*10)
	split(y) { ~CellSize : Check }*

Redo(badCellIdx) -->
	resetGeometry
	extrude(CellSize*10)
	split(y) { ~CellSize : Delete(badCellIdx) }*


Check -->
	case minimumDistance(all,"stop") == 0: t(0,'-1, 0) CheckIsLowestIntersection
	else : NIL
	
// so we only Redo once. 
CheckIsLowestIntersection-->
	case minimumDistance(all,"stop") == 0: NIL
	else: Redo(split.index)
	
Delete(badCellIdx) -->
	case badCellIdx < split.index : NIL
	else: X.

 

 

Let me know if that helps.

Best,

Niklaus

 

View solution in original post

2 Replies
Houskan
Esri Contributor

Hi ViDi,

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.

Maybe you can achieve the same thing differently using the resetGeometry function:

 

 

attr CellSize = 50

EndMass --> label("stop") color(1,1,0)

Lot -->
	extrude(CellSize*10)
	split(y) { ~CellSize : Check }*

Redo(badCellIdx) -->
	resetGeometry
	extrude(CellSize*10)
	split(y) { ~CellSize : Delete(badCellIdx) }*


Check -->
	case minimumDistance(all,"stop") == 0: t(0,'-1, 0) CheckIsLowestIntersection
	else : NIL
	
// so we only Redo once. 
CheckIsLowestIntersection-->
	case minimumDistance(all,"stop") == 0: NIL
	else: Redo(split.index)
	
Delete(badCellIdx) -->
	case badCellIdx < split.index : NIL
	else: X.

 

 

Let me know if that helps.

Best,

Niklaus

 

ViDi
by
New Contributor II

Hi Houskan,
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.

0 Kudos