From bdc1ec9047b3b190bea7673f5ce1078d9d0db53b Mon Sep 17 00:00:00 2001 From: Tim Kuipers Date: Thu, 13 Aug 2015 10:04:00 +0200 Subject: [PATCH 1/7] JSON: introduced machine_heat_zone_length also in UMO and UM2 --- resources/settings/fdmprinter.json | 2 +- resources/settings/ultimaker2.json | 10 ++-------- resources/settings/ultimaker_original.json | 10 ++-------- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/resources/settings/fdmprinter.json b/resources/settings/fdmprinter.json index b2f7a8a110..a370586bb1 100644 --- a/resources/settings/fdmprinter.json +++ b/resources/settings/fdmprinter.json @@ -48,7 +48,7 @@ "default": 1 }, "machine_use_extruder_offset_to_offset_coords": { "default": false }, - + "extruder_nr": { "default": 0 }, "machine_nozzle_offset_x": { "default": 0, "SEE_machine_extruder_trains": true }, "machine_nozzle_offset_y": { "default": 0, "SEE_machine_extruder_trains": true }, diff --git a/resources/settings/ultimaker2.json b/resources/settings/ultimaker2.json index 2f1b4bd408..16a002c290 100644 --- a/resources/settings/ultimaker2.json +++ b/resources/settings/ultimaker2.json @@ -64,14 +64,8 @@ "machine_extruder_end_code": { "default": "" }, - "machine_switch_extruder_retraction_amount": { - "default": 16 - }, - "machine_switch_extruder_retraction_speed": { - "default": 20 - }, - "machine_switch_extruder_prime_speed": { - "default": 20 + "machine_heat_zone_length": { + "default": 16 } } ], diff --git a/resources/settings/ultimaker_original.json b/resources/settings/ultimaker_original.json index 1ad53808fb..6c9ed09fc2 100644 --- a/resources/settings/ultimaker_original.json +++ b/resources/settings/ultimaker_original.json @@ -69,14 +69,8 @@ "machine_extruder_end_code": { "default": "" }, - "machine_switch_extruder_retraction_amount": { - "default": 16 - }, - "machine_switch_extruder_retraction_speed": { - "default": 20 - }, - "machine_switch_extruder_prime_speed": { - "default": 20 + "machine_heat_zone_length": { + "default": 16 } } ], From 196cf2bf516eeb56d19190c7443c0ca602cf0885 Mon Sep 17 00:00:00 2001 From: Tim Kuipers Date: Thu, 13 Aug 2015 10:31:25 +0200 Subject: [PATCH 2/7] renamed extruder_switch_retract settings and support_extruder_nr_layer_0 --- resources/settings/fdmprinter.json | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/resources/settings/fdmprinter.json b/resources/settings/fdmprinter.json index a370586bb1..06f0bc33a7 100644 --- a/resources/settings/fdmprinter.json +++ b/resources/settings/fdmprinter.json @@ -780,7 +780,7 @@ "value": true } }, - "machine_switch_extruder_retraction_amount": { + "switch_extruder_retraction_amount": { "label": "Nozzle Switch Retraction Distance", "description": "The amount of retraction: Set at 0 for no retraction at all. This should generally be the same as the length of the heat zone.", "unit": "mm", @@ -793,7 +793,7 @@ "value": true } }, - "machine_switch_extruder_retraction_speed": { + "switch_extruder_retraction_speed": { "label": "Nozzle Switch Retraction Speed", "description": "The speed at which the filament is retracted. A higher retraction speed works better, but a very high retraction speed can lead to filament grinding.", "unit": "mm/s", @@ -806,7 +806,7 @@ "value": true }, "children": { - "machine_switch_extruder_retraction_speed": { + "switch_extruder_retraction_speed": { "label": "Nozzle Switch Retract Speed", "description": "The speed at which the filament is retracted during a nozzle switch retract. ", "unit": "mm/s", @@ -818,7 +818,7 @@ "value": true } }, - "machine_switch_extruder_prime_speed": { + "switch_extruder_prime_speed": { "label": "Nozzle Switch Prime Speed", "description": "The speed at which the filament is pushed back after a nozzle switch retraction.", "unit": "mm/s", @@ -1677,6 +1677,15 @@ "max_value": 16, "inherit_function": "extruder_nr", "children": { + "support_extruder_nr_layer_0": { + "label": "First Layer Support Extruder", + "description": "The extruder train to use for printing the first layer of support. This is used in multi-extrusion.", + "type": "int", + "default": 0, + "min_value": 0, + "max_value": 16, + "inherit": true + }, "support_roof_extruder_nr": { "label": "Hammock Extruder", "description": "The extruder train to use for printing the hammock. This is used in multi-extrusion.", From 49e39d637c4a8c5a4bd3821d88da0d4105a53356 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 13 Aug 2015 11:25:34 +0200 Subject: [PATCH 3/7] Added cutoff distance --- cura/ConvexHullJob.py | 8 +++++--- cura/CuraApplication.py | 2 +- cura/PlatformPhysics.py | 12 +++++++++--- 3 files changed, 15 insertions(+), 7 deletions(-) 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): From 62acbb0daddf12bc89e4f43c029f3703950087dc Mon Sep 17 00:00:00 2001 From: Tim Kuipers Date: Thu, 13 Aug 2015 11:51:06 +0200 Subject: [PATCH 4/7] JSON bugfix: parent had same name as child, for switch_extruder_retraction_speed --- resources/settings/fdmprinter.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/settings/fdmprinter.json b/resources/settings/fdmprinter.json index 06f0bc33a7..2fd4c76e2a 100644 --- a/resources/settings/fdmprinter.json +++ b/resources/settings/fdmprinter.json @@ -793,7 +793,7 @@ "value": true } }, - "switch_extruder_retraction_speed": { + "switch_extruder_retraction_speeds": { "label": "Nozzle Switch Retraction Speed", "description": "The speed at which the filament is retracted. A higher retraction speed works better, but a very high retraction speed can lead to filament grinding.", "unit": "mm/s", From a63d08288ab69d39201069ccc83cfebe7f2ce021 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 13 Aug 2015 12:14:47 +0200 Subject: [PATCH 5/7] Ignored runtime exception for usb thread --- plugins/USBPrinting/USBPrinterManager.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/USBPrinting/USBPrinterManager.py b/plugins/USBPrinting/USBPrinterManager.py index 21c7fb82c2..4363883b2b 100644 --- a/plugins/USBPrinting/USBPrinterManager.py +++ b/plugins/USBPrinting/USBPrinterManager.py @@ -56,7 +56,10 @@ class USBPrinterManager(QObject, SignalEmitter, OutputDevicePlugin, Extension): def stop(self): self._check_updates = False - self._update_thread.join() + try: + self._update_thread.join() + except RuntimeError: + pass def _updateThread(self): while self._check_updates: From eba71a25169399031b655f13b5697d26105f90dd Mon Sep 17 00:00:00 2001 From: Tim Kuipers Date: Thu, 13 Aug 2015 12:30:06 +0200 Subject: [PATCH 6/7] JSON: removed machine_nozzle_offset_x_1 --- resources/settings/ultimaker2.json | 2 -- resources/settings/ultimaker_original.json | 2 -- 2 files changed, 4 deletions(-) diff --git a/resources/settings/ultimaker2.json b/resources/settings/ultimaker2.json index 16a002c290..e6f3e0de13 100644 --- a/resources/settings/ultimaker2.json +++ b/resources/settings/ultimaker2.json @@ -86,8 +86,6 @@ "machine_head_shape_max_y": { "default": 30 }, "machine_nozzle_gantry_distance": { "default": 55 }, "machine_use_extruder_offset_to_offset_coords": { "default": true }, - "machine_nozzle_offset_x_1": { "default": 18.0 }, - "machine_nozzle_offset_y_1": { "default": 0.0 }, "machine_gcode_flavor": { "default": "UltiGCode" }, "machine_disallowed_areas": { "default": [ [[-115.0, 112.5], [ -82.0, 112.5], [ -84.0, 104.5], [-115.0, 104.5]], diff --git a/resources/settings/ultimaker_original.json b/resources/settings/ultimaker_original.json index 6c9ed09fc2..11d2babe94 100644 --- a/resources/settings/ultimaker_original.json +++ b/resources/settings/ultimaker_original.json @@ -86,8 +86,6 @@ "machine_head_shape_max_y": { "default": 35 }, "machine_nozzle_gantry_distance": { "default": 55 }, "machine_use_extruder_offset_to_offset_coords": { "default": true }, - "machine_nozzle_offset_x_1": { "default": 18.0 }, - "machine_nozzle_offset_y_1": { "default": 0.0 }, "machine_gcode_flavor": { "default": "RepRap (Marlin/Sprinter)" }, "machine_start_gcode": { From ddc34eaa3a14b9f71e6af9f85463be3fa1689764 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 13 Aug 2015 13:35:51 +0200 Subject: [PATCH 7/7] Fixed bug that caused crash when object was entirely below platform --- cura/ConvexHullJob.py | 3 +-- cura/ConvexHullNode.py | 10 +++++----- cura/PlatformPhysics.py | 4 +++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/cura/ConvexHullJob.py b/cura/ConvexHullJob.py index 3832e53df6..8369d050c8 100644 --- a/cura/ConvexHullJob.py +++ b/cura/ConvexHullJob.py @@ -38,7 +38,6 @@ class ConvexHullJob(Job): 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 @@ -59,7 +58,7 @@ class ConvexHullJob(Job): self._node.callDecoration("setConvexHullNode", hull_node) self._node.callDecoration("setConvexHull", hull) self._node.callDecoration("setConvexHullJob", None) - + if self._node.getParent().callDecoration("isGroup"): job = self._node.getParent().callDecoration("getConvexHullJob") if job: diff --git a/cura/ConvexHullNode.py b/cura/ConvexHullNode.py index e24d79522c..d610149072 100644 --- a/cura/ConvexHullNode.py +++ b/cura/ConvexHullNode.py @@ -30,14 +30,14 @@ class ConvexHullNode(SceneNode): self._hull = hull hull_points = self._hull.getPoints() - center = (hull_points.min(0) + hull_points.max(0)) / 2.0 - mesh = MeshData() - mesh.addVertex(center[0], 0.1, center[1]) - + if len(hull_points) > 3: + center = (hull_points.min(0) + hull_points.max(0)) / 2.0 + mesh.addVertex(center[0], 0.1, center[1]) + else: #Hull has not enough points + return for point in hull_points: mesh.addVertex(point[0], 0.1, point[1]) - indices = [] for i in range(len(hull_points) - 1): indices.append([0, i + 1, i + 2]) diff --git a/cura/PlatformPhysics.py b/cura/PlatformPhysics.py index f1fc7fd0b1..ee6e39f03b 100644 --- a/cura/PlatformPhysics.py +++ b/cura/PlatformPhysics.py @@ -113,8 +113,10 @@ class PlatformPhysics: move_vector.setX(overlap[0] * 1.1) move_vector.setZ(overlap[1] * 1.1) - convex_hull = node.callDecoration("getConvexHull") + convex_hull = node.callDecoration("getConvexHull") if convex_hull: + if not convex_hull.isValid(): + return # Check for collisions between disallowed areas and the object for area in self._build_volume.getDisallowedAreas(): overlap = convex_hull.intersectsPolygon(area)