mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 18:05:55 +08:00
Let autoplacement also take the existing nodes into account
CURA-7440
This commit is contained in:
parent
a34f1a6504
commit
30966beed2
@ -15,6 +15,9 @@ def findNodePlacement(nodes_to_arrange, build_volume, fixed_nodes = None, factor
|
|||||||
machine_depth = build_volume.getDepth()
|
machine_depth = build_volume.getDepth()
|
||||||
build_plate_bounding_box = Box(machine_width * factor, machine_depth * factor)
|
build_plate_bounding_box = Box(machine_width * factor, machine_depth * factor)
|
||||||
|
|
||||||
|
if fixed_nodes is None:
|
||||||
|
fixed_nodes = []
|
||||||
|
|
||||||
# Add all the items we want to arrange
|
# Add all the items we want to arrange
|
||||||
node_items = []
|
node_items = []
|
||||||
for node in nodes_to_arrange:
|
for node in nodes_to_arrange:
|
||||||
@ -51,6 +54,18 @@ def findNodePlacement(nodes_to_arrange, build_volume, fixed_nodes = None, factor
|
|||||||
node_items.append(disallowed_area)
|
node_items.append(disallowed_area)
|
||||||
num_disallowed_areas_added += 1
|
num_disallowed_areas_added += 1
|
||||||
|
|
||||||
|
for node in fixed_nodes:
|
||||||
|
converted_points = []
|
||||||
|
hull_polygon = node.callDecoration("getConvexHull")
|
||||||
|
|
||||||
|
for point in hull_polygon.getPoints():
|
||||||
|
converted_points.append(Point(point[0] * factor, point[1] * factor))
|
||||||
|
item = Item(converted_points)
|
||||||
|
node_items.append(item)
|
||||||
|
item.markAsFixedInBin(0)
|
||||||
|
node_items.append(item)
|
||||||
|
num_disallowed_areas_added += 1
|
||||||
|
|
||||||
config = NfpConfig()
|
config = NfpConfig()
|
||||||
config.accuracy = 1.0
|
config.accuracy = 1.0
|
||||||
|
|
||||||
|
@ -1824,6 +1824,12 @@ class CuraApplication(QtApplication):
|
|||||||
|
|
||||||
nodes_to_arrange = [] # type: List[CuraSceneNode]
|
nodes_to_arrange = [] # type: List[CuraSceneNode]
|
||||||
|
|
||||||
|
fixed_nodes = []
|
||||||
|
for node_ in DepthFirstIterator(self.getController().getScene().getRoot()):
|
||||||
|
# Only count sliceable objects
|
||||||
|
if node_.callDecoration("isSliceable"):
|
||||||
|
fixed_nodes.append(node_)
|
||||||
|
|
||||||
for original_node in nodes:
|
for original_node in nodes:
|
||||||
# Create a CuraSceneNode just if the original node is not that type
|
# Create a CuraSceneNode just if the original node is not that type
|
||||||
if isinstance(original_node, CuraSceneNode):
|
if isinstance(original_node, CuraSceneNode):
|
||||||
@ -1892,7 +1898,7 @@ class CuraApplication(QtApplication):
|
|||||||
if select_models_on_load:
|
if select_models_on_load:
|
||||||
Selection.add(node)
|
Selection.add(node)
|
||||||
|
|
||||||
arrange(nodes_to_arrange, self.getBuildVolume())
|
arrange(nodes_to_arrange, self.getBuildVolume(), fixed_nodes)
|
||||||
|
|
||||||
self.fileCompleted.emit(file_name)
|
self.fileCompleted.emit(file_name)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user