From cd53c06b9899b03fe88d2a2fe8258422e7ac9c09 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Mon, 16 May 2022 11:10:04 -0500 Subject: [PATCH] Draft: fix SVG rotation around non-origin center Fixes #6869 --- src/Mod/Draft/importSVG.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Mod/Draft/importSVG.py b/src/Mod/Draft/importSVG.py index 5af8786cde..e01dc52944 100644 --- a/src/Mod/Draft/importSVG.py +++ b/src/Mod/Draft/importSVG.py @@ -1591,14 +1591,15 @@ class svgHandler(xml.sax.ContentHandler): cy = 0 angle = argsplit[0] if len(argsplit) >= 3: + # Rotate around a non-origin centerpoint (note: SVG y axis is opposite FreeCAD y axis) cx = argsplit[1] cy = argsplit[2] - m.move(Vector(cx, -cy, 0)) + m.move(Vector(-cx, cy, 0)) # Reposition for rotation # Mirroring one axis is equal to changing the direction # of rotation m.rotateZ(math.radians(-angle)) if len(argsplit) >= 3: - m.move(Vector(-cx, cy, 0)) + m.move(Vector(cx, -cy, 0)) # Reverse repositioning elif transformation == 'skewX': _m = FreeCAD.Matrix(1, -math.tan(math.radians(argsplit[0])))