diff --git a/cura/ConvexHullJob.py b/cura/ConvexHullJob.py index 9de4f13073..3832e53df6 100644 --- a/cura/ConvexHullJob.py +++ b/cura/ConvexHullJob.py @@ -25,20 +25,22 @@ class ConvexHullJob(Job): child_hull = child.callDecoration("getConvexHull") if child_hull: hull.setPoints(numpy.append(hull.getPoints(), child_hull.getPoints(), axis = 0)) - + if hull.getPoints().size < 3: self._node.callDecoration("setConvexHull", None) self._node.callDecoration("setConvexHullJob", None) return - + else: if not self._node.getMeshData(): return mesh = self._node.getMeshData() vertex_data = mesh.getTransformed(self._node.getWorldTransformation()).getVertices() + # Don't use data below 0. TODO; We need a better check for this as this gives poor results for meshes with long edges. + vertex_data = vertex_data[vertex_data[:,1]>0] hull = Polygon(numpy.rint(vertex_data[:, [0, 2]]).astype(int)) - + # First, calculate the normal convex hull around the points hull = hull.getConvexHull() diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 6e64acc4e6..e2908c9f97 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -125,7 +125,7 @@ class CuraApplication(QtApplication): t = controller.getTool("TranslateTool") if t: - t.setEnabledAxis([ToolHandle.XAxis, ToolHandle.ZAxis]) + t.setEnabledAxis([ToolHandle.XAxis, ToolHandle.YAxis,ToolHandle.ZAxis]) Selection.selectionChanged.connect(self.onSelectionChanged) diff --git a/cura/PlatformPhysics.py b/cura/PlatformPhysics.py index 7f6c1df3b9..f1fc7fd0b1 100644 --- a/cura/PlatformPhysics.py +++ b/cura/PlatformPhysics.py @@ -19,6 +19,7 @@ from . import ConvexHullJob import time import threading +import copy class PlatformPhysics: def __init__(self, controller, volume): @@ -53,16 +54,21 @@ class PlatformPhysics: self._change_timer.start() continue + build_volume_bounding_box = copy.deepcopy(self._build_volume.getBoundingBox()) + build_volume_bounding_box.setBottom(-9001) # Ignore intersections with the bottom + # Mark the node as outside the build volume if the bounding box test fails. - if self._build_volume.getBoundingBox().intersectsBox(bbox) != AxisAlignedBox.IntersectionResult.FullIntersection: + if build_volume_bounding_box.intersectsBox(bbox) != AxisAlignedBox.IntersectionResult.FullIntersection: node._outside_buildarea = True else: node._outside_buildarea = False - # Move the node upwards if the bottom is below the build platform. + # Move it downwards if bottom is above platform move_vector = Vector() - if not Float.fuzzyCompare(bbox.bottom, 0.0): + if bbox.bottom > 0: move_vector.setY(-bbox.bottom) + #if not Float.fuzzyCompare(bbox.bottom, 0.0): + # pass#move_vector.setY(-bbox.bottom) # If there is no convex hull for the node, start calculating it and continue. if not node.getDecorator(ConvexHullDecorator):