FS#64355 - [OpenSCAD] Missing support for 3MF import / export

Attached to Project: Community Packages
Opened by Kevin Cole (ubuntourist) - Saturday, 02 November 2019, 12:40 GMT
Last edited by Kyle Keen (keenerd) - Thursday, 21 November 2019, 05:37 GMT
Task Type Feature Request
Category Packages
Status Closed
Assigned To Kyle Keen (keenerd)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

According to the official documentation, OpenSCAD has supported 3MF import and export since version 2019.05.

I'm running the community OpenSCAD which claims to be version 2019.05, but under "Export..." I see no option for 3MF.

(I have not attempted to use the import() function with a 3MF file yet.)
This task depends upon

Closed by  Kyle Keen (keenerd)
Thursday, 21 November 2019, 05:37 GMT
Reason for closing:  Fixed
Additional comments about closing:  openscad 2019.05-4
Comment by Jonas Witschel (diabonas) - Saturday, 02 November 2019, 14:19 GMT
OpenSCAD needs to be built with lib3MF (https://github.com/3MFConsortium/lib3mf) in order to enable 3MF import and export support, cf. https://github.com/openscad/openscad/blob/openscad-2019.05/features/lib3mf.prf Since this library is not in the repositories (or even in the AUR) at the moment, it will need to be packaged for Arch Linux first.
Comment by Kevin Cole (ubuntourist) - Saturday, 02 November 2019, 15:08 GMT
I don't know Arch packaging, but I can run a script with the best of them. ;-) So, for what it's worth, the following appears to have worked.

git clone https://github.com/3MFConsortium/lib3mf.git
cd cmake
chmod 755 GenerateMake.sh
./GenerateMake.sh -DLIB3MF_TESTS=FALSE
cd ../build
make

**NOTE:** Without the `-DLIB3MF_TESTS=FALSE` the script complains:

CMake Error at Tests/CMakeLists.txt:1 (ADD_SUBDIRECTORY):
The source directory

.../lib3mf/Tests/googletest

does not contain a CMakeLists.txt file.


CMake Error at Tests/CMakeLists.txt:4 (SET_TARGET_PROPERTIES):
SET_TARGET_PROPERTIES Can not find target to add properties to: gtest


CMake Error at Tests/CMakeLists.txt:5 (SET_TARGET_PROPERTIES):
SET_TARGET_PROPERTIES Can not find target to add properties to: gtest_main


-- Configuring incomplete, errors occurred!
Comment by Jonas Witschel (diabonas) - Saturday, 02 November 2019, 15:54 GMT
Your build steps generally look fine, two comments:

1. "GenerateMake.sh" is only a think wrapper around cmake, it is easier to leave it out and directly create a subdirectory "build" and run "cmake .." in there.
2. To get the tests working, you need to fetch the Git submodule by running "git submodule init && git submodule update".

To sum up, the build process should be

git clone https://github.com/3MFConsortium/lib3mf.git
git submodule init
git submodule update

mkdir build
cd build
cmake ..
make

ctest

You might want to have a look at https://wiki.archlinux.org/index.php/Creating_packages and https://wiki.archlinux.org/index.php/AUR_submission_guidelines on how to create a PKGBUILD and upload it to the AUR. (For the Git submodule stuff in particular, also see https://wiki.archlinux.org/index.php/VCS_package_guidelines#Git_Submodules) This would make it easier for maintainers to adopt lib3MF to the repositories, therefore increasing the chances of getting 3MF import/export for OpenSCAD.
Comment by Jonas Witschel (diabonas) - Saturday, 02 November 2019, 17:02 GMT
We even have gtest packaged in [community], so you could install the gtest package and apply the attached patch to use it in place of the submodule. However this only works if our repository version of gtest is updated first to 1.10.0, the current version 1.8.1-3 is too old and throws compilation errors.
Comment by Jonas Witschel (diabonas) - Saturday, 02 November 2019, 20:02 GMT
I went ahead and added lib3mf-1 to 1.8.1 [community] (openscad only works with this legacy, but still supported version). I also added lib3mf 2.0.0 to the AUR in case there is any interest in the latest version, but we currently don't need it in the repositories.

All that is left is to rebuild openscad with lib3mf-1 added to the depends array. I feel this should be done by the openscad maintainer himself if possible, since he knows the software better than me. I can confirm that with this addition 3MF export works fine for me.

Loading...