mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-30 06:45:14 +08:00
Remove the old arrange from mesh placement on load
For some reaso it was also handling the move up to the buildplate (which it really shouldn't do) CURA-7440
This commit is contained in:
parent
274dc8d06c
commit
2d084c9e2b
@ -1815,17 +1815,13 @@ class CuraApplication(QtApplication):
|
|||||||
for node_ in DepthFirstIterator(root):
|
for node_ in DepthFirstIterator(root):
|
||||||
if node_.callDecoration("isSliceable") and node_.callDecoration("getBuildPlateNumber") == target_build_plate:
|
if node_.callDecoration("isSliceable") and node_.callDecoration("getBuildPlateNumber") == target_build_plate:
|
||||||
fixed_nodes.append(node_)
|
fixed_nodes.append(node_)
|
||||||
machine_width = global_container_stack.getProperty("machine_width", "value")
|
|
||||||
machine_depth = global_container_stack.getProperty("machine_depth", "value")
|
|
||||||
arranger = Arrange.create(x = machine_width, y = machine_depth, fixed_nodes = fixed_nodes)
|
|
||||||
min_offset = 8
|
|
||||||
default_extruder_position = self.getMachineManager().defaultExtruderPosition
|
default_extruder_position = self.getMachineManager().defaultExtruderPosition
|
||||||
default_extruder_id = self._global_container_stack.extruderList[int(default_extruder_position)].getId()
|
default_extruder_id = self._global_container_stack.extruderList[int(default_extruder_position)].getId()
|
||||||
|
|
||||||
select_models_on_load = self.getPreferences().getValue("cura/select_models_on_load")
|
select_models_on_load = self.getPreferences().getValue("cura/select_models_on_load")
|
||||||
|
|
||||||
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):
|
||||||
node = original_node
|
node = original_node
|
||||||
@ -1833,8 +1829,8 @@ class CuraApplication(QtApplication):
|
|||||||
node = CuraSceneNode()
|
node = CuraSceneNode()
|
||||||
node.setMeshData(original_node.getMeshData())
|
node.setMeshData(original_node.getMeshData())
|
||||||
|
|
||||||
#Setting meshdata does not apply scaling.
|
# Setting meshdata does not apply scaling.
|
||||||
if(original_node.getScale() != Vector(1.0, 1.0, 1.0)):
|
if original_node.getScale() != Vector(1.0, 1.0, 1.0):
|
||||||
node.scale(original_node.getScale())
|
node.scale(original_node.getScale())
|
||||||
|
|
||||||
node.setSelectable(True)
|
node.setSelectable(True)
|
||||||
@ -1865,19 +1861,13 @@ class CuraApplication(QtApplication):
|
|||||||
|
|
||||||
if file_extension != "3mf":
|
if file_extension != "3mf":
|
||||||
if node.callDecoration("isSliceable"):
|
if node.callDecoration("isSliceable"):
|
||||||
# Only check position if it's not already blatantly obvious that it won't fit.
|
# Ensure that the bottom of the bounding box is on the build plate
|
||||||
if node.getBoundingBox() is None or self._volume.getBoundingBox() is None or node.getBoundingBox().width < self._volume.getBoundingBox().width or node.getBoundingBox().depth < self._volume.getBoundingBox().depth:
|
if node.getBoundingBox():
|
||||||
# Find node location
|
center_y = node.getWorldPosition().y - node.getBoundingBox().bottom
|
||||||
offset_shape_arr, hull_shape_arr = ShapeArray.fromNode(node, min_offset = min_offset)
|
else:
|
||||||
|
center_y = 0
|
||||||
|
|
||||||
# If a model is to small then it will not contain any points
|
node.translate(Vector(0, center_y, 0))
|
||||||
if offset_shape_arr is None and hull_shape_arr is None:
|
|
||||||
Message(self._i18n_catalog.i18nc("@info:status", "The selected model was too small to load."),
|
|
||||||
title = self._i18n_catalog.i18nc("@info:title", "Warning")).show()
|
|
||||||
return
|
|
||||||
|
|
||||||
# Step is for skipping tests to make it a lot faster. it also makes the outcome somewhat rougher
|
|
||||||
arranger.findNodePlacement(node, offset_shape_arr, hull_shape_arr, step = 10)
|
|
||||||
|
|
||||||
# This node is deep copied from some other node which already has a BuildPlateDecorator, but the deepcopy
|
# This node is deep copied from some other node which already has a BuildPlateDecorator, but the deepcopy
|
||||||
# of BuildPlateDecorator produces one that's associated with build plate -1. So, here we need to check if
|
# of BuildPlateDecorator produces one that's associated with build plate -1. So, here we need to check if
|
||||||
|
Loading…
x
Reference in New Issue
Block a user