I'm currently working on a project in CityEngine, and I'm facing a challenge with roof generation. I'm trying to create a building with a unique roof design: one side should have a hip roof, while the other side should have a gable roof. Is it possible to do this with city engine. I have attached an example image that I expect to achieve with city engine.
Solved! Go to Solution.
Hi @richiedlon
Thank you for reaching out.
One way this could be achieved is using the envelope operation instead of a roof operation.
The envelope operation allows to define an angle and baseHeight for each edge of your roof polygon. You can specify an angle of 90 for the edges that should result in a gable and the normal roof angle for all others. BaseHeight would be 0 in you case.
To create an array with a value for each edge, you can use the comp function and the fe selector.
Here some example code:
const maxHeight = 1000 // set this super high, if the roof shouldnt be cutoff
baseHeights = comp(fe) {all: 0 }
angles = comp(fe) { front: 90 // this puts a gable at all front edges.
| all: 40 } // edit to your roof angle
Example-->
envelope(normal, maxHeight, baseHeights, angles)
Unfortunately, this wont let you define an overhang. Another approach could be to generate a hip roof on a larger polygon and use the split operation to cut it where you want to have the gable.
Let me know if that helps or you have follow-up questions.
Best, Houskan
Hi @richiedlon
Thank you for reaching out.
One way this could be achieved is using the envelope operation instead of a roof operation.
The envelope operation allows to define an angle and baseHeight for each edge of your roof polygon. You can specify an angle of 90 for the edges that should result in a gable and the normal roof angle for all others. BaseHeight would be 0 in you case.
To create an array with a value for each edge, you can use the comp function and the fe selector.
Here some example code:
const maxHeight = 1000 // set this super high, if the roof shouldnt be cutoff
baseHeights = comp(fe) {all: 0 }
angles = comp(fe) { front: 90 // this puts a gable at all front edges.
| all: 40 } // edit to your roof angle
Example-->
envelope(normal, maxHeight, baseHeights, angles)
Unfortunately, this wont let you define an overhang. Another approach could be to generate a hip roof on a larger polygon and use the split operation to cut it where you want to have the gable.
Let me know if that helps or you have follow-up questions.
Best, Houskan
Thank you for your response. It works well. However, as an input, I use ridge height and eave height from ground level. Is there a way to obtain the distance of the building length which is perpendicular to the roof ridge? I was thinking of calculating the angle based on a trigonometric operation.