A wooden doll's house and an OpenSCAD library

When the children were old enough to play with dolls or figures, I started thinking about buying or building a wooden doll's house. My father and grandfather had built a large Barbie house together for my sister. But I did not want to repeat that. I wanted a design that was both clean-lined and yet a little more refined than the traditional three-storey house you see in many children's bedrooms.

Browsing the interweb, I came across a few products with interesting design:

One doll's house particularly caught my eye: that of the Polish company Boomini (which has since ceased trading).

Boomini Mini Wood doll's house

The design of this doll's house is so clever and handsome, and matched what I wanted so closely, that I did not even try to devise my own version. Instead I set about building this doll's house myself, doing the cutting and gluing with the tools I had to hand.

Here is the finished house once completed:

The finished doll's house

Plans for cutting the wood

The various measurements, proportions and assembly arrangements were not difficult to infer from photos online. The hard part was calculating correctly the bevel angles for each plane of the roof. I needed a tool on which I could model the house in 3D and then generate an unfolded flat layout easily, with the dimensions of each part, the cutting angles and, if possible, the best packing of parts onto a given sheet of timber.

My preference for open-source tools and my slight bent towards code (an occupational hazard…) led me to OpenSCAD.

3D/2D rendering mode

Taking inspiration from Scott Bezek, I began building a prototype that lets you switch easily between a 3D view and a 2D view of all the parts laid out separately. OpenSCAD modules let you describe each part on its own and reuse it for 3D rendering, a “flat” layout (the 3D parts arranged side by side on the XY plane) and 2D output via the projection function.

A demo of a roof and its corresponding blueprints

Roof

Modelling the roof shape I wanted in OpenSCAD is really not difficult. Being able to show each roof plane on its own while preserving the cutting angles was another matter altogether… After trying several approaches, I found that using polygon (to describe the profile of each plane) plus linear_extrude kept the code simpler.

Setting up a “chain” of roof planes (each plane drawn relative to the end of the previous one) also spared me tedious calculations to position each plane relative to the others.

After rewriting this part of the code several times, I eventually managed to spin out an OpenSCAD Dollhouse library.

Masks

Example of a mask on a roof

To save time and benefit from OpenSCAD's Boolean operators, I allowed my roof to be used as a mask, so anything underneath could be shaped to match the roof. It is quick and satisfying. The snag is that you cannot automatically display dimensions that come from a Boolean operation directly in the render…

Dimensions

Example of dimensions generated with the openscad-new-dimensions library

From the outset of this project, I wanted to show dimensions straight on the 3D or 2D model and have them update automatically when the model changes. To get there I first used the Dimensional drawings library; since it did not cover everything I needed, I ended up writing my own OpenSCAD New Dimensions library to draw dimensions, angles and labels on my renders.

Useful as it is, there remain cases where working out a dimension for an element is too laborious to feed into the library. In those situations, the best approach I found is to export the 2D render as SVG or DXF and bring it into Inkscape or QCAD/LibreCAD to add dimensions there.

Stairs

Example of stairs generated with the openscad-doll-house library

To model the stairs and export a flat layout, I kept things simple and added a Stairs module to my Dollhouse library. As with the roof, a staircase can be used as a mask and subtracted with the difference operator.

Source code

The sources for this project and the two libraries are available under the GPLv3 licence on Codeberg:

Next steps

I have not built another doll's house yet, so I do not know whether the library will make me much faster; I already know what I would like to add, though: