mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-24 06:39:38 +08:00
Update PurgeLinesAndUnload.py
Removed default 1mm border and added "Border Distance" setting.
This commit is contained in:
commit
6c81c232e1
@ -22,8 +22,6 @@ from enum import Enum
|
|||||||
class Location(str, Enum):
|
class Location(str, Enum):
|
||||||
LEFT = "left"
|
LEFT = "left"
|
||||||
RIGHT = "right"
|
RIGHT = "right"
|
||||||
TOP = "top"
|
|
||||||
BOTTOM = "bottom"
|
|
||||||
REAR = "rear"
|
REAR = "rear"
|
||||||
FRONT = "front"
|
FRONT = "front"
|
||||||
|
|
||||||
@ -98,8 +96,8 @@ class PurgeLinesAndUnload(Script):
|
|||||||
"options": {
|
"options": {
|
||||||
"left": "On left edge (Xmin)",
|
"left": "On left edge (Xmin)",
|
||||||
"right": "On right edge (Xmax)",
|
"right": "On right edge (Xmax)",
|
||||||
"bottom": "On front edge (Ymin)",
|
"front": "On front edge (Ymin)",
|
||||||
"top": "On back edge (Ymax)"},
|
"rear": "On back edge (Ymax)"},
|
||||||
"default_value": "left",
|
"default_value": "left",
|
||||||
"enabled": "add_purge_lines"
|
"enabled": "add_purge_lines"
|
||||||
},
|
},
|
||||||
@ -171,7 +169,11 @@ class PurgeLinesAndUnload(Script):
|
|||||||
"unload_quick_purge":
|
"unload_quick_purge":
|
||||||
{
|
{
|
||||||
"label": " Quick purge before unload",
|
"label": " Quick purge before unload",
|
||||||
|
<<<<<<< HEAD
|
||||||
"description": "When printing something fine that has a lot of retractions in a short space (like lettering or spires) right before the unload, the filament can get hung up in the hot end and unload can fail. A quick purge will soften the end of the filament so it will retract correctly. This 'quick puge' will take place at the last position of the nozzle. If there is no 'Present Print' move in the Ending Gcode then the Quick Purge can be over the print.",
|
"description": "When printing something fine that has a lot of retractions in a short space (like lettering or spires) right before the unload, the filament can get hung up in the hot end and unload can fail. A quick purge will soften the end of the filament so it will retract correctly. This 'quick puge' will take place at the last position of the nozzle. If there is no 'Present Print' move in the Ending Gcode then the Quick Purge can be over the print.",
|
||||||
|
=======
|
||||||
|
"description": "When printing something fine that has a lot of retractions in a short space (like lettering or spires) right before the unload, the filament can get hung up in the hot end and unload can fail. A quick purge will soften the end of the filament so it will retract correctly. This 'quick purge' will take place at the last position of the nozzle.",
|
||||||
|
>>>>>>> 1728db94273aa91e9497c0b5af02464b983e18c7
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
"default_value": false,
|
"default_value": false,
|
||||||
"enabled": "enable_unload"
|
"enabled": "enable_unload"
|
||||||
@ -483,7 +485,7 @@ class PurgeLinesAndUnload(Script):
|
|||||||
purge_str += f"G0 F{self.print_speed} X{self.machine_right - 3 - self.border_distance} Y{self.machine_back - 20} Z0.3 ; Slide over and down\n"
|
purge_str += f"G0 F{self.print_speed} X{self.machine_right - 3 - self.border_distance} Y{self.machine_back - 20} Z0.3 ; Slide over and down\n"
|
||||||
purge_str += f"G0 X{self.machine_right - 3 - self.border_distance} Y{self.machine_back - 35} ; Wipe\n"
|
purge_str += f"G0 X{self.machine_right - 3 - self.border_distance} Y{self.machine_back - 35} ; Wipe\n"
|
||||||
self.end_purge_location = Position.RIGHT_REAR
|
self.end_purge_location = Position.RIGHT_REAR
|
||||||
elif purge_location == Location.BOTTOM:
|
elif purge_location == Location.FRONT:
|
||||||
purge_len = int(self.machine_width) - self.nozzle_offset_x - 20 if purge_extrusion_full else int(
|
purge_len = int(self.machine_width) - self.nozzle_offset_x - 20 if purge_extrusion_full else int(
|
||||||
(self.machine_right - self.machine_left) / 2)
|
(self.machine_right - self.machine_left) / 2)
|
||||||
x_stop = int(self.machine_right - 10) if purge_extrusion_full else int(self.machine_width / 2)
|
x_stop = int(self.machine_right - 10) if purge_extrusion_full else int(self.machine_width / 2)
|
||||||
@ -503,7 +505,7 @@ class PurgeLinesAndUnload(Script):
|
|||||||
purge_str += f"G0 F{self.print_speed} X{self.machine_left + 20} Y{self.machine_front + 3 + self.border_distance} Z0.3 ; Slide over and down\n"
|
purge_str += f"G0 F{self.print_speed} X{self.machine_left + 20} Y{self.machine_front + 3 + self.border_distance} Z0.3 ; Slide over and down\n"
|
||||||
purge_str += f"G0 X{self.machine_left + 35} Y{self.machine_front + 3 + self.border_distance} ; Wipe\n"
|
purge_str += f"G0 X{self.machine_left + 35} Y{self.machine_front + 3 + self.border_distance} ; Wipe\n"
|
||||||
self.end_purge_location = Position.LEFT_FRONT
|
self.end_purge_location = Position.LEFT_FRONT
|
||||||
elif purge_location == Location.TOP:
|
elif purge_location == Location.REAR:
|
||||||
purge_len = int(self.machine_width - 20) if purge_extrusion_full else int(
|
purge_len = int(self.machine_width - 20) if purge_extrusion_full else int(
|
||||||
(self.machine_right - self.machine_left) / 2)
|
(self.machine_right - self.machine_left) / 2)
|
||||||
x_stop = int(self.machine_left + 10) if purge_extrusion_full else int(self.machine_width / 2)
|
x_stop = int(self.machine_left + 10) if purge_extrusion_full else int(self.machine_width / 2)
|
||||||
@ -564,7 +566,7 @@ class PurgeLinesAndUnload(Script):
|
|||||||
purge_str += f"G0 F{self.print_speed} X{self.machine_right - 3 - self.border_distance} Y{self.machine_back - 20} Z0.3 ; Slide over and down\n"
|
purge_str += f"G0 F{self.print_speed} X{self.machine_right - 3 - self.border_distance} Y{self.machine_back - 20} Z0.3 ; Slide over and down\n"
|
||||||
purge_str += f"G0 F{self.speed_travel} X{self.machine_right - 3 - self.border_distance} Y{self.machine_back - 35} ; Wipe\n"
|
purge_str += f"G0 F{self.speed_travel} X{self.machine_right - 3 - self.border_distance} Y{self.machine_back - 35} ; Wipe\n"
|
||||||
self.end_purge_location = Position.RIGHT_REAR
|
self.end_purge_location = Position.RIGHT_REAR
|
||||||
elif purge_location == Location.BOTTOM:
|
elif purge_location == Location.FRONT:
|
||||||
purge_len = int(self.machine_right - self.machine_left - 20) if purge_extrusion_full else int(
|
purge_len = int(self.machine_right - self.machine_left - 20) if purge_extrusion_full else int(
|
||||||
(self.machine_right - self.machine_left) / 2)
|
(self.machine_right - self.machine_left) / 2)
|
||||||
x_stop = int(self.machine_right - 10) if purge_extrusion_full else 0
|
x_stop = int(self.machine_right - 10) if purge_extrusion_full else 0
|
||||||
@ -583,7 +585,7 @@ class PurgeLinesAndUnload(Script):
|
|||||||
purge_str += f"G0 F{self.print_speed} X{self.machine_left + 20} Y{self.machine_front + 3 + self.border_distance} Z0.3 ; Slide over and down\n"
|
purge_str += f"G0 F{self.print_speed} X{self.machine_left + 20} Y{self.machine_front + 3 + self.border_distance} Z0.3 ; Slide over and down\n"
|
||||||
purge_str += f"G0 F{self.print_speed} X{self.machine_left + 35} Y{self.machine_front + 3 + self.border_distance} ; Wipe\n"
|
purge_str += f"G0 F{self.print_speed} X{self.machine_left + 35} Y{self.machine_front + 3 + self.border_distance} ; Wipe\n"
|
||||||
self.end_purge_location = Position.LEFT_FRONT
|
self.end_purge_location = Position.LEFT_FRONT
|
||||||
elif purge_location == Location.TOP:
|
elif purge_location == Location.REAR:
|
||||||
purge_len = int(self.machine_right - self.machine_left - 20) if purge_extrusion_full else abs(
|
purge_len = int(self.machine_right - self.machine_left - 20) if purge_extrusion_full else abs(
|
||||||
int(self.machine_right - 10))
|
int(self.machine_right - 10))
|
||||||
x_stop = int(self.machine_left + 10) if purge_extrusion_full else 0
|
x_stop = int(self.machine_left + 10) if purge_extrusion_full else 0
|
||||||
@ -607,7 +609,7 @@ class PurgeLinesAndUnload(Script):
|
|||||||
elif self.bed_shape == "elliptic":
|
elif self.bed_shape == "elliptic":
|
||||||
if purge_location in [Location.LEFT, Location.RIGHT]:
|
if purge_location in [Location.LEFT, Location.RIGHT]:
|
||||||
radius_1 = round((self.machine_width / 2) - 1, 2)
|
radius_1 = round((self.machine_width / 2) - 1, 2)
|
||||||
else: # For purge_location in [Location.BOTTOM, Location.TOP]
|
else: # For purge_location in [Location.FRONT, Location.REAR]
|
||||||
radius_1 = round((self.machine_depth / 2) - 1, 2)
|
radius_1 = round((self.machine_depth / 2) - 1, 2)
|
||||||
purge_len = int(radius_1) * math.pi / 4
|
purge_len = int(radius_1) * math.pi / 4
|
||||||
purge_volume = calculate_purge_volume(self.init_line_width, purge_len, self.mm3_per_mm)
|
purge_volume = calculate_purge_volume(self.init_line_width, purge_len, self.mm3_per_mm)
|
||||||
@ -643,7 +645,7 @@ class PurgeLinesAndUnload(Script):
|
|||||||
purge_str += f"G0 F{self.print_speed} X{round((radius_1 - 3) * .707 - 15, 2)} Z0.3 ; Slide Over\n"
|
purge_str += f"G0 F{self.print_speed} X{round((radius_1 - 3) * .707 - 15, 2)} Z0.3 ; Slide Over\n"
|
||||||
purge_str += f"G0 F{self.print_speed} X{round((radius_1 - 3) * .707, 2)} ; Wipe\n"
|
purge_str += f"G0 F{self.print_speed} X{round((radius_1 - 3) * .707, 2)} ; Wipe\n"
|
||||||
self.end_purge_location = Position.RIGHT_REAR
|
self.end_purge_location = Position.RIGHT_REAR
|
||||||
elif purge_location == Location.BOTTOM:
|
elif purge_location == Location.FRONT:
|
||||||
# Travel to the purge start
|
# Travel to the purge start
|
||||||
purge_str += f"G0 F{self.speed_travel} X-{round(radius_1 * .707, 2)} Y-{round(radius_1 * .707, 2)} ; Travel\n"
|
purge_str += f"G0 F{self.speed_travel} X-{round(radius_1 * .707, 2)} Y-{round(radius_1 * .707, 2)} ; Travel\n"
|
||||||
purge_str += f"G0 F600 Z0.3 ; Move down\n"
|
purge_str += f"G0 F600 Z0.3 ; Move down\n"
|
||||||
@ -659,7 +661,7 @@ class PurgeLinesAndUnload(Script):
|
|||||||
purge_str += f"G0 F{self.print_speed} Y-{round((radius_1 - 3) * .707 - 15, 2)} Z0.3 ; Slide Over\n"
|
purge_str += f"G0 F{self.print_speed} Y-{round((radius_1 - 3) * .707 - 15, 2)} Z0.3 ; Slide Over\n"
|
||||||
purge_str += f"G0 F{self.print_speed} Y-{round((radius_1 - 3) * .707, 2)} ; Wipe\n"
|
purge_str += f"G0 F{self.print_speed} Y-{round((radius_1 - 3) * .707, 2)} ; Wipe\n"
|
||||||
self.end_purge_location = Position.LEFT_FRONT
|
self.end_purge_location = Position.LEFT_FRONT
|
||||||
elif purge_location == Location.TOP:
|
elif purge_location == Location.REAR:
|
||||||
# Travel to the purge start
|
# Travel to the purge start
|
||||||
purge_str += f"G0 F{self.speed_travel} X{round(radius_1 * .707, 2)} Y{round(radius_1 * .707, 2)} ; Travel\n"
|
purge_str += f"G0 F{self.speed_travel} X{round(radius_1 * .707, 2)} Y{round(radius_1 * .707, 2)} ; Travel\n"
|
||||||
purge_str += f"G0 F600 Z0.3 ; Move down\n"
|
purge_str += f"G0 F600 Z0.3 ; Move down\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user