mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-15 00:05:59 +08:00
Merge branch 'master' of https://github.com/Ultimaker/Cura
This commit is contained in:
commit
178622a666
@ -25,20 +25,21 @@ class ConvexHullJob(Job):
|
|||||||
child_hull = child.callDecoration("getConvexHull")
|
child_hull = child.callDecoration("getConvexHull")
|
||||||
if child_hull:
|
if child_hull:
|
||||||
hull.setPoints(numpy.append(hull.getPoints(), child_hull.getPoints(), axis = 0))
|
hull.setPoints(numpy.append(hull.getPoints(), child_hull.getPoints(), axis = 0))
|
||||||
|
|
||||||
if hull.getPoints().size < 3:
|
if hull.getPoints().size < 3:
|
||||||
self._node.callDecoration("setConvexHull", None)
|
self._node.callDecoration("setConvexHull", None)
|
||||||
self._node.callDecoration("setConvexHullJob", None)
|
self._node.callDecoration("setConvexHullJob", None)
|
||||||
return
|
return
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if not self._node.getMeshData():
|
if not self._node.getMeshData():
|
||||||
return
|
return
|
||||||
mesh = self._node.getMeshData()
|
mesh = self._node.getMeshData()
|
||||||
vertex_data = mesh.getTransformed(self._node.getWorldTransformation()).getVertices()
|
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))
|
hull = Polygon(numpy.rint(vertex_data[:, [0, 2]]).astype(int))
|
||||||
|
|
||||||
# First, calculate the normal convex hull around the points
|
# First, calculate the normal convex hull around the points
|
||||||
hull = hull.getConvexHull()
|
hull = hull.getConvexHull()
|
||||||
|
|
||||||
@ -57,7 +58,7 @@ class ConvexHullJob(Job):
|
|||||||
self._node.callDecoration("setConvexHullNode", hull_node)
|
self._node.callDecoration("setConvexHullNode", hull_node)
|
||||||
self._node.callDecoration("setConvexHull", hull)
|
self._node.callDecoration("setConvexHull", hull)
|
||||||
self._node.callDecoration("setConvexHullJob", None)
|
self._node.callDecoration("setConvexHullJob", None)
|
||||||
|
|
||||||
if self._node.getParent().callDecoration("isGroup"):
|
if self._node.getParent().callDecoration("isGroup"):
|
||||||
job = self._node.getParent().callDecoration("getConvexHullJob")
|
job = self._node.getParent().callDecoration("getConvexHullJob")
|
||||||
if job:
|
if job:
|
||||||
|
@ -30,14 +30,14 @@ class ConvexHullNode(SceneNode):
|
|||||||
self._hull = hull
|
self._hull = hull
|
||||||
|
|
||||||
hull_points = self._hull.getPoints()
|
hull_points = self._hull.getPoints()
|
||||||
center = (hull_points.min(0) + hull_points.max(0)) / 2.0
|
|
||||||
|
|
||||||
mesh = MeshData()
|
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:
|
for point in hull_points:
|
||||||
mesh.addVertex(point[0], 0.1, point[1])
|
mesh.addVertex(point[0], 0.1, point[1])
|
||||||
|
|
||||||
indices = []
|
indices = []
|
||||||
for i in range(len(hull_points) - 1):
|
for i in range(len(hull_points) - 1):
|
||||||
indices.append([0, i + 1, i + 2])
|
indices.append([0, i + 1, i + 2])
|
||||||
|
@ -125,7 +125,7 @@ class CuraApplication(QtApplication):
|
|||||||
|
|
||||||
t = controller.getTool("TranslateTool")
|
t = controller.getTool("TranslateTool")
|
||||||
if t:
|
if t:
|
||||||
t.setEnabledAxis([ToolHandle.XAxis, ToolHandle.ZAxis])
|
t.setEnabledAxis([ToolHandle.XAxis, ToolHandle.YAxis,ToolHandle.ZAxis])
|
||||||
|
|
||||||
Selection.selectionChanged.connect(self.onSelectionChanged)
|
Selection.selectionChanged.connect(self.onSelectionChanged)
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ from . import ConvexHullJob
|
|||||||
|
|
||||||
import time
|
import time
|
||||||
import threading
|
import threading
|
||||||
|
import copy
|
||||||
|
|
||||||
class PlatformPhysics:
|
class PlatformPhysics:
|
||||||
def __init__(self, controller, volume):
|
def __init__(self, controller, volume):
|
||||||
@ -53,16 +54,21 @@ class PlatformPhysics:
|
|||||||
self._change_timer.start()
|
self._change_timer.start()
|
||||||
continue
|
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.
|
# 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
|
node._outside_buildarea = True
|
||||||
else:
|
else:
|
||||||
node._outside_buildarea = False
|
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()
|
move_vector = Vector()
|
||||||
if not Float.fuzzyCompare(bbox.bottom, 0.0):
|
if bbox.bottom > 0:
|
||||||
move_vector.setY(-bbox.bottom)
|
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 there is no convex hull for the node, start calculating it and continue.
|
||||||
if not node.getDecorator(ConvexHullDecorator):
|
if not node.getDecorator(ConvexHullDecorator):
|
||||||
@ -107,8 +113,10 @@ class PlatformPhysics:
|
|||||||
|
|
||||||
move_vector.setX(overlap[0] * 1.1)
|
move_vector.setX(overlap[0] * 1.1)
|
||||||
move_vector.setZ(overlap[1] * 1.1)
|
move_vector.setZ(overlap[1] * 1.1)
|
||||||
convex_hull = node.callDecoration("getConvexHull")
|
convex_hull = node.callDecoration("getConvexHull")
|
||||||
if convex_hull:
|
if convex_hull:
|
||||||
|
if not convex_hull.isValid():
|
||||||
|
return
|
||||||
# Check for collisions between disallowed areas and the object
|
# Check for collisions between disallowed areas and the object
|
||||||
for area in self._build_volume.getDisallowedAreas():
|
for area in self._build_volume.getDisallowedAreas():
|
||||||
overlap = convex_hull.intersectsPolygon(area)
|
overlap = convex_hull.intersectsPolygon(area)
|
||||||
|
@ -56,7 +56,10 @@ class USBPrinterManager(QObject, SignalEmitter, OutputDevicePlugin, Extension):
|
|||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
self._check_updates = False
|
self._check_updates = False
|
||||||
self._update_thread.join()
|
try:
|
||||||
|
self._update_thread.join()
|
||||||
|
except RuntimeError:
|
||||||
|
pass
|
||||||
|
|
||||||
def _updateThread(self):
|
def _updateThread(self):
|
||||||
while self._check_updates:
|
while self._check_updates:
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
"default": 1
|
"default": 1
|
||||||
},
|
},
|
||||||
"machine_use_extruder_offset_to_offset_coords": { "default": false },
|
"machine_use_extruder_offset_to_offset_coords": { "default": false },
|
||||||
|
|
||||||
"extruder_nr": { "default": 0 },
|
"extruder_nr": { "default": 0 },
|
||||||
"machine_nozzle_offset_x": { "default": 0, "SEE_machine_extruder_trains": true },
|
"machine_nozzle_offset_x": { "default": 0, "SEE_machine_extruder_trains": true },
|
||||||
"machine_nozzle_offset_y": { "default": 0, "SEE_machine_extruder_trains": true },
|
"machine_nozzle_offset_y": { "default": 0, "SEE_machine_extruder_trains": true },
|
||||||
@ -779,7 +779,7 @@
|
|||||||
"value": true
|
"value": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"machine_switch_extruder_retraction_amount": {
|
"switch_extruder_retraction_amount": {
|
||||||
"label": "Nozzle Switch Retraction Distance",
|
"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.",
|
"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",
|
"unit": "mm",
|
||||||
@ -792,7 +792,7 @@
|
|||||||
"value": true
|
"value": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"machine_switch_extruder_retraction_speed": {
|
"switch_extruder_retraction_speeds": {
|
||||||
"label": "Nozzle Switch 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.",
|
"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",
|
"unit": "mm/s",
|
||||||
@ -805,7 +805,7 @@
|
|||||||
"value": true
|
"value": true
|
||||||
},
|
},
|
||||||
"children": {
|
"children": {
|
||||||
"machine_switch_extruder_retraction_speed": {
|
"switch_extruder_retraction_speed": {
|
||||||
"label": "Nozzle Switch Retract Speed",
|
"label": "Nozzle Switch Retract Speed",
|
||||||
"description": "The speed at which the filament is retracted during a nozzle switch retract. ",
|
"description": "The speed at which the filament is retracted during a nozzle switch retract. ",
|
||||||
"unit": "mm/s",
|
"unit": "mm/s",
|
||||||
@ -817,7 +817,7 @@
|
|||||||
"value": true
|
"value": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"machine_switch_extruder_prime_speed": {
|
"switch_extruder_prime_speed": {
|
||||||
"label": "Nozzle Switch Prime Speed",
|
"label": "Nozzle Switch Prime Speed",
|
||||||
"description": "The speed at which the filament is pushed back after a nozzle switch retraction.",
|
"description": "The speed at which the filament is pushed back after a nozzle switch retraction.",
|
||||||
"unit": "mm/s",
|
"unit": "mm/s",
|
||||||
@ -1676,6 +1676,15 @@
|
|||||||
"max_value": 16,
|
"max_value": 16,
|
||||||
"inherit_function": "extruder_nr",
|
"inherit_function": "extruder_nr",
|
||||||
"children": {
|
"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": {
|
"support_roof_extruder_nr": {
|
||||||
"label": "Hammock Extruder",
|
"label": "Hammock Extruder",
|
||||||
"description": "The extruder train to use for printing the hammock. This is used in multi-extrusion.",
|
"description": "The extruder train to use for printing the hammock. This is used in multi-extrusion.",
|
||||||
|
@ -64,14 +64,8 @@
|
|||||||
"machine_extruder_end_code": {
|
"machine_extruder_end_code": {
|
||||||
"default": ""
|
"default": ""
|
||||||
},
|
},
|
||||||
"machine_switch_extruder_retraction_amount": {
|
"machine_heat_zone_length": {
|
||||||
"default": 16
|
"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_head_shape_max_y": { "default": 30 },
|
||||||
"machine_nozzle_gantry_distance": { "default": 55 },
|
"machine_nozzle_gantry_distance": { "default": 55 },
|
||||||
"machine_use_extruder_offset_to_offset_coords": { "default": true },
|
"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_gcode_flavor": { "default": "UltiGCode" },
|
||||||
"machine_disallowed_areas": { "default": [
|
"machine_disallowed_areas": { "default": [
|
||||||
[[-115.0, 112.5], [ -82.0, 112.5], [ -84.0, 104.5], [-115.0, 104.5]],
|
[[-115.0, 112.5], [ -82.0, 112.5], [ -84.0, 104.5], [-115.0, 104.5]],
|
||||||
|
@ -69,14 +69,8 @@
|
|||||||
"machine_extruder_end_code": {
|
"machine_extruder_end_code": {
|
||||||
"default": ""
|
"default": ""
|
||||||
},
|
},
|
||||||
"machine_switch_extruder_retraction_amount": {
|
"machine_heat_zone_length": {
|
||||||
"default": 16
|
"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_head_shape_max_y": { "default": 35 },
|
||||||
"machine_nozzle_gantry_distance": { "default": 55 },
|
"machine_nozzle_gantry_distance": { "default": 55 },
|
||||||
"machine_use_extruder_offset_to_offset_coords": { "default": true },
|
"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_gcode_flavor": { "default": "RepRap (Marlin/Sprinter)" },
|
||||||
|
|
||||||
"machine_start_gcode": {
|
"machine_start_gcode": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user