diff options
author | jaseg <git@jaseg.net> | 2020-01-10 07:38:16 +0100 |
---|---|---|
committer | jaseg <git@jaseg.net> | 2020-01-10 07:45:11 +0100 |
commit | 29a20da87fae96cf89e082f8b0d4e194b662b55e (patch) | |
tree | 95c3f7ab0b4dfdd7b21462ecc5355536eea760da | |
parent | cbbdba053e9eca935ad80eb35e0ede4bb84776df (diff) | |
download | gerbolyze-29a20da87fae96cf89e082f8b0d4e194b662b55e.tar.gz gerbolyze-29a20da87fae96cf89e082f8b0d4e194b662b55e.tar.bz2 gerbolyze-29a20da87fae96cf89e082f8b0d4e194b662b55e.zip |
Add handling for layers without apertures
Fixes #4
-rwxr-xr-x | gerbolyze.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gerbolyze.py b/gerbolyze.py index fad7a33..47a9e33 100755 --- a/gerbolyze.py +++ b/gerbolyze.py @@ -224,6 +224,7 @@ def plot_contours( scale:float, debug=lambda *args:None, status_print=lambda *args:None): + from gerber.primitives import Line, Region, Circle imgh, imgw = img.shape # Extract contour hierarchy using OpenCV @@ -231,9 +232,8 @@ def plot_contours( # See https://stackoverflow.com/questions/48291581/how-to-use-cv2-findcontours-in-different-opencv-versions/48292371 contours, hierarchy = cv2.findContours(img, cv2.RETR_TREE, cv2.CHAIN_APPROX_TC89_KCOS)[-2:] - aperture = list(layer.apertures)[0] + aperture = list(layer.apertures)[0] if layer.apertures else Circle(None, 0.10) - from gerber.primitives import Line, Region status_print('offx', offx, 'scale', scale) xbias, ybias = offx |