Roof Height in CE

09-10-2015 01:09 PM
New Contributor II

I have building footprints with max height attached. I need to know the height of roofHip so I can store it as a variable and subtract it from the max height to run the extrude function. I need to know either the height of the roof model or how to recursively reduce the extrusion to match the max height attribute.

I have looked at scope and geometry functions and neither are helping to solve the problem.This problem is close to matching buildings with the same top of roof height that is done by volumes.

In short: How does one figure out the height of the building's roof?

Thanks for the help,

-Greg J.

Tags (3)
0 Kudos
4 Replies
Occasional Contributor

If I understand your problem correctly, you need to know the roof angle. The distance which you would want to subtract from your hipHeight to get your facadeHeight would be something like cos(roofAngle) * buildingWidth / 2.


Short message from my phone.

Den 10/09/2015 kl. 22.11 skrev Gregory Jameson <<>>:

GeoNet <>

Roof Height in CE

created by Gregory Jameson<> in CityEngine - View the full discussion<>

0 Kudos
New Contributor II


Thank you for the fast response. Since a parameter of the roofHip is the angle, that is known. I think you mean the tangent (angle) * buildingWidth / 2. Cosine would give the run of the slope. If I was doing a gable roof, that should work but hip roofs are far more challenging.

In the graphic I attached with my question, MAXheight = 30.2 ft. Exporting and measuring it in scene, it looks like the building is 44.49 ft tall. TAN (30.26 deg) * 57.4 ft/2 = 16.74 ft or an over estimation of 2.5 ft.

Good idea, just not close enough.

0 Kudos
Occasional Contributor

Hmm, tangent, of course – I knew something wasn't right…

Answering from my phone before, I didn't see your pic until now. Do you intend to model a real world bldg (i.e. does accuracy matter)? If not, I'd go with Chris' solution.

Otherwise (apart from the fact that what you show is a very unlikely roof – I say this as an architect), one way to go might be to try to determine the width of the main body of your building. The problem has nothing to do with hip or gable roof. Rather, the heart of the matter is that the roof builds from the main body of the building, with all protruding building parts (three extensions to the back and left, the sort of bay window part in the front and the side wing on the right) cladding on to the main envelope.

I would assume, that convexify() might help you to isolate the main body of the building in order to retrieve the width. From there, I would do the tan(roofAngle) * buildingWidth / 2 thing.

But maybe some of the CE guys have a more clever approach…

0 Kudos
by Anonymous User
Not applicable

There is a much easier way to do this, as long as you don't need to have a specific roof angle. If you don't care about the roof angle, then build the roof with ANY angle you want, and then scale it down to whatever height you want. Some simplified code:

attr Build_Hgt = 40  # This is mapped to your object attribute I assume.

attr Roof_Hgt = Build_Hgt * 0.33 # Here I did a ratio of total height, but you could set this to any value.

House -->

     extrude(Build_Hgt - Roof_Hgt)

     comp(f) {side: Facade | top: Roof}

Roof -->



Only problem is you are using an overhang. If this solution works for you, then you will need to make a slight upwards translation to the roof so that the facade doesn't stick through it after scaling it down. That is where the Trig is needed.


0 Kudos