mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-20 01:29:04 +08:00
Merge branch 'output_device' of github.com:Ultimaker/cura into output_device
This commit is contained in:
commit
7c3e53f714
@ -10,18 +10,17 @@ import io
|
|||||||
class GCodeWriter(MeshWriter):
|
class GCodeWriter(MeshWriter):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._gcode = None
|
|
||||||
|
|
||||||
def write(self, file_name, storage_device, mesh_data):
|
def write(self, stream, node, mode = MeshWriter.OutputMode.TextMode):
|
||||||
if "gcode" in file_name:
|
if mode != MeshWriter.OutputMode.TextMode:
|
||||||
|
Logger.log("e", "GCode Writer does not support non-text mode")
|
||||||
|
return False
|
||||||
|
|
||||||
scene = Application.getInstance().getController().getScene()
|
scene = Application.getInstance().getController().getScene()
|
||||||
gcode_list = getattr(scene, "gcode_list")
|
gcode_list = getattr(scene, "gcode_list")
|
||||||
if gcode_list:
|
if gcode_list:
|
||||||
f = storage_device.openFile(file_name, "wt")
|
|
||||||
Logger.log("d", "Writing GCode to file %s", file_name)
|
|
||||||
for gcode in gcode_list:
|
for gcode in gcode_list:
|
||||||
f.write(gcode)
|
stream.write(gcode)
|
||||||
storage_device.closeFile(f)
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
@ -13,15 +13,17 @@ def getMetaData():
|
|||||||
"name": "GCode Writer",
|
"name": "GCode Writer",
|
||||||
"author": "Ultimaker",
|
"author": "Ultimaker",
|
||||||
"version": "1.0",
|
"version": "1.0",
|
||||||
"description": catalog.i18nc("GCode Writer Plugin Description", "Writes GCode to a file")
|
"description": catalog.i18nc("GCode Writer Plugin Description", "Writes GCode to a file"),
|
||||||
|
"api": 2
|
||||||
},
|
},
|
||||||
|
|
||||||
"mesh_writer": {
|
"mesh_writer": {
|
||||||
|
"output": [{
|
||||||
"extension": "gcode",
|
"extension": "gcode",
|
||||||
"description": catalog.i18nc("GCode Writer File Description", "GCode File"),
|
"description": catalog.i18nc("GCode Writer File Description", "GCode File"),
|
||||||
"mime_types": [
|
"mime_type": "text/x-gcode",
|
||||||
"text/x-gcode"
|
"mode": GCodeWriter.GCodeWriter.OutputMode.TextMode
|
||||||
]
|
}]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user