mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 14:37:29 -06:00
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.
This commit is contained in:
parent
80b99e0323
commit
b8fce75dac
1 changed files with 1 additions and 2 deletions
|
@ -121,7 +121,7 @@ class PauseAtHeight(Script):
|
|||
# use offset to calculate the current height: <current_height> = <current_z> - <layer_0_z>
|
||||
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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue