Skip to content

Commit

Permalink
re-add functions for arrange
Browse files Browse the repository at this point in the history
To avoid api break
new functions are added with the depricated decorator
  • Loading branch information
casperlamboo committed Oct 10, 2023
1 parent e257855 commit 4eb0ba9
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions cura/Arranging/Nest2DArrange.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from typing import List, TYPE_CHECKING, Optional, Tuple

from UM.Application import Application
from UM.Decorators import deprecated
from UM.Logger import Logger
from UM.Math.Matrix import Matrix
from UM.Math.Polygon import Polygon
Expand Down Expand Up @@ -149,3 +150,30 @@ def createGroupOperationForArrange(self, add_new_nodes_in_scene: bool = False) -
not_fit_count += 1

return grouped_operation, not_fit_count


@deprecated("Use the Nest2DArrange class instead")
def findNodePlacement(nodes_to_arrange: List["SceneNode"], build_volume: "BuildVolume",
fixed_nodes: Optional[List["SceneNode"]] = None, factor=10000) -> Tuple[bool, List[Item]]:
arranger = Nest2DArrange(nodes_to_arrange, build_volume, fixed_nodes, factor=factor)
return arranger.findNodePlacement()


@deprecated("Use the Nest2DArrange class instead")
def createGroupOperationForArrange(nodes_to_arrange: List["SceneNode"],
build_volume: "BuildVolume",
fixed_nodes: Optional[List["SceneNode"]] = None,
factor=10000,
add_new_nodes_in_scene: bool = False) -> Tuple[GroupedOperation, int]:
arranger = Nest2DArrange(nodes_to_arrange, build_volume, fixed_nodes, factor=factor)
return arranger.createGroupOperationForArrange(add_new_nodes_in_scene=add_new_nodes_in_scene)


@deprecated("Use the Nest2DArrange class instead")
def arrange(nodes_to_arrange: List["SceneNode"],
build_volume: "BuildVolume",
fixed_nodes: Optional[List["SceneNode"]] = None,
factor=10000,
add_new_nodes_in_scene: bool = False) -> bool:
arranger = Nest2DArrange(nodes_to_arrange, build_volume, fixed_nodes, factor=factor)
return arranger.arrange(add_new_nodes_in_scene=add_new_nodes_in_scene)

0 comments on commit 4eb0ba9

Please sign in to comment.