# Bpypolyskel: open source Python library to generate hipped roofs

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:

## 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 :)

@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.

@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.