From dd8944709c5a48ccb52ba41a2310218770eb1669 Mon Sep 17 00:00:00 2001 From: jaseg Date: Sun, 4 Jul 2021 20:56:09 +0200 Subject: Refactor panelize/rx274x, refactor bounding_box return value --- gerbonara/gerber/render/cairo_backend.py | 4 +--- gerbonara/gerber/render/rs274x_backend.py | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'gerbonara/gerber/render') diff --git a/gerbonara/gerber/render/cairo_backend.py b/gerbonara/gerber/render/cairo_backend.py index a7baf84..431ab94 100644 --- a/gerbonara/gerber/render/cairo_backend.py +++ b/gerbonara/gerber/render/cairo_backend.py @@ -608,9 +608,7 @@ class GerberCairoContext(GerberContext): """ class Clip: def __init__(clp, primitive): - x_range, y_range = primitive.bounding_box - xmin, xmax = x_range - ymin, ymax = y_range + (xmin, ymin), (xmax, ymax) = primitive.bounding_box # Round bounds to the nearest pixel outside of the primitive clp.xmin = math.floor(self.scale[0] * xmin) diff --git a/gerbonara/gerber/render/rs274x_backend.py b/gerbonara/gerber/render/rs274x_backend.py index c7af2ea..bf9f164 100644 --- a/gerbonara/gerber/render/rs274x_backend.py +++ b/gerbonara/gerber/render/rs274x_backend.py @@ -408,8 +408,8 @@ class Rs274xContext(GerberContext): hash += primitive.__class__.__name__[0] bbox = primitive.bounding_box - hash += str((bbox[0][1] - bbox[0][0]) * 100000)[0:2] - hash += str((bbox[1][1] - bbox[1][0]) * 100000)[0:2] + hash += str((bbox[1][0] - bbox[0][0]) * 100000)[0:2] + hash += str((bbox[1][1] - bbox[0][1]) * 100000)[0:2] if hasattr(primitive, 'primitives'): hash += str(len(primitive.primitives)) -- cgit