Browse Source

Avoid zero thickness to be shown in layer view.

Diego Prado Gesto 7 years ago
parent
commit
5c0e2d39a3
1 changed files with 7 additions and 2 deletions
  1. 7 2
      plugins/SimulationView/SimulationView.py

+ 7 - 2
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.
 # Cura is released under the terms of the LGPLv3 or higher.
 
 
 import sys
 import sys
@@ -344,7 +344,12 @@ class SimulationView(View):
                     self._max_feedrate = max(float(p.lineFeedrates.max()), self._max_feedrate)
                     self._max_feedrate = max(float(p.lineFeedrates.max()), self._max_feedrate)
                     self._min_feedrate = min(float(p.lineFeedrates.min()), self._min_feedrate)
                     self._min_feedrate = min(float(p.lineFeedrates.min()), self._min_feedrate)
                     self._max_thickness = max(float(p.lineThicknesses.max()), self._max_thickness)
                     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:
                 if max_layer_number < layer_id:
                     max_layer_number = layer_id
                     max_layer_number = layer_id
                 if min_layer_number > layer_id:
                 if min_layer_number > layer_id: