From 6209a08121265c874dabf8e8bcf23fbfa482a1d4 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Sat, 3 Apr 2021 17:19:24 +0200 Subject: [PATCH] Fix accidentally always taking 0th line along The input array here is 2D, but always 1 by N long. The output of where then gives a tuple of two arrays, one indicating the Y positions and the other the X positions. The X positions were therefore always 0. The amin and amax functions were then always taking this index 0 along in their results, regardless of whether the line at that index was visible at all or not. This will also improve performance since it's checking the limits now only for half as many indices. --- plugins/SimulationView/SimulationView.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/SimulationView/SimulationView.py b/plugins/SimulationView/SimulationView.py index 903c937d19..9ae715beec 100644 --- a/plugins/SimulationView/SimulationView.py +++ b/plugins/SimulationView/SimulationView.py @@ -501,8 +501,8 @@ class SimulationView(CuraView): for layer_index in layer_data.getLayers(): for polyline in layer_data.getLayer(layer_index).polygons: is_visible = numpy.isin(polyline.types, visible_line_types) - visible_indices = numpy.where(is_visible) - if visible_indices[0].size == 0: # No items to take maximum or minimum of. + visible_indices = numpy.where(is_visible)[0] + if visible_indices.size == 0: # No items to take maximum or minimum of. continue visible_feedrates = numpy.take(polyline.lineFeedrates, visible_indices) visible_linewidths = numpy.take(polyline.lineWidths, visible_indices)