Mesh: Workaround to load 3mf files not supported by zipios library

This commit is contained in:
wmayer
2024-08-17 19:36:04 +02:00
committed by wwmayer
parent 3595c301b7
commit 8f18cfaf3a
5 changed files with 73 additions and 1 deletions

View File

@@ -393,3 +393,17 @@ std::vector<std::string> Base::Tools::splitSubName(const std::string& subname)
return subNames;
}
// ------------------------------------------------------------------------------------------------
void Base::ZipTools::rewrite(const std::string& source, const std::string& target)
{
Base::PyGILStateLocker lock;
PyObject* module = PyImport_ImportModule("freecad.utils_zip");
if (!module) {
throw Py::Exception();
}
Py::Module commands(module, true);
commands.callMemberFunction("rewrite", Py::TupleN(Py::String(source), Py::String(target)));
}

View File

@@ -329,6 +329,14 @@ struct BaseExport Tools
static std::vector<std::string> splitSubName(const std::string& subname);
};
struct BaseExport ZipTools
{
/**
* @brief rewrite Rewrite a zip file under a new name.
*/
static void rewrite(const std::string& source, const std::string& target);
};
} // namespace Base