__init__.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # Copyright (c) 2015 Ultimaker B.V.
  2. # Uranium is released under the terms of the LGPLv3 or higher.
  3. import sys
  4. from UM.Logger import Logger
  5. try:
  6. from . import ThreeMFWriter
  7. threemf_writer_was_imported = True
  8. except ImportError:
  9. Logger.log("w", "Could not import ThreeMFWriter; libSavitar may be missing")
  10. threemf_writer_was_imported = False
  11. from . import ThreeMFWorkspaceWriter
  12. from UM.i18n import i18nCatalog
  13. i18n_catalog = i18nCatalog("cura")
  14. def getMetaData():
  15. workspace_extension = "3mf"
  16. metaData = {}
  17. if threemf_writer_was_imported:
  18. metaData["mesh_writer"] = {
  19. "output": [{
  20. "extension": "3mf",
  21. "description": i18n_catalog.i18nc("@item:inlistbox", "3MF file"),
  22. "mime_type": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml",
  23. "mode": ThreeMFWriter.ThreeMFWriter.OutputMode.BinaryMode
  24. }]
  25. }
  26. metaData["workspace_writer"] = {
  27. "output": [{
  28. "extension": workspace_extension,
  29. "description": i18n_catalog.i18nc("@item:inlistbox", "Cura Project 3MF file"),
  30. "mime_type": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml",
  31. "mode": ThreeMFWorkspaceWriter.ThreeMFWorkspaceWriter.OutputMode.BinaryMode
  32. }]
  33. }
  34. return metaData
  35. def register(app):
  36. if "3MFWriter.ThreeMFWriter" in sys.modules:
  37. return {"mesh_writer": ThreeMFWriter.ThreeMFWriter(),
  38. "workspace_writer": ThreeMFWorkspaceWriter.ThreeMFWorkspaceWriter()}
  39. else:
  40. return {}