mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-13 02:19:06 +08:00
Merge branch 'master' of github.com:Ultimaker/Cura
This commit is contained in:
commit
1d1f10f853
@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2018 Ultimaker B.V.
|
# Copyright (c) 2020 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
import gzip
|
import gzip
|
||||||
@ -19,7 +19,7 @@ class GCodeGzReader(MeshReader):
|
|||||||
MimeTypeDatabase.addMimeType(
|
MimeTypeDatabase.addMimeType(
|
||||||
MimeType(
|
MimeType(
|
||||||
name = "application/x-cura-compressed-gcode-file",
|
name = "application/x-cura-compressed-gcode-file",
|
||||||
comment = "Cura Compressed GCode File",
|
comment = "Cura Compressed G-code File",
|
||||||
suffixes = ["gcode.gz"]
|
suffixes = ["gcode.gz"]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -312,7 +312,7 @@ class FlavorParser:
|
|||||||
# F5, that gcode SceneNode will be removed because it doesn't have a file to be reloaded from.
|
# F5, that gcode SceneNode will be removed because it doesn't have a file to be reloaded from.
|
||||||
#
|
#
|
||||||
def processGCodeStream(self, stream: str, filename: str) -> Optional["CuraSceneNode"]:
|
def processGCodeStream(self, stream: str, filename: str) -> Optional["CuraSceneNode"]:
|
||||||
Logger.log("d", "Preparing to load GCode")
|
Logger.log("d", "Preparing to load g-code")
|
||||||
self._cancelled = False
|
self._cancelled = False
|
||||||
# We obtain the filament diameter from the selected extruder to calculate line widths
|
# We obtain the filament diameter from the selected extruder to calculate line widths
|
||||||
global_stack = CuraApplication.getInstance().getGlobalContainerStack()
|
global_stack = CuraApplication.getInstance().getGlobalContainerStack()
|
||||||
@ -352,7 +352,7 @@ class FlavorParser:
|
|||||||
self._message.setProgress(0)
|
self._message.setProgress(0)
|
||||||
self._message.show()
|
self._message.show()
|
||||||
|
|
||||||
Logger.log("d", "Parsing Gcode...")
|
Logger.log("d", "Parsing g-code...")
|
||||||
|
|
||||||
current_position = Position(0, 0, 0, 0, [0])
|
current_position = Position(0, 0, 0, 0, [0])
|
||||||
current_path = [] #type: List[List[float]]
|
current_path = [] #type: List[List[float]]
|
||||||
@ -363,7 +363,7 @@ class FlavorParser:
|
|||||||
|
|
||||||
for line in stream.split("\n"):
|
for line in stream.split("\n"):
|
||||||
if self._cancelled:
|
if self._cancelled:
|
||||||
Logger.log("d", "Parsing Gcode file cancelled")
|
Logger.log("d", "Parsing g-code file cancelled.")
|
||||||
return None
|
return None
|
||||||
current_line += 1
|
current_line += 1
|
||||||
|
|
||||||
@ -482,7 +482,7 @@ class FlavorParser:
|
|||||||
gcode_dict = {active_build_plate_id: gcode_list}
|
gcode_dict = {active_build_plate_id: gcode_list}
|
||||||
CuraApplication.getInstance().getController().getScene().gcode_dict = gcode_dict #type: ignore #Because gcode_dict is generated dynamically.
|
CuraApplication.getInstance().getController().getScene().gcode_dict = gcode_dict #type: ignore #Because gcode_dict is generated dynamically.
|
||||||
|
|
||||||
Logger.log("d", "Finished parsing Gcode")
|
Logger.log("d", "Finished parsing g-code.")
|
||||||
self._message.hide()
|
self._message.hide()
|
||||||
|
|
||||||
if self._layer_number == 0:
|
if self._layer_number == 0:
|
||||||
@ -493,7 +493,7 @@ class FlavorParser:
|
|||||||
machine_depth = global_stack.getProperty("machine_depth", "value")
|
machine_depth = global_stack.getProperty("machine_depth", "value")
|
||||||
scene_node.setPosition(Vector(-machine_width / 2, 0, machine_depth / 2))
|
scene_node.setPosition(Vector(-machine_width / 2, 0, machine_depth / 2))
|
||||||
|
|
||||||
Logger.log("d", "GCode loading finished")
|
Logger.log("d", "G-code loading finished.")
|
||||||
|
|
||||||
if CuraApplication.getInstance().getPreferences().getValue("gcodereader/show_caution"):
|
if CuraApplication.getInstance().getPreferences().getValue("gcodereader/show_caution"):
|
||||||
caution_message = Message(catalog.i18nc(
|
caution_message = Message(catalog.i18nc(
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Copyright (c) 2017 Aleph Objects, Inc.
|
# Copyright (c) 2017 Aleph Objects, Inc.
|
||||||
# Copyright (c) 2018 Ultimaker B.V.
|
# Copyright (c) 2020 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
from typing import Optional, Union, List, TYPE_CHECKING
|
from typing import Optional, Union, List, TYPE_CHECKING
|
||||||
@ -32,7 +32,7 @@ class GCodeReader(MeshReader):
|
|||||||
MimeTypeDatabase.addMimeType(
|
MimeTypeDatabase.addMimeType(
|
||||||
MimeType(
|
MimeType(
|
||||||
name = "application/x-cura-gcode-file",
|
name = "application/x-cura-gcode-file",
|
||||||
comment = "Cura GCode File",
|
comment = "Cura G-code File",
|
||||||
suffixes = ["gcode"]
|
suffixes = ["gcode"]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# Copyright (c) 2020 Ultimaker B.V.
|
||||||
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
# Created by Wayne Porter
|
# Created by Wayne Porter
|
||||||
|
|
||||||
from ..Script import Script
|
from ..Script import Script
|
||||||
@ -24,8 +26,8 @@ class InsertAtLayerChange(Script):
|
|||||||
},
|
},
|
||||||
"gcode_to_add":
|
"gcode_to_add":
|
||||||
{
|
{
|
||||||
"label": "GCODE to insert.",
|
"label": "G-code to insert.",
|
||||||
"description": "GCODE to add before or after layer change.",
|
"description": "G-code to add before or after layer change.",
|
||||||
"type": "str",
|
"type": "str",
|
||||||
"default_value": ""
|
"default_value": ""
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2019 Ultimaker B.V.
|
# Copyright (c) 2020 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
from ..Script import Script
|
from ..Script import Script
|
||||||
@ -182,7 +182,22 @@ class PauseAtHeight(Script):
|
|||||||
"Repetier": "Repetier"
|
"Repetier": "Repetier"
|
||||||
},
|
},
|
||||||
"default_value": "RepRap (Marlin/Sprinter)",
|
"default_value": "RepRap (Marlin/Sprinter)",
|
||||||
"enabled": false
|
"enabled": false,
|
||||||
|
"default_value": ""
|
||||||
|
},
|
||||||
|
"custom_gcode_before_pause":
|
||||||
|
{
|
||||||
|
"label": "G-code Before Pause",
|
||||||
|
"description": "Any custom g-code to run before the pause, for example, M300 S440 P200 to beep.",
|
||||||
|
"type": "str",
|
||||||
|
"default_value": ""
|
||||||
|
},
|
||||||
|
"custom_gcode_after_pause":
|
||||||
|
{
|
||||||
|
"label": "G-code After Pause",
|
||||||
|
"description": "Any custom g-code to run after the pause, for example, M300 S440 P200 to beep.",
|
||||||
|
"type": "str",
|
||||||
|
"default_value": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}"""
|
}"""
|
||||||
@ -235,6 +250,8 @@ class PauseAtHeight(Script):
|
|||||||
control_temperatures = Application.getInstance().getGlobalContainerStack().getProperty("machine_nozzle_temp_enabled", "value")
|
control_temperatures = Application.getInstance().getGlobalContainerStack().getProperty("machine_nozzle_temp_enabled", "value")
|
||||||
initial_layer_height = Application.getInstance().getGlobalContainerStack().getProperty("layer_height_0", "value")
|
initial_layer_height = Application.getInstance().getGlobalContainerStack().getProperty("layer_height_0", "value")
|
||||||
display_text = self.getSettingValueByKey("display_text")
|
display_text = self.getSettingValueByKey("display_text")
|
||||||
|
gcode_before = self.getSettingValueByKey("custom_gcode_before_pause")
|
||||||
|
gcode_after = self.getSettingValueByKey("custom_gcode_after_pause")
|
||||||
|
|
||||||
pause_method = self.getSettingValueByKey("pause_method")
|
pause_method = self.getSettingValueByKey("pause_method")
|
||||||
pause_command = {
|
pause_command = {
|
||||||
@ -411,9 +428,17 @@ class PauseAtHeight(Script):
|
|||||||
if disarm_timeout > 0:
|
if disarm_timeout > 0:
|
||||||
prepend_gcode += self.putValue(M = 18, S = disarm_timeout) + " ; Set the disarm timeout\n"
|
prepend_gcode += self.putValue(M = 18, S = disarm_timeout) + " ; Set the disarm timeout\n"
|
||||||
|
|
||||||
|
# Set a custom GCODE section before pause
|
||||||
|
if gcode_before:
|
||||||
|
prepend_gcode += gcode_before + "\n"
|
||||||
|
|
||||||
# Wait till the user continues printing
|
# Wait till the user continues printing
|
||||||
prepend_gcode += pause_command + " ; Do the actual pause\n"
|
prepend_gcode += pause_command + " ; Do the actual pause\n"
|
||||||
|
|
||||||
|
# Set a custom GCODE section before pause
|
||||||
|
if gcode_after:
|
||||||
|
prepend_gcode += gcode_after + "\n"
|
||||||
|
|
||||||
if pause_method == "repetier":
|
if pause_method == "repetier":
|
||||||
#Push the filament back,
|
#Push the filament back,
|
||||||
if retraction_amount != 0:
|
if retraction_amount != 0:
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# Copyright (c) 2020 Ultimaker B.V.
|
||||||
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
# Created by Wayne Porter
|
# Created by Wayne Porter
|
||||||
|
|
||||||
from ..Script import Script
|
from ..Script import Script
|
||||||
@ -18,7 +20,7 @@ class TimeLapse(Script):
|
|||||||
"trigger_command":
|
"trigger_command":
|
||||||
{
|
{
|
||||||
"label": "Trigger camera command",
|
"label": "Trigger camera command",
|
||||||
"description": "Gcode command used to trigger camera.",
|
"description": "G-code command used to trigger camera.",
|
||||||
"type": "str",
|
"type": "str",
|
||||||
"default_value": "M240"
|
"default_value": "M240"
|
||||||
},
|
},
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# Copyright (c) 2018 Ultimaker B.V.
|
# Copyright (c) 2020 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
@ -522,7 +522,7 @@ class CommandBuffer:
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if len(sys.argv) < 2 or 3 < len(sys.argv):
|
if len(sys.argv) < 2 or 3 < len(sys.argv):
|
||||||
print("Usage: <input gcode> [output gcode]")
|
print("Usage: <input g-code> [output g-code]")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
in_filename = sys.argv[1]
|
in_filename = sys.argv[1]
|
||||||
out_filename = None
|
out_filename = None
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
# Copyright (c) 2020 Ultimaker B.V.
|
||||||
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
import functools
|
import functools
|
||||||
|
|
||||||
from UM.Qt.Duration import Duration
|
from UM.Qt.Duration import Duration
|
||||||
@ -55,7 +58,7 @@ def setup_module():
|
|||||||
MimeTypeDatabase.addMimeType(
|
MimeTypeDatabase.addMimeType(
|
||||||
MimeType(
|
MimeType(
|
||||||
name = "application/x-cura-gcode-file",
|
name = "application/x-cura-gcode-file",
|
||||||
comment = "Cura GCode File",
|
comment = "Cura G-code File",
|
||||||
suffixes = ["gcode"]
|
suffixes = ["gcode"]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user