Use Inkscape extensions to create 3D objects from paper

Paper Tiger

Article from Issue 258/2022

Papercraft is coming back into fashion. Linux users can turn to Inkscape and plugins such as, Paperfold, and Tabgen to create templates from 3D objects for printing.

Papercraft is an old form of crafting. It requires nothing more than scissors, paper, and a little glue. Architects use the technique to visualize models quickly and inexpensively, despite digital developments such as virtual reality. Driven by trends such as low-poly modeling and Minecraft, the technique is also experiencing a revival in the hobby sector. In some areas of the world – such as Japan, which has traditionally cultivated origami, another papercraft – there are now many creative people posting their work on the various social media platforms. In Japan, this form is called pepakura, and there is also a software tool of the same name for it.

Unfolding objects and displaying the individual sides as faces is also the basis for other crafts – they usually just require a different node definition for the individual nodes. The templates you need for this can be created with Inkscape in combination with extensions such as [1], Quickjoint [2], Lasercut tabbed box [3], and Paperfold [4]. The tools prepare the objects in such a way that they can be further processed in Joinery [5] without any problems.

More Than Just Boxes is very interesting here, particularly because it comes with a variety of predefined objects – and by no means just simple boxes (Figure 1). For example, rendering a Raspberry Pi case is child's play. But more complex designs with curves and similar features are also available in, you just have to adapt them to your own needs. Pepakura [6] and other software tools for this work are only available for Windows, which forces Linux users to find other ways to indulge in their hobbies.

Figure 1: On, an active community collects numerous templates for building 3D objects. ©

One option from the world of free software for designing 3D objects is Blender. Of course, it can do far more than is required for the task. For Papercraft, the 3D objects also need to be unfolded. This step is handled by a flattener, and there is even an add-in for Blender to match. But if you want to print the unfolded object later on and perhaps also decorate it with graphics, a program like Inkscape is more suitable.

There are many extensions for Inkscape for this kind of work. Often, however, these are not coordinated with the other extensions because each author has their own way of working or view of how to do things. One of the most important extensions of this kind is Paperfold. There is another extension from the same developer with similar functions, but the author considers Paperfold to be the better choice.

Unfolding with Paperfold

As usual with Inkscape, the Paperfold extension is installed by copying the appropriate files either to ~/.config/inkscape/extensions/ or to /usr/share/inkscape/extensions/ for a global installation. Download the file by pressing the down arrow on the project's website. For Paperfold to work, it requires OpenMesh and the appropriate Python bindings. You can use the commands in Listing 1 to install the packages on a Fedora system.

Listing 1

Installing OpenMesh

$ sudo dnf install OpenMesh cmake g++ python3-devel
$ pip3 install pybind11
$ pip3 install openmesh

CMake and the GNU C++ compiler are required because the following commands not only download the appropriate bindings, but also adapt them to the installed version. The two pip3 commands from Listing 1 also work on other distributions. You will need to modify the first command there. After restarting Inkscape, Paperfold is available in Extensions | FabLab Chemnitz | Papercraft Flatteners | Paperfold (Figure 2).

Figure 2: Paperfold unfolds 3D objects to create a flat image.

To get started, it is best to choose a simple object because it takes a while to develop a feel for objects spread out onto surfaces. Paperfold expects either an OFF, OBJ, PLY, or STL file as the initial object. The number of allowed faces has to be adjusted in most cases. However, you should not set the value too high because this will push up your memory consumption. All other values can be safely enabled. They will help you later when you go about gluing the model.

The rendered object consists of grouped single objects, so you have to ungroup for editing. After ungrouping the first group, you will see more groups: One contains all the label elements, the other the paths. After ungrouping again, they too can be edited.

The author has thought of post processing using Joinery; this is hidden away in the Post Processing tab. But papercraft and the required adhesive tabs were not considered. If required, you need to add them to the right edges manually or use another extension, such as Tabgen [7].

Adhesive Tabs with Tabgen

Installing Tabgen is much like installing Paperfold. The next time you launch Inkscape, the plugin is available in Extensions | Papercraft | Tabgen (Figure 3). But some preliminary work is needed to be able to apply Tabgen to objects created with Paperfold. The two tools work in different ways. Tabgen expects closed paths, while Paperfold creates each page as a single path. You'll need to create an appropriate closed path object using Inkscape's tools – not too tricky once you know how.

Figure 3: Tabgen adds glue tabs to the flattened object.

To use the Edit | Select Same function, you first need to select the individual paths. This depends on whether the numbering was rendered in Paperfold. If so, you have to change its appearance a little before you can select the paths of the edges with this function. To do this, select one of the circles around the numbering and use the Edit | Select Same | Fill and Outline function. Because the paths of the edges have no fill, they are dropped from the selection.

Once you have selected all the circles of the numbering, simply change the color of the contour by selecting a different color while holding down the Shift key. After that you can select an edge and execute the function Edit | Select Same | Contour, which tells Inkscape to include all the paths of the edge in the selection.

Since the following steps are difficult to undo, create a duplicate of all the selected paths with Ctrl+D. After that, apply Path | Stroke to Path and then Path | Combine. Now you should be able to apply Tabgen to the object.

Doing so renders another path object, enlarging it by the dimensions chosen in the extension's settings for the glue tabs (Figure 4). But there is a small shortcoming here as well: The developer of this extension seems to glue every single side of an object and never fold it. So you get glue folds even where you don't need them and have to delete them manually from the object.

Figure 4: One side of a cube: The tabs were created by Tabgen.

The developer needs to put in a little more work to make the extension useful for a wider audience. In addition, the tool shows some errors, due to the fact that the code does not catch any errors and the returned error messages are of little help even to experienced users. The developer is probably just getting into programming and creating these extensions for their own use. A little feedback, praise, and also help could probably go a long way here.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Introduction

    This month in Linux Voice.

  • Trembling Text

    Writing your own extension for Inkscape opens up a whole world of possibilities. Apart from creating new objects, you can modify existing objects and even animate them.

  • Inkscape 0.45.1

    Inkscape has always been good, but now version 0.45.1 of the vector drawing program shows a totally new creative aspect.

  • Create appealing presentations with Inkscape and JessyInk

    Using Inkscape with the JessyInk add-on helps you to create graphically appealing presentations that can be run in a web browser and are indexable by search engines.

  • Inkscape

    The Inkscape vector graphics tool replaces expensive commercial solutions such as Adobe Illustrator. This article shows how to get started with Inkscape.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.