|
@@ -14,6 +14,7 @@ from cura.CuraApplication import CuraApplication
|
|
import Savitar
|
|
import Savitar
|
|
|
|
|
|
import numpy
|
|
import numpy
|
|
|
|
+import datetime
|
|
|
|
|
|
MYPY = False
|
|
MYPY = False
|
|
try:
|
|
try:
|
|
@@ -108,7 +109,11 @@ class ThreeMFWriter(MeshWriter):
|
|
|
|
|
|
# Get values for all changed settings & save them.
|
|
# Get values for all changed settings & save them.
|
|
for key in changed_setting_keys:
|
|
for key in changed_setting_keys:
|
|
- savitar_node.setSetting(key, str(stack.getProperty(key, "value")))
|
|
|
|
|
|
+ savitar_node.setSetting("cura:" + key, str(stack.getProperty(key, "value")))
|
|
|
|
+
|
|
|
|
+ # Store the metadata.
|
|
|
|
+ for key, value in um_node.metadata.items():
|
|
|
|
+ savitar_node.setSetting(key, value)
|
|
|
|
|
|
for child_node in um_node.getChildren():
|
|
for child_node in um_node.getChildren():
|
|
# only save the nodes on the active build plate
|
|
# only save the nodes on the active build plate
|
|
@@ -145,6 +150,22 @@ class ThreeMFWriter(MeshWriter):
|
|
model_relation_element = ET.SubElement(relations_element, "Relationship", Target = "/3D/3dmodel.model", Id = "rel0", Type = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dmodel")
|
|
model_relation_element = ET.SubElement(relations_element, "Relationship", Target = "/3D/3dmodel.model", Id = "rel0", Type = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dmodel")
|
|
|
|
|
|
savitar_scene = Savitar.Scene()
|
|
savitar_scene = Savitar.Scene()
|
|
|
|
+
|
|
|
|
+ metadata_to_store = CuraApplication.getInstance().getController().getScene().getMetaData()
|
|
|
|
+
|
|
|
|
+ for key, value in metadata_to_store.items():
|
|
|
|
+ savitar_scene.setMetaDataEntry(key, value)
|
|
|
|
+
|
|
|
|
+ current_time_string = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
|
|
|
+ if "Application" not in metadata_to_store:
|
|
|
|
+ # This might sound a bit strange, but this field should store the original application that created
|
|
|
|
+ # the 3mf. So if it was already set, leave it to whatever it was.
|
|
|
|
+ savitar_scene.setMetaDataEntry("Application", CuraApplication.getInstance().getApplicationDisplayName())
|
|
|
|
+ if "CreationDate" not in metadata_to_store:
|
|
|
|
+ savitar_scene.setMetaDataEntry("CreationDate", current_time_string)
|
|
|
|
+
|
|
|
|
+ savitar_scene.setMetaDataEntry("ModificationDate", current_time_string)
|
|
|
|
+
|
|
transformation_matrix = Matrix()
|
|
transformation_matrix = Matrix()
|
|
transformation_matrix._data[1, 1] = 0
|
|
transformation_matrix._data[1, 1] = 0
|
|
transformation_matrix._data[1, 2] = -1
|
|
transformation_matrix._data[1, 2] = -1
|