From 039457bdd61845dc8935e0fda296e42a56bf920a Mon Sep 17 00:00:00 2001 From: Roy-043 <70520633+Roy-043@users.noreply.github.com> Date: Thu, 24 Feb 2022 12:26:42 +0100 Subject: [PATCH] Draft: Fix Draft_Line Length is zero bug When changing the Length of a Draft_Line to f.e. 0.5 the input of the zero resulted in a zero length line. --- src/Mod/Draft/draftobjects/wire.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Mod/Draft/draftobjects/wire.py b/src/Mod/Draft/draftobjects/wire.py index 71becfb5a9..148d291405 100644 --- a/src/Mod/Draft/draftobjects/wire.py +++ b/src/Mod/Draft/draftobjects/wire.py @@ -217,12 +217,14 @@ class Wire(DraftObject): obj.Points = pts elif prop == "Length": - if obj.Shape and not obj.Shape.isNull(): - if obj.Length.Value != obj.Shape.Length: - if len(obj.Points) == 2: - v = obj.Points[-1].sub(obj.Points[0]) - v = DraftVecUtils.scaleTo(v,obj.Length.Value) - obj.Points = [obj.Points[0],obj.Points[0].add(v)] + if (len(obj.Points) == 2 + and obj.Length.Value > 1e-7 + and obj.Shape + and (not obj.Shape.isNull()) + and obj.Length.Value != obj.Shape.Length): + v = obj.Points[-1].sub(obj.Points[0]) + v = DraftVecUtils.scaleTo(v, obj.Length.Value) + obj.Points = [obj.Points[0], obj.Points[0].add(v)] elif prop == "Placement": pl = App.Placement(obj.Placement)