mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 15:37:27 -06:00
Correctly write matrices and the cura version metadata tag
Fixes an issue with invalid 3MF files
This commit is contained in:
parent
3d58bd4d49
commit
e9db6498ba
1 changed files with 5 additions and 4 deletions
|
@ -44,7 +44,7 @@ class ThreeMFWriter(MeshWriter):
|
||||||
result += str(matrix._data[2,2]) + " "
|
result += str(matrix._data[2,2]) + " "
|
||||||
result += str(matrix._data[0,3]) + " "
|
result += str(matrix._data[0,3]) + " "
|
||||||
result += str(matrix._data[1,3]) + " "
|
result += str(matrix._data[1,3]) + " "
|
||||||
result += str(matrix._data[2,3]) + " "
|
result += str(matrix._data[2,3])
|
||||||
return result
|
return result
|
||||||
|
|
||||||
## Should we store the archive
|
## Should we store the archive
|
||||||
|
@ -78,10 +78,11 @@ 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")
|
||||||
|
|
||||||
model = ET.Element("model", unit = "millimeter", xmlns = self._namespaces["3mf"])
|
model = ET.Element("model", unit = "millimeter", xmlns = self._namespaces["3mf"])
|
||||||
|
model.set("xmlns:cura", self._namespaces["cura"])
|
||||||
|
|
||||||
# Add the version of Cura this was created with. As "CuraVersion" is not a recognised metadata name
|
# Add the version of Cura this was created with. Since there is no "version" or similar metadata name we need
|
||||||
# by 3mf itself, we place it in our own namespace.
|
# to prefix it with the cura namespace, as specified by the 3MF specification.
|
||||||
version_metadata = ET.SubElement(model, "metadata", xmlns = self._namespaces["cura"], name = "CuraVersion")
|
version_metadata = ET.SubElement(model, "metadata", name = "cura:version")
|
||||||
version_metadata.text = Application.getInstance().getVersion()
|
version_metadata.text = Application.getInstance().getVersion()
|
||||||
|
|
||||||
resources = ET.SubElement(model, "resources")
|
resources = ET.SubElement(model, "resources")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue