diff options
author | Lipu Fei <lipu.fei815@gmail.com> | 2018-04-16 18:33:12 +0300 |
---|---|---|
committer | Lipu Fei <lipu.fei815@gmail.com> | 2018-04-16 18:33:14 +0300 |
commit | c381f3707b4e87a7518c0d16b1f3943512458f2f (patch) | |
tree | cd5ccfebd03fa558fcf963f6c9f8fcc902dc38b5 /plugins | |
parent | e5d795cc0b31b6818e048812c35f3a810e1b1ea5 (diff) |
Schedule model check for later if a machine change has not done yet
CURA-5239
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/ModelChecker/ModelChecker.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/plugins/ModelChecker/ModelChecker.py b/plugins/ModelChecker/ModelChecker.py index c7d36e9916..f85a7a249a 100644 --- a/plugins/ModelChecker/ModelChecker.py +++ b/plugins/ModelChecker/ModelChecker.py @@ -49,6 +49,13 @@ class ModelChecker(QObject, Extension): 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. + # This function can be triggered in the middle of a machine change, so do not proceed if the machine change + # has not done yet. + global_container_stack = Application.getInstance().getGlobalContainerStack() + if global_container_stack is None: + Application.getInstance().callLater(lambda: self.onChanged.emit()) + return False + material_shrinkage = self._getMaterialShrinkage() warning_nodes = [] @@ -56,6 +63,13 @@ class ModelChecker(QObject, Extension): # Check node material shrinkage and bounding box size for node in self.sliceableNodes(): node_extruder_position = node.callDecoration("getActiveExtruderPosition") + + # This function can be triggered in the middle of a machine change, so do not proceed if the machine change + # has not done yet. + if str(node_extruder_position) not in global_container_stack.extruders: + Application.getInstance().callLater(lambda: self.onChanged.emit()) + return False + 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: |