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.
This commit is contained in:
Roy-043
2022-02-24 12:26:42 +01:00
committed by GitHub
parent 8dd1140a4b
commit 039457bdd6

View File

@@ -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)