Wednesday, 2 November 2016

Converting 3MF Files to STL

When I create new items in Google Sketchup, they sometimes have holes in them when I export them as STereoLitography or STL files, as such I usually make use of the Microsoft repair service on Azure.

This allows you to upload an STL file, the site will repair the holes and then allow you to download a repaired STL file of your model.

Unfortunately, Microsoft being Microsoft, along with a bunch of other big companies decided they wanted to use a file format that had Digital Rights Management DRM encoded into them and so the 3MF file format was born.

At some time in the recent past, Microsoft updated their repair service so it now only exports 3MF files - great - let's stuff the free community!

Repetier Host, Slic3r, etc do not support the 3MF format, although Cura does, but only because the people that write it - Ultimaker are part of the 3MF Consortium.

Windows 8 and 10 users can use the Microsoft App 3D Builder to convert their 3MF files back to STL format, however I don't have any Windows machines and only use a Mac, so I need to look a bit further afield.

So I go looking for a potential solution, and find one on released on GitHub by Charles Shapiro called 3mf2stl.

This is intended as a Linux solution to the problem, but I see no reason why it should not also work on a Mac as this is also Unix based.

I download the source code, extract it and type 'make' in the top level directory (OK, so it only has a top level).

First stumbling block is that it requires libzip - no problem, that is available via the App store and is a pretty simple command line install.

Second stumbling block, libzip won't actually install because my version of Xcode is out of date and I need to update to 8.1.

Third stumbling block, after waiting the best part of an hour for Xcode to upgrade itself, libzip will now install, however the make file is still not finding zip.h from /usr/local/include.

This requires re-installing the Xcode command line utilities by running 'xcode-select --install' at the command line.

Fourth stumbling block, now make can find zip.h, however it now barfs about zipconf.h, which is not actually held in /usr/local/include.

This is fixed by creating a link to its real location - 'cd /usr/local/include; ln -s ../Cellar/libzip/1.1.2/lib/libzip/include/zipconf.h'

This time make runs through cleanly and produces an executable - 3mf2stl, which I then copy to /usr/local/bin.

Now I can convert my 3MF files to STL by running: 3mf2stl -i <input file> -o <output file>

1 comment:

  1. There is also a C# version of the 3MF 2 STL converter: