Skip to content

Commit

Permalink
Update AddCoolingProfile.py
Browse files Browse the repository at this point in the history
Add a kick-out if "One at a Time" is enabled in Cura.
  • Loading branch information
GregValiant committed Sep 10, 2023
1 parent 0eeffcd commit 34d348d
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions plugins/PostProcessingPlugin/scripts/AddCoolingProfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,15 @@
from ..Script import Script
from UM.Application import Application
import re
from UM.Message import Message

class AddCoolingProfile(Script):

def __init__(self):
super().__init__()
if str(Application.getInstance().getGlobalContainerStack().getProperty("print_sequence", "value")) == "one_at_a_time":
Message(title = "Advanced Cooling Fan Control", text = "The post processor will not run because it is not compatible with 'One at a Time' mode.").show()

def getSettingDataString(self):
return """{
"name": "Advanced Cooling Fan Control",
Expand Down Expand Up @@ -293,6 +299,12 @@ def execute(self, data):
bed_adhesion = (extrud[0].getProperty("adhesion_type", "value"))
extruder_count = Application.getInstance().getGlobalContainerStack().getProperty("machine_extruder_count", "value")

# Message the user and exit if "One-at-a-Time" mode is enabled----------------------------
if str(Application.getInstance().getGlobalContainerStack().getProperty("print_sequence", "value")) == "one_at_a_time":
data[0] += "; [Advanced Cooling Fan Control] did not run because it is not compatible with 'One at a Time' mode.\n"
Message(title = "[Advanced Cooling Fan Control]", text = "The post processor exited because it is not compatible with 'One at a Time' mode.").show()
return data

#Assign the fan numbers to the tools----------------------------------------------------------
if extruder_count == 1:
is_multi_fan = False
Expand Down Expand Up @@ -647,7 +659,7 @@ def execute(self, data):
current_fan_speed = "0"
for my_index in range(1, len(data) - 1, 1):
layer = data[my_index]
if ";LAYER:" + str(the_start_layer) in layer:
if ";LAYER:" + str(the_start_layer) + "\n" in layer:
start_index = int(my_index) - 1
break
#Track the previous tool changes
Expand Down Expand Up @@ -698,7 +710,7 @@ def execute(self, data):
if ";LAYER:" in line:
layer_number = str(line.split(":")[1])
modified_data += line + "\n"
if int(layer_number) >= int(the_start_layer):
if int(layer_number) >= int(the_start_layer): # Problem with oneatatime < start
if ";TYPE:SKIRT" in line:
modified_data += line + "\n"
modified_data += fan_sp_skirt + this_fan + "\n"
Expand Down

0 comments on commit 34d348d

Please sign in to comment.