diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2023-12-25 08:48:20 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-25 08:48:20 +0100 |
| commit | 9afbf02384400f53e9fb762b3a986b65e4e9b75e (patch) | |
| tree | af3ec7843bcfdae688ba9f2616526e3de94052e1 /lib/stitches/fill.py | |
| parent | 838d811ae69781e5304092f1d8172f3394ccea22 (diff) | |
Ignore multipoints in intersect regions with gratings (#2647)
Diffstat (limited to 'lib/stitches/fill.py')
| -rw-r--r-- | lib/stitches/fill.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/stitches/fill.py b/lib/stitches/fill.py index 2c5cdffc..9e9ff790 100644 --- a/lib/stitches/fill.py +++ b/lib/stitches/fill.py @@ -149,14 +149,13 @@ def intersect_region_with_grating(shape, angle, row_spacing, end_row_spacing=Non res = grating_line.intersection(shape) - if (isinstance(res, shapely.geometry.MultiLineString) or isinstance(res, shapely.geometry.GeometryCollection)): - runs = [line_string.coords for line_string in res.geoms if isinstance(line_string, shapely.geometry.LineString)] + if res.geom_type in ["MultiLineString", "GeometryCollection"]: + runs = [line_string.coords for line_string in res.geoms if line_string.geom_type == "LineString"] + elif res.geom_type in ["Point", "MultiPoint"] or res.is_empty: + # ignore if we intersected at a single point or no points + runs = [] else: - if res.is_empty or len(res.coords) == 1: - # ignore if we intersected at a single point or no points - runs = [] - else: - runs = [res.coords] + runs = [res.coords] if runs: runs.sort(key=lambda seg: (InkstitchPoint(*seg[0]) - upper_left).length()) |
