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
This commit is contained in:
alafr
2020-09-11 22:36:53 +02:00
parent 6a299ac3f6
commit 5bf974a0e8
2 changed files with 14 additions and 14 deletions

View File

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

View File

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