Hello guys,I have been reading your forum for a couple of weeks now. In my opinion City Engine is a great peace of software, although CGA gives me hard time.I watched/red most of the tutorials and I read the help all the time but It seems my way of thinking is a bit different.My first question is about conditional rule. How do I nest conditions properly?
nRange = 4
attr temp = 0
Lot --> Loop(nRange)
Loop(nRange) -->
case nRange >= temp: print("nRange = " + nRange) Loop(nRange - 1)
case nRange == 3: print("INNER CASE")
else: print("END OF LOOP")
What I want to achieve is to print:nRange = 4nRange = 3INNERCASEnRange = 2nRange = 1nRange = 0END OF LOOP But it seems the cycle never gets within the second case, so instead I get:nRange = 4nRange = 3nRange = 2nRange = 1nRange = 0END OF LOOPSecond question is about how to properly address a function?What I want to achieve is the following:
const listOfBuildings = //what is the purpose of constant in CGA?
"building_01.obj;building_02.obj;building_03.obj;building_04.obj;"
nRange = (listSize(listOfBuildings) - 1)
buildingList = ""/empty string to fill with chosen buildings
const temp = 0
#FUNCTION
testFunction(nRange) = //not sure about the attribute here
listAdd(buildingList, listItem(listOfBuildings, nRange))
#RULE
Loop(nRange) -->
case nRange >= temp: Loop(nRange - 1)
case geometry.isRectangular(5)
&& ((scope.sx > assetInfo(listItem(listOfBuildings, nRange), sx)
&& scope.sz > assetInfo(listItem(listOfBuildings, nRange), sz)))
|| ((scope.sx > assetInfo(listItem(listOfBuildings, nRange), sz)
&& scope.sz > assetInfo(listItem(listOfBuildings, nRange), sx))):
testFunctionn(nRange) //this gives me error? what should I put here ???
else: print("END OF LOOP") //not sure about this
Basically I want to test every building in listOfBuildings if it fits within xz scope of the current Lot. If it fits I want to put it in buildingList so I can randomly choose between several buildings whitch fit the current lot. Well this is for now.Best,pledgeshield