From 329a0b121d8831c47f730c8db72d5654b90d4a74 Mon Sep 17 00:00:00 2001 From: Ruben D Date: Thu, 22 Mar 2018 01:38:34 +0100 Subject: [PATCH] Move shrinkage parameters into shrinkage function So that they are closer to where they are relevant if we're going to have more checks in this class. Contributes to issue CURA-4557. --- plugins/ModelChecker/ModelChecker.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/plugins/ModelChecker/ModelChecker.py b/plugins/ModelChecker/ModelChecker.py index 8e27171d68..5f3f7a8430 100644 --- a/plugins/ModelChecker/ModelChecker.py +++ b/plugins/ModelChecker/ModelChecker.py @@ -16,11 +16,6 @@ from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator catalog = i18nCatalog("cura") -SHRINKAGE_THRESHOLD = 0.5 #From what shrinkage percentage a warning will be issued about the model size. -WARNING_SIZE_XY = 150 #The horizontal size of a model that would be too large when dealing with shrinking materials. -WARNING_SIZE_Z = 100 #The vertical size of a model that would be too large when dealing with shrinking materials. - - class ModelChecker(QObject, Extension): ## Signal that gets emitted when anything changed that we need to check. onChanged = pyqtSignal() @@ -51,6 +46,10 @@ class ModelChecker(QObject, Extension): self._createView() def checkObjectsForShrinkage(self): + shrinkage_threshold = 0.5 #From what shrinkage percentage a warning will be issued about the model size. + warning_size_xy = 150 #The horizontal size of a model that would be too large when dealing with shrinking materials. + warning_size_z = 100 #The vertical size of a model that would be too large when dealing with shrinking materials. + material_shrinkage = self.getMaterialShrinkage() warning_nodes = [] @@ -58,9 +57,9 @@ class ModelChecker(QObject, Extension): # Check node material shrinkage and bounding box size for node in self.sliceableNodes(): node_extruder_position = node.callDecoration("getActiveExtruderPosition") - if material_shrinkage[node_extruder_position] > SHRINKAGE_THRESHOLD: + if material_shrinkage[node_extruder_position] > shrinkage_threshold: bbox = node.getBoundingBox() - if bbox.width >= WARNING_SIZE_XY or bbox.depth >= WARNING_SIZE_XY or bbox.height >= WARNING_SIZE_Z: + if bbox.width >= warning_size_xy or bbox.depth >= warning_size_xy or bbox.height >= warning_size_z: warning_nodes.append(node) return warning_nodes