mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 22:54:01 -06:00
Add basic UFP writer plug-in
This already implements most of it. Just the thumbnail must still be gotten and put inside the container. Contributes to issue CURA-4872.
This commit is contained in:
parent
6cd64e1ce8
commit
600e2abce1
3 changed files with 54 additions and 0 deletions
21
plugins/UFPWriter/UFPWriter.py
Normal file
21
plugins/UFPWriter/UFPWriter.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
#Copyright (c) 2018 Ultimaker B.V.
|
||||
#Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import charon
|
||||
|
||||
from UM.Mesh.MeshWriter import MeshWriter #The writer we need to implement.
|
||||
from UM.PluginRegistry import PluginRegistry #To get the g-code writer.
|
||||
|
||||
class UFPWriter(MeshWriter):
|
||||
def write(self, stream, nodes, mode = MeshWriter.OutputMode.BinaryMode):
|
||||
archive = charon.VirtualFile()
|
||||
archive.open(stream, charon.OpenMode.WriteOnly)
|
||||
|
||||
#Store the g-code from the scene.
|
||||
archive.addContentType(extension = "gcode", mime_type = "text/x-gcode")
|
||||
gcode = archive.getStream("/3D/model.gcode")
|
||||
PluginRegistry.getInstance().getPluginObject("GCodeWriter").write(gcode, None)
|
||||
archive.addRelation(target = "/3D/model.gcode", file_type = "http://schemas.ultimaker.org/package/2018/relationships/gcode")
|
||||
|
||||
#Store the thumbnail.
|
||||
#TODO
|
Loading…
Add table
Add a link
Reference in a new issue