From e256f56f2b85640ac5368377fe21bd683a969da9 Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Mon, 29 Jul 2024 01:47:12 -0700 Subject: [PATCH] fix handling of 3d polys --- gridlock/draw.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gridlock/draw.py b/gridlock/draw.py index 7146e15..e68fdc6 100644 --- a/gridlock/draw.py +++ b/gridlock/draw.py @@ -60,12 +60,14 @@ class GridDrawMixin(GridPosMixin): # Check polygons, and remove redundant coordinates surface = numpy.delete(range(3), surface_normal) - for i, polygon in enumerate(poly_list): - malformed = f'Malformed polygon: ({i})' + for ii in range(len(poly_list)): + polygon = poly_list[ii] + malformed = f'Malformed polygon: ({ii})' if polygon.shape[1] not in (2, 3): raise GridError(malformed + 'must be a Nx2 or Nx3 ndarray') if polygon.shape[1] == 3: polygon = polygon[surface, :] + poly_list[ii] = polygon if not polygon.shape[0] > 2: raise GridError(malformed + 'must consist of more than 2 points')