From 0b62a312c3a21ca67aec63b29e64a200744b3ae5 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Wed, 14 Feb 2018 16:56:07 +0100 Subject: [PATCH] CURA-4869 Infill meshes influence layer count in layer view If a layer is empty, don't add it to the total layer count! --- plugins/SimulationView/SimulationView.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/SimulationView/SimulationView.py b/plugins/SimulationView/SimulationView.py index 253ece315e..35ce9cc37a 100644 --- a/plugins/SimulationView/SimulationView.py +++ b/plugins/SimulationView/SimulationView.py @@ -342,6 +342,11 @@ class SimulationView(View): min_layer_number = sys.maxsize max_layer_number = -sys.maxsize for layer_id in layer_data.getLayers(): + + # If a layer doesn't contain any polygons, skip it (for infill meshes taller than print objects + if len(layer_data.getLayer(layer_id).polygons) < 1: + continue + # Store the max and min feedrates and thicknesses for display purposes for p in layer_data.getLayer(layer_id).polygons: self._max_feedrate = max(float(p.lineFeedrates.max()), self._max_feedrate) @@ -634,4 +639,3 @@ class _CreateTopLayersJob(Job): def cancel(self): self._cancel = True super().cancel() -