From c1a007d58f7f69a71e9650179886cf8e0a5340d3 Mon Sep 17 00:00:00 2001 From: jan Date: Wed, 6 Apr 2022 19:22:26 -0700 Subject: [PATCH] handle case with no labels on layer --- snarled/main.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/snarled/main.py b/snarled/main.py index 7c04a75..8cd13be 100644 --- a/snarled/main.py +++ b/snarled/main.py @@ -215,6 +215,10 @@ def label_polys( point_xys = [] point_names = [] nets = defaultdict(list) + + if not labels: + return nets, merge_groups + for x, y, point_name in labels: point_xys.append((x, y)) point_names.append(point_name) @@ -263,6 +267,9 @@ def label_poly( All the `point_names` which correspond to points inside the polygon (but not in its holes). """ + if not point_names: + return [] + poly_contour = scale_from_clipper(poly.Contour, clipper_scale_factor) inside = poly_contains_points(poly_contour, point_xys) for hole in poly.Childs: