mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Call checkObjectsForShrinkage directly from runChecks
I'd like to transition to a state where you can read in runChecks all the checks that are being run. The former function checkAllSliceableNodes is now a helper function to list sliceable nodes. Contributes to issue CURA-4557.
This commit is contained in:
parent
7ec7136a3a
commit
f5c1e59166
1 changed files with 5 additions and 7 deletions
|
@ -45,13 +45,13 @@ class ModelChecker(QObject, Extension):
|
||||||
def bindSignals(self):
|
def bindSignals(self):
|
||||||
Application.getInstance().getMachineManager().rootMaterialChanged.connect(self._onChanged)
|
Application.getInstance().getMachineManager().rootMaterialChanged.connect(self._onChanged)
|
||||||
|
|
||||||
def checkObjectsForShrinkage(self, nodes_to_check):
|
def checkObjectsForShrinkage(self):
|
||||||
material_shrinkage = self.getMaterialShrinkage()
|
material_shrinkage = self.getMaterialShrinkage()
|
||||||
|
|
||||||
warning_nodes = []
|
warning_nodes = []
|
||||||
|
|
||||||
# Check node material shrinkage and bounding box size
|
# Check node material shrinkage and bounding box size
|
||||||
for node in nodes_to_check:
|
for node in self.sliceableNodes():
|
||||||
node_extruder_position = node.callDecoration("getActiveExtruderPosition")
|
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()
|
bbox = node.getBoundingBox()
|
||||||
|
@ -60,14 +60,12 @@ class ModelChecker(QObject, Extension):
|
||||||
|
|
||||||
return warning_nodes
|
return warning_nodes
|
||||||
|
|
||||||
def checkAllSliceableNodes(self):
|
def sliceableNodes(self):
|
||||||
# Add all sliceable scene nodes to check
|
# Add all sliceable scene nodes to check
|
||||||
scene = Application.getInstance().getController().getScene()
|
scene = Application.getInstance().getController().getScene()
|
||||||
nodes_to_check = []
|
|
||||||
for node in DepthFirstIterator(scene.getRoot()):
|
for node in DepthFirstIterator(scene.getRoot()):
|
||||||
if node.callDecoration("isSliceable"):
|
if node.callDecoration("isSliceable"):
|
||||||
nodes_to_check.append(node)
|
yield node
|
||||||
return self.checkObjectsForShrinkage(nodes_to_check)
|
|
||||||
|
|
||||||
## Display warning message
|
## Display warning message
|
||||||
def showWarningMessage(self, warning_nodes):
|
def showWarningMessage(self, warning_nodes):
|
||||||
|
@ -108,7 +106,7 @@ class ModelChecker(QObject, Extension):
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def runChecks(self):
|
def runChecks(self):
|
||||||
warning_nodes = self.checkAllSliceableNodes()
|
warning_nodes = self.checkObjectsForShrinkage()
|
||||||
if warning_nodes:
|
if warning_nodes:
|
||||||
self.showWarningMessage(warning_nodes)
|
self.showWarningMessage(warning_nodes)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue