Mesh: Workaround to load 3mf files not supported by zipios library
This commit is contained in:
@@ -35,6 +35,7 @@ set(EXT_FILES
|
||||
sketcher.py
|
||||
UiTools.py
|
||||
utils.py
|
||||
utils_zip.py
|
||||
)
|
||||
|
||||
foreach (it ${EXT_FILES})
|
||||
|
||||
18
src/Ext/freecad/utils_zip.py
Normal file
18
src/Ext/freecad/utils_zip.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# (c) 2024 Werner Mayer LGPL
|
||||
|
||||
__author__ = "Werner Mayer"
|
||||
__url__ = "https://www.freecad.org"
|
||||
__doc__ = "Helper module to convert zip files"
|
||||
|
||||
|
||||
import zipfile
|
||||
|
||||
def rewrite(source: str, target: str):
|
||||
source_zip = zipfile.ZipFile(source, "r")
|
||||
target_zip = zipfile.ZipFile(target, "w")
|
||||
|
||||
for name in source_zip.namelist():
|
||||
target_zip.writestr(name, source_zip.open(name).read())
|
||||
|
||||
source_zip.close()
|
||||
target_zip.close()
|
||||
Reference in New Issue
Block a user