Here’s a useful test (I hope) I was trying to test whether a Lot was a corner (no not the LotCorner which is a triangle), this comes close but does at least check to see whether a Lot has two sides facing a street.
Lot -->
setback(0.1) {streetSide: nil | remainder : test(comp.index)}
test(compIndex) -->
case streetWidth(0) > 0 && streetWidth(1) > 0 : building
case streetWidth(0) > 0 && streetWidth(2) > 0 : building
case streetWidth(0) > 0 && streetWidth(3) > 0 : building
case streetWidth(1) > 0 && streetWidth(1) > 0 : building
case streetWidth(1) > 0 && streetWidth(2) > 0 : building
case streetWidth(1) > 0 && streetWidth(3) > 0 : building
case streetWidth(2) > 0 && streetWidth(1) > 0 : building
case streetWidth(2) > 0 && streetWidth(2) > 0 : building
case streetWidth(2) > 0 && streetWidth(3) > 0 : building
case streetWidth(3) > 0 && streetWidth(1) > 0 : building
case streetWidth(3) > 0 && streetWidth(2) > 0 : building
case streetWidth(3) > 0 && streetWidth(3) > 0 : building
else : nil
building-->
offset(-2, inside)
extrude(rand(3,15))
I posted the above code to the ESRI CityEngine forum to ask for improvements and was given the following code (apparently what I did was not so good…):
attr streetWidth(i) = 0
LotInner --> NIL
Lot -->
CornerRecursion(geometry.nVertices - 1, 0)
CornerRecursion ( edgeID, nStreetEdges ) -->
case edgeID >= 0 :
case streetWidth(edgeID) > 0 :
#print (edgeID)
CornerRecursion ( edgeID - 1, nStreetEdges + 1 )
else:
#print (edgeID)
CornerRecursion ( edgeID - 1, nStreetEdges )
else:
case nStreetEdges >= 2 :
IsCornerLot
else:
IsNotCornerLot
IsCornerLot -->
color("#ff0000")
IsNotCornerLot -->
color("#00ff00")