diff options
author | Jaime van Kessel <nallath@gmail.com> | 2017-04-07 16:14:27 +0300 |
---|---|---|
committer | Jaime van Kessel <nallath@gmail.com> | 2017-04-07 16:14:27 +0300 |
commit | 20083831182eb3fbc4d43278dbb0ed5ee9cf631a (patch) | |
tree | aa818084c51665b4daa7a58b88aaa800316da066 /cura/Arrange.py | |
parent | 552b1ed4e882b853003233aea4216ba7a568886e (diff) |
Added disallowed areas to arranger
CURA-3239
Diffstat (limited to 'cura/Arrange.py')
-rwxr-xr-x | cura/Arrange.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/cura/Arrange.py b/cura/Arrange.py index 2ab407205c..2ce9cfe344 100755 --- a/cura/Arrange.py +++ b/cura/Arrange.py @@ -13,11 +13,14 @@ import copy ## Return object for bestSpot LocationSuggestion = namedtuple("LocationSuggestion", ["x", "y", "penalty_points", "priority"]) + ## The Arrange classed is used together with ShapeArray. Use it to find # good locations for objects that you try to put on a build place. # Different priority schemes can be defined so it alters the behavior while using # the same logic. class Arrange: + build_volume = None + def __init__(self, x, y, offset_x, offset_y, scale=1): self.shape = (y, x) self._priority = numpy.zeros((x, y), dtype=numpy.int32) @@ -50,6 +53,14 @@ class Arrange: points = copy.deepcopy(vertices._points) shape_arr = ShapeArray.fromPolygon(points, scale = scale) arranger.place(0, 0, shape_arr) + + # If a build volume was set, add the disallowed areas + if Arrange.build_volume: + disallowed_areas = Arrange.build_volume.getDisallowedAreas() + for area in disallowed_areas: + points = copy.deepcopy(area._points) + shape_arr = ShapeArray.fromPolygon(points, scale = scale) + arranger.place(0, 0, shape_arr) return arranger ## Find placement for a node (using offset shape) and place it (using hull shape) |