From 3b258b6178cbcd7fc2be0a8e5fe512b434f52e5d Mon Sep 17 00:00:00 2001 From: Roy-043 Date: Wed, 8 Jan 2025 17:50:02 +0100 Subject: [PATCH] Draft: fix axis calculation in make_sketch Fixes #18713. The code follows the suggestion by imm/webmite: https://forum.freecad.org/viewtopic.php?p=799014#p799014 @webmite Thank you. --- src/Mod/Draft/draftmake/make_sketch.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Mod/Draft/draftmake/make_sketch.py b/src/Mod/Draft/draftmake/make_sketch.py index 736b39a8c5..72789b9093 100644 --- a/src/Mod/Draft/draftmake/make_sketch.py +++ b/src/Mod/Draft/draftmake/make_sketch.py @@ -176,7 +176,13 @@ def make_sketch(objects_list, autoconstraints=False, addTo=None, axis = App.Vector(0, 0, 1).cross(normal) - angle = DraftVecUtils.angle(normal, App.Vector(0, 0, 1)) * App.Units.Radian + if axis.Length > 1e-6: + axis.normalize() + elif normal.z >= 0: + axis = App.Vector(0, 0, 1) + else: + axis = App.Vector(0, 0, -1) + angle = math.degrees(DraftVecUtils.angle(normal, App.Vector(0, 0, 1))) rotation = App.Rotation(axis, angle) point = shapes_list[0].Vertexes[0].Point