Bpypolyskel: open source Python library to generate hipped roofs

edited January 2021 in General

How to fit a hipped roof to the footprint of a building? No problem, the bpypolyskel library provides a single function that does the whole task automatically. From the footprint of a building, its straight skeleton gets computed. From this skeleton all faces get extracted and the height for every vertex of the straight skeleton is calculated. All these computations can easily be done in Blender, but the library may also be used in general purpose applications.

The bpypolyskel library was tested against all 320.000 hipped roofs in the OpenStreetMap database. It runs successfully for 99.99% of them.

The bpypolyskel library is hosted on Github: https://github.com/prochitecture/bpypolyskel along with an extensive documentation.

The library became an essential part of the Blender-OSM addon. Below is the result of the OpenStreetMap import of a district in Kuala Lumpur that is densely packed with all kinds of hipped roofs:

Tagged:
CyrilbrunopostleMoultJanFMeetlatJesusbillCGRtheoryshawLaurensJNinfeeeeeand 3 others.

Comments

  • This is really awesome! Ping @stephen_l can Archipack use this for its roof generation? I assume @brunopostle will also really find it useful if he decides to port that aspect of his geometry generation to Python :)

    brunopostleCGR
  • @Moult Archipack use an ancestor of this lib, wich rely on euclid but has some precision issues and a not so well data structure output wich require some processing. Both roof Draft object and 2d to 3d wall detection use the code, but i definitely will take a look.

    CGR
  • @stephen_l
    Yes, bpypolyskel is a significantly enhanced version of polyskel.
    Euclid was replaced by our own implementation that relies on Blender's mathutils. Note that mathutils is also available as an independent Python package which can be installed in the usual way: pip install mathutils. So the bpypolyskel library can be used completely independent of Blender.

    Some precision issues were fixed by post-processing. For example, point clustering is applied.

    JesusbillCGR
  • Just revisiting this, the library works through a straight skeleton. This is good enough for hipped roofs, but what about gabled roofs? Are there other common roof shapes where this method falls short?

  • I don't see how this technique can be easily extended to gables - we also need to be able to do monopitches, dormers, half-hips, and those little gables at the top of hips. It's also quite rare that the eaves line on real buildings is at a single height.

    I have code in the original Homemaker that does gables and monopitches, but it isn't very robust (it builds lots of rectangular-plan shapes and unions them together). The best tool I have for drawing roofs is Topologic, but you still have to draw the planes and let Topologic cut them up - maybe this could be automated somehow.

  • I think it's OK for the user to draw the planes / ridges / valleys and somehow feed that into an algorithm of sorts. @topologic do you have any existing code around this usecase? I'm looking to have a series of roof generators in the BlenderBIM Add-on. I think including bpypolyskel would be a good feature, but it only covers one particular usecase of simple hipped roofs with equal eave lines levels.

    topologic
  • @Moult I don't think there is any specific code in Topologic. I draw all the planes in blender, letting them overlap, then generate a cellcomplex (using the Topologise function in the Homemaker addon), this finds the space enclosed by the planes, which is generally the roof shape you want.

  • @Moult I recently added MedialAxis (2D) to #topologicpy but not straight skeleton. I don’t have an algorithm that creates a roof shape from a 2D drawing.

  • @topologic @brunopostle thanks! For the time being I've just included bpypolyskel for simple hipped roof generation in the BlenderBIM Add-on, but hopefully in the future more roof shapes can be supported and sooner or later I suspect Topologic will be a core component in geometric creation / analysis.

    topologicNigelAcebdamay
Sign In or Register to comment.