This commit is contained in:
Tamara Hogenhout 2015-08-13 14:04:11 +02:00
commit 178622a666
8 changed files with 46 additions and 41 deletions

View File

@ -36,7 +36,8 @@ class ConvexHullJob(Job):
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

View File

@ -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])

View File

@ -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)

View File

@ -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):
@ -109,6 +115,8 @@ class PlatformPhysics:
move_vector.setZ(overlap[1] * 1.1)
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)

View File

@ -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:

View File

@ -779,7 +779,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",
@ -792,7 +792,7 @@
"value": true
}
},
"machine_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",
@ -805,7 +805,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",
@ -817,7 +817,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",
@ -1676,6 +1676,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.",

View File

@ -64,14 +64,8 @@
"machine_extruder_end_code": {
"default": ""
},
"machine_switch_extruder_retraction_amount": {
"machine_heat_zone_length": {
"default": 16
},
"machine_switch_extruder_retraction_speed": {
"default": 20
},
"machine_switch_extruder_prime_speed": {
"default": 20
}
}
],
@ -92,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]],

View File

@ -69,14 +69,8 @@
"machine_extruder_end_code": {
"default": ""
},
"machine_switch_extruder_retraction_amount": {
"machine_heat_zone_length": {
"default": 16
},
"machine_switch_extruder_retraction_speed": {
"default": 20
},
"machine_switch_extruder_prime_speed": {
"default": 20
}
}
],
@ -92,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": {