Hollow out meshes for 3D printing - contributing add-on

Hi!

I wrote an add-on for hollowing out meshes. Its main use is for 3d printing. I would like to contribute it to Blender. The add-on is working, and I’m looking for feedback on its code and tips on how best to contribute it.

Context

Often in a 3d printing workflow, there is the need to hollow out a model before printing it, for instance, to save material or printing time. There is currently no tool in Blender able to reliably do such an operation, as far as I know. The closest alternative is the solidify modifier, but it generates inadequate geometry for any non trivial model.

Results

Here is an example with Suzanne. The result was cut to show the hollowed out inside of the model.
Screenshot from 2024-02-10 19-12-37
Screenshot from 2024-02-10 19-12-11

Implementation

The add-on uses numpy and OpenVDB. The target mesh is read to numpy arrays and a level set is created in OpenVDB with a suitable halfWidth argument. An offset surface is than created. Optionally this surface is joined with the target to create the hollow object, after flipping normals if required.

As arguments, the add-on takes the desired offset, the resolution of the level set and a boolean to indicate if the created surface should be joined with the target.
Screenshot from 2024-02-10 19-14-10

The whole add-on fits in less than 200 lines of code. It is available here.

8 Likes

Hi, thanks! The addon works really well, but instead of including it as a standalone add-on, it would be better to add this functionality to existing 3D Print Toolbox add-on (which I am maintainer of).

There are still some minor issues that are needed to be handled (like add operator redo and account for object scale), you could prepare a patch for 3D Print add-on or I can incorporate your code myself along with tackling above mentioned issues.

5 Likes

Thanks! It would be awesome to have this included in the 3D Print add-on!

I would like to try and prepare the patch myself, as one of my motivations for publishing the code was to better learn how to program for Blender. Would you be available to offer some guidance? For instance, to account for object scale, I usually copy the matrix_world from the target to the new object, but I don’t know if this is the best way of doing it (I didn’t do that in this code). I’ll have lots of questions like that :sweat_smile:

Thanks again for the interest!

1 Like

Sure you can do it yourself if you want, fork blender-addons repo, then create pull request after you implement your changes into 3D Print add-on and assign me as a reviewer. I will give feedback on your code there.

Here is the getting started guide on how to contribute code, including using git, pull requests etc.

1 Like

Blender is getting Extensions platform, read about it here.

So it won’t be necessary to ship your addon with Blender, you can upload it on extensions and people will be able to find it from inside Blender and download.

It’s not sensible to add addon internally for one version, and its probably not getting accepted.

Since you are already liked by four BlenderArtists user now :wink:… you might even want to post this over there in the Coding -Released Script and Themes category ?? To get more attention… of users and coders…

( There where several questions about “what’s the best method to hollow out 3D objects for printing” …:stuck_out_tongue_winking_eye: )

1 Like

I understand. However, the way I see it, this feature (hollow out) makes much more sense as an operation in the 3D Print Toolbox than as an add-on by itself. The use cases I see are almost exclusive for 3d printing. The potential users of the feature will probably have the 3D print add-on already activated. If it were included there, it would save the users having to search for (or to know about) and install an extra add-on. Experienced 3d print users might just find an useful new operator in the add-on they’ve always had by the next time they upgrade Blender…

Moreover, the code is rather simple. The whole add-on, with class registration, UI and everything, is 165 lines, which is almost exactly one fifth of the lines in operators.py from 3D Print add-on, so it wouldn’t add so much to the maintenance burden there.

Anyway, if there still interest in integrating this feature in the 3D Print Toolbox I’ll be eager to help (and help maintain it). If there is not, I’ll just wait for the Extensions platform.

2 Likes

3D Print Toolbox will be extension also and not shipped with Blender. You can contact its creator and merge it there if you wish. But I’d leave it as separate addon if I were you.

What’s your source for this?

Check Extensions todos and design tasks on gitea. Cant remember which ones exactly