From b869e174013fb98d0f7f600bc9cb54efb343807c Mon Sep 17 00:00:00 2001 From: Mario Voigt Date: Wed, 29 Dec 2021 23:46:41 +0100 Subject: [PATCH] fix buxtronix hinges to work with paths correctly (wrong scaling) --- .../buxtronix_living_hinges/buxtronix_living_hinges.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/extensions/fablabchemnitz/buxtronix_living_hinges/buxtronix_living_hinges.py b/extensions/fablabchemnitz/buxtronix_living_hinges/buxtronix_living_hinges.py index 552cd1da..2c7e5299 100755 --- a/extensions/fablabchemnitz/buxtronix_living_hinges/buxtronix_living_hinges.py +++ b/extensions/fablabchemnitz/buxtronix_living_hinges/buxtronix_living_hinges.py @@ -437,9 +437,16 @@ class BuxtronixLivingHinges(inkex.EffectExtension): if self.options.swatch or not self.svg.selected: draw_one(0, 0) else: + unit_factor = 1.0 / self.svg.uutounit(1.0,self.options.unit) + scale_factor = self.svg.unittouu("1px") for elem in self.svg.selected.values(): # Determine width and height based on the selected object's bounding box. - bbox = elem.bounding_box() + if isinstance (elem, inkex.Rectangle) or \ + isinstance (elem, inkex.Circle) or \ + isinstance (elem, inkex.Ellipse): + bbox = elem.bounding_box() + else: + bbox = elem.bounding_box() * (unit_factor / scale_factor) self.options.width = self.svg.unittouu(bbox.width) self.options.height = self.svg.unittouu(bbox.height) x = self.svg.unittouu(bbox.x.minimum)