From 395244ee8315d7ac5f8a873f47e5ef1cbe9a1db4 Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Sat, 14 Feb 2026 16:58:24 -0800 Subject: [PATCH] [examples] some cleanup --- examples/nested_poly_test.py | 8 +++----- examples/tutorial/pcgen.py | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/examples/nested_poly_test.py b/examples/nested_poly_test.py index de51d6a..60e0a3e 100644 --- a/examples/nested_poly_test.py +++ b/examples/nested_poly_test.py @@ -1,7 +1,5 @@ -import numpy from pyclipper import ( - Pyclipper, PT_CLIP, PT_SUBJECT, CT_UNION, CT_INTERSECTION, PFT_NONZERO, - scale_to_clipper, scale_from_clipper, + Pyclipper, PT_SUBJECT, CT_UNION, PFT_NONZERO, ) p = Pyclipper() p.AddPaths([ @@ -12,8 +10,8 @@ p.AddPaths([ ], PT_SUBJECT, closed=True) #p.Execute2? #p.Execute? -p.Execute(PT_UNION, PT_NONZERO, PT_NONZERO) -p.Execute(CT_UNION, PT_NONZERO, PT_NONZERO) +p.Execute(CT_UNION, PFT_NONZERO, PFT_NONZERO) +p.Execute(CT_UNION, PFT_NONZERO, PFT_NONZERO) p.Execute(CT_UNION, PFT_NONZERO, PFT_NONZERO) p = Pyclipper() diff --git a/examples/tutorial/pcgen.py b/examples/tutorial/pcgen.py index 14d9994..5c5c31b 100644 --- a/examples/tutorial/pcgen.py +++ b/examples/tutorial/pcgen.py @@ -50,7 +50,7 @@ def triangular_lattice( elif origin == 'corner': pass else: - raise Exception(f'Invalid value for `origin`: {origin}') + raise ValueError(f'Invalid value for `origin`: {origin}') return xy[xy[:, 0].argsort(), :] @@ -197,7 +197,7 @@ def ln_defect( `[[x0, y0], [x1, y1], ...]` for all the holes """ if defect_length % 2 != 1: - raise Exception('defect_length must be odd!') + raise ValueError('defect_length must be odd!') pp = triangular_lattice([2 * dd + 1 for dd in mirror_dims]) half_length = numpy.floor(defect_length / 2) hole_nums = numpy.arange(-half_length, half_length + 1)