Просмотр исходного кода

Head size & settings for one at a time & all at once printing

Jaime van Kessel 9 лет назад
Родитель
Сommit
a18f133e29
3 измененных файлов с 244 добавлено и 169 удалено
  1. 14 1
      cura/ConvexHullDecorator.py
  2. 7 2
      cura/ConvexHullJob.py
  3. 223 166
      resources/settings/fdmprinter.json

+ 14 - 1
cura/ConvexHullDecorator.py

@@ -1,4 +1,5 @@
 from UM.Scene.SceneNodeDecorator import SceneNodeDecorator
+from UM.Application import Application
 
 class ConvexHullDecorator(SceneNodeDecorator):
     def __init__(self):
@@ -6,7 +7,19 @@ class ConvexHullDecorator(SceneNodeDecorator):
         self._convex_hull = None
         self._convex_hull_node = None
         self._convex_hull_job = None
-        
+        settings = Application.getInstance().getActiveMachine()
+        print_sequence_setting = settings.getSettingByKey("print_sequence")
+        if print_sequence_setting:
+            print_sequence_setting.valueChanged.connect(self._onPrintSequenceSettingChanged)
+            
+    def _onPrintSequenceSettingChanged(self, setting):
+        if self._convex_hull_job:
+            self._convex_hull_job.cancel()
+        self.setConvexHull(None)
+        if self._convex_hull_node:
+            self._convex_hull_node.setParent(None)
+            self._convex_hull_node = None
+    
     def getConvexHull(self):
         return self._convex_hull
     

+ 7 - 2
cura/ConvexHullJob.py

@@ -41,10 +41,15 @@ class ConvexHullJob(Job):
         
         # First, calculate the normal convex hull around the points
         hull = hull.getConvexHull()
-        #print("hull: " , self._node.callDecoration("isGroup"), " " , hull.getPoints())
+
         # Then, do a Minkowski hull with a simple 1x1 quad to outset and round the normal convex hull.
+        # This is done because of rounding errors.
         hull = hull.getMinkowskiHull(Polygon(numpy.array([[-1, -1], [-1, 1], [1, 1], [1, -1]], numpy.float32)))
-       
+        settings = Application.getInstance().getActiveMachine()
+        
+        if settings.getSettingValueByKey("print_sequence") == "One at a time" and not self._node.getParent().callDecoration("isGroup"):
+            # Printing one at a time and it's not an object in a group
+            hull = hull.getMinkowskiHull(Polygon(numpy.array(settings.getSettingValueByKey("machine_head_polygon"),numpy.float32)))
         hull_node = ConvexHullNode.ConvexHullNode(self._node, hull, Application.getInstance().getController().getScene().getRoot())
         self._node.callDecoration("setConvexHullNode", hull_node)
         self._node.callDecoration("setConvexHull", hull)

Разница между файлами не показана из-за своего большого размера
+ 223 - 166
resources/settings/fdmprinter.json


Некоторые файлы не были показаны из-за большого количества измененных файлов