Added CuraVersion to 3mf metadata

This commit is contained in:
Jaime van Kessel 2016-11-30 14:15:19 +01:00
parent d08c1b73bf
commit e941d417f1

View File

@ -5,7 +5,7 @@ from UM.Mesh.MeshWriter import MeshWriter
from UM.Math.Vector import Vector
from UM.Logger import Logger
from UM.Math.Matrix import Matrix
from UM.Settings.SettingRelation import RelationType
from UM.Application import Application
try:
import xml.etree.cElementTree as ET
@ -78,6 +78,12 @@ 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 = ET.Element("model", unit = "millimeter", xmlns = self._namespaces["3mf"])
# Add the version of Cura this was created with. As "CuraVersion" is not a recognised metadata name
# by 3mf itself, we place it in our own namespace.
version_metadata = ET.SubElement(model, "metadata", xmlns = self._namespaces["cura"], name = "CuraVersion")
version_metadata.text = Application.getInstance().getVersion()
resources = ET.SubElement(model, "resources")
build = ET.SubElement(model, "build")