From 39287264d987d1148c40a515c4e2842d71db20ba Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 30 Oct 2020 18:12:18 +0100 Subject: [PATCH] Pynest2d.Point requires integer coordinates These were floats. Rounding numpy-floats still results in floats so I'm just using int(). The result is rounded down instead of nearest, but the difference is at most 50 nanometres anyway. Contributes to issue CURA-7501. --- cura/Arranging/Nest2DArrange.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cura/Arranging/Nest2DArrange.py b/cura/Arranging/Nest2DArrange.py index d4da9266c7..cdf590232c 100644 --- a/cura/Arranging/Nest2DArrange.py +++ b/cura/Arranging/Nest2DArrange.py @@ -1,3 +1,6 @@ +# Copyright (c) 2020 Ultimaker B.V. +# Cura is released under the terms of the LGPLv3 or higher. + import numpy from pynest2d import Point, Box, Item, NfpConfig, nest from typing import List, TYPE_CHECKING, Optional, Tuple @@ -50,7 +53,7 @@ def findNodePlacement(nodes_to_arrange: List["SceneNode"], build_volume: "BuildV continue converted_points = [] for point in hull_polygon.getPoints(): - converted_points.append(Point(point[0] * factor, point[1] * factor)) + converted_points.append(Point(int(point[0] * factor), int(point[1] * factor))) item = Item(converted_points) node_items.append(item) @@ -74,7 +77,7 @@ def findNodePlacement(nodes_to_arrange: List["SceneNode"], build_volume: "BuildV if clipped_area.getPoints() is not None: # numpy array has to be explicitly checked against None for point in clipped_area.getPoints(): - converted_points.append(Point(point[0] * factor, point[1] * factor)) + converted_points.append(Point(int(point[0] * factor), int(point[1] * factor))) disallowed_area = Item(converted_points) disallowed_area.markAsDisallowedAreaInBin(0)