Roofs are the only operations which �?? this was not yet fixed, but it�??s on the to do list �?? are oriented based on the vertex order of the geometry, and NOT based on the scope orientation, as other ops.
There�??s 2 ways to fix this for rectangular geometries, basically 2 hacks.
1] physically rotate the geometry in that case ( e.g. rotating the scope by 90 degs and inserting a quad. [ or inserting a builtin:cube, then take the bottom face with reversed Normals ]
2] make a case statement, where you call roof twice, for both ratios : Once normal and once with : roofGable(angle, overhangX, overhangY, even, index) this does a hardcoded-rotation of the geometry.
Bad side of 2] is that not all roof ops have an �??index�?? param.
You'll need to play with this a bit, but I've not always been able to make this happen correctly.
i am having a similar problem whereby I want all roofs to be aligned. In my attached image you will notice that the highlighted row of buildings have roofs which don't line up. However the row of buildings on the left are aligned properly (the way i want them all to be!).
"make a case statement, where you call roof twice, for both ratios : Once normal and once with : roofGable(angle, overhangX, overhangY, even, index)"
However I am not sure what you mean by call the roof twice for both ratios?
The issue is that roofs - sadly - react to the actual geometry ( edge numbering ) rather than the scope orientation. So e.g. depending on if the first edge is on the short or long side of a rectangle, the default roof orientation may change. CityEngine does not have an awareness of how shapes and their topology 'align together in the world' and that the roofs should align in the same direction. So if the footprints were digitized differently, the roofs just will change.
not what we can do is change the roof orientation index based on the overall scope ratio.
something like this :
attr roofOrientationIndex = 0
RoofBase --> # assuming scope is yUp
case scope.sx > scope.sz :
set (roofOrientationIndex, 1)
roofGable(30, 1, 1, true, roofOrientationIndex)