From b8fce75daca6240706177e12cd59b6cc36c1fb98 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 12 Feb 2018 11:12:55 +0100 Subject: [PATCH] Track index instead of finding it back later It has to iterate over all layers and do string comparison to find the index back. Instead we just keep track of the index so this should improve performance a bit. --- plugins/PostProcessingPlugin/scripts/PauseAtHeight.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py b/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py index 2cb41466b6..e7bafff726 100644 --- a/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py +++ b/plugins/PostProcessingPlugin/scripts/PauseAtHeight.py @@ -121,7 +121,7 @@ class PauseAtHeight(Script): # use offset to calculate the current height: = - layer_0_z = 0. got_first_g_cmd_on_layer_0 = False - for layer in data: + for index, layer in enumerate(data): lines = layer.split("\n") for line in lines: if ";LAYER:0" in line: @@ -146,7 +146,6 @@ class PauseAtHeight(Script): if current_height < pause_height: break #Try the next layer. - index = data.index(layer) prevLayer = data[index - 1] prevLines = prevLayer.split("\n") current_e = 0.