From 5bf974a0e899f59d0670b9376fa349933102f45c Mon Sep 17 00:00:00 2001 From: alafr Date: Fri, 11 Sep 2020 22:36:53 +0200 Subject: [PATCH] Draft: Conform to vocx-fc's review - check for Part.Shape as it was before, to avoid any risk of breaking other tools - change the order of Draft tests --- src/Mod/Draft/TestDraft.py | 20 ++++++++++---------- src/Mod/Draft/draftgeoutils/general.py | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Mod/Draft/TestDraft.py b/src/Mod/Draft/TestDraft.py index 094902d278..6845cfb726 100644 --- a/src/Mod/Draft/TestDraft.py +++ b/src/Mod/Draft/TestDraft.py @@ -101,15 +101,15 @@ from drafttests.test_import import DraftImport as DraftTest01 from drafttests.test_creation import DraftCreation as DraftTest02 from drafttests.test_modification import DraftModification as DraftTest03 -# Handling of file formats tests -from drafttests.test_svg import DraftSVG as DraftTest04 -from drafttests.test_dxf import DraftDXF as DraftTest05 -from drafttests.test_dwg import DraftDWG as DraftTest06 -# from drafttests.test_oca import DraftOCA as DraftTest07 -# from drafttests.test_airfoildat import DraftAirfoilDAT as DraftTest08 - # Testing the utils module -from drafttests.test_draftgeomutils import TestDraftGeomUtils as DraftTest09 +from drafttests.test_draftgeomutils import TestDraftGeomUtils as DraftTest04 + +# Handling of file formats tests +from drafttests.test_svg import DraftSVG as DraftTest05 +from drafttests.test_dxf import DraftDXF as DraftTest06 +from drafttests.test_dwg import DraftDWG as DraftTest07 +# from drafttests.test_oca import DraftOCA as DraftTest08 +# from drafttests.test_airfoildat import DraftAirfoilDAT as DraftTest09 # Use the modules so that code checkers don't complain (flake8) True if DraftTest01 else False @@ -118,6 +118,6 @@ True if DraftTest03 else False True if DraftTest04 else False True if DraftTest05 else False True if DraftTest06 else False -# True if DraftTest07 else False +True if DraftTest07 else False # True if DraftTest08 else False -True if DraftTest09 else False +# True if DraftTest09 else False diff --git a/src/Mod/Draft/draftgeoutils/general.py b/src/Mod/Draft/draftgeoutils/general.py index 8235a0078c..8c44dbbc8e 100644 --- a/src/Mod/Draft/draftgeoutils/general.py +++ b/src/Mod/Draft/draftgeoutils/general.py @@ -65,11 +65,11 @@ def vec(edge, use_orientation = False): If use_orientation is True, it takes into account the edges orientation. If edge is not straight, you'll get strange results! """ - if isinstance(edge, Part.Edge): - if edge.Orientation == "Forward" or not use_orientation: - return edge.Vertexes[-1].Point.sub(edge.Vertexes[0].Point) - else: + if isinstance(edge, Part.Shape): + if use_orientation and isinstance(edge, Part.Edge) and edge.Orientation == "Reversed": return edge.Vertexes[0].Point.sub(edge.Vertexes[-1].Point) + else: + return edge.Vertexes[-1].Point.sub(edge.Vertexes[0].Point) elif isinstance(edge, Part.LineSegment): return edge.EndPoint.sub(edge.StartPoint) else: