diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 57f238a9d7..dd59955b80 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -1815,17 +1815,13 @@ class CuraApplication(QtApplication): for node_ in DepthFirstIterator(root): if node_.callDecoration("isSliceable") and node_.callDecoration("getBuildPlateNumber") == target_build_plate: 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_id = self._global_container_stack.extruderList[int(default_extruder_position)].getId() select_models_on_load = self.getPreferences().getValue("cura/select_models_on_load") for original_node in nodes: - # Create a CuraSceneNode just if the original node is not that type if isinstance(original_node, CuraSceneNode): node = original_node @@ -1833,8 +1829,8 @@ class CuraApplication(QtApplication): node = CuraSceneNode() node.setMeshData(original_node.getMeshData()) - #Setting meshdata does not apply scaling. - if(original_node.getScale() != Vector(1.0, 1.0, 1.0)): + # Setting meshdata does not apply scaling. + if original_node.getScale() != Vector(1.0, 1.0, 1.0): node.scale(original_node.getScale()) node.setSelectable(True) @@ -1865,19 +1861,13 @@ class CuraApplication(QtApplication): if file_extension != "3mf": if node.callDecoration("isSliceable"): - # Only check position if it's not already blatantly obvious that it won't fit. - 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: - # Find node location - offset_shape_arr, hull_shape_arr = ShapeArray.fromNode(node, min_offset = min_offset) + # Ensure that the bottom of the bounding box is on the build plate + if node.getBoundingBox(): + center_y = node.getWorldPosition().y - node.getBoundingBox().bottom + else: + center_y = 0 - # If a model is to small then it will not contain any points - 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) + node.translate(Vector(0, center_y, 0)) # 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