From 5c0e2d39a366d2daf78262f16826c27bf853a406 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Wed, 17 Jan 2018 11:54:22 +0100 Subject: [PATCH] Avoid zero thickness to be shown in layer view. --- plugins/SimulationView/SimulationView.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/SimulationView/SimulationView.py b/plugins/SimulationView/SimulationView.py index f667aff998..dfecda06bb 100644 --- a/plugins/SimulationView/SimulationView.py +++ b/plugins/SimulationView/SimulationView.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017 Ultimaker B.V. +# Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. import sys @@ -344,7 +344,12 @@ class SimulationView(View): self._max_feedrate = max(float(p.lineFeedrates.max()), self._max_feedrate) self._min_feedrate = min(float(p.lineFeedrates.min()), self._min_feedrate) self._max_thickness = max(float(p.lineThicknesses.max()), self._max_thickness) - self._min_thickness = min(float(p.lineThicknesses.min()), self._min_thickness) + try: + self._min_thickness = min(float(p.lineThicknesses[numpy.nonzero(p.lineThicknesses)].min()), self._min_thickness) + except: + # Sometimes, when importing a GCode the line thicknesses are zero and so the minimum (avoiding + # the zero) can't be calculated + Logger.log("i", "Min thickness can't be calculated because all the values are zero") if max_layer_number < layer_id: max_layer_number = layer_id if min_layer_number > layer_id: