Hi there,
I'm trying to create a 3D building with noise mapping applied to the side of the building.
My initial idea was to create a grid on the side of the building in CityEngine using the split function. Then I would colour each of these segments based on the noise value for that segment (I have already established what colour for each segment to create my desired gradient effect).
Whilst I can extrude the building and split the sides of the building into a grid easily using the functions below, I cant work out how to identify each segment to then assign a colour...
Height -->
extrude(height)
Building
Building -->
comp(f) { front : Facade | side : Facade | top: Roof}
Facade -->
split(x){ ~widthSplit: Column(split.index) }*
split(y){ ~heightSplit: Row(split.index) }*
I assumed I would be able to identify each segment and then use the case function to colour that segment (perhaps this isn't the most efficient method).
My other concern is that I might end up doing this over quite a large area so this may be quite a data intensive process...
In all honesty I'm open to ideas if anyone has any experience with this (either in CityEngine or ArcGIS Pro), so any help anyone can offer would be greatly appreciated.
Many thanks,
Gavin.
Solved! Go to Solution.
You have the right idea to use split.index. However, in the Facade rule, you have two splits, one after another. This means that you will do a split in x to get the columns. Then, starting from the facade scope, the second split (in y) will divide the facade into rows. The two splits both apply to the starting facade shape and do not apply sequentially. I think what you want is to divide the facade into grid cells, which means the splits should be applied sequentially.
Here is how you could split a facade into grid cells and access their row and column indices using split.index. Also remember that you can use split.total if you need the total number of rows or columns at some point (otherwise you can remove it from the code).
Facade -->
split(x) { ~cell_width: Column(split.index, split.total) }*
Column(col_ind, nCols) -->
split(y) { ~cell_height: Cell(split.index, col_ind, split.total, nCols) }*
Cell(row_ind, col_ind, nRows, nCols) -->
print("row=" + row_ind + "\tcol=" + col_ind)
You have the right idea to use split.index. However, in the Facade rule, you have two splits, one after another. This means that you will do a split in x to get the columns. Then, starting from the facade scope, the second split (in y) will divide the facade into rows. The two splits both apply to the starting facade shape and do not apply sequentially. I think what you want is to divide the facade into grid cells, which means the splits should be applied sequentially.
Here is how you could split a facade into grid cells and access their row and column indices using split.index. Also remember that you can use split.total if you need the total number of rows or columns at some point (otherwise you can remove it from the code).
Facade -->
split(x) { ~cell_width: Column(split.index, split.total) }*
Column(col_ind, nCols) -->
split(y) { ~cell_height: Cell(split.index, col_ind, split.total, nCols) }*
Cell(row_ind, col_ind, nRows, nCols) -->
print("row=" + row_ind + "\tcol=" + col_ind)
Cheryl that's exactly what I was after!
Using both the .index and .total was also really helpful in that I could create a loop to go through all the cells in a column.
Thanks so much.