From ccc4e5cd21757155bbd690dca819f69965c6256a Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Mon, 7 Dec 2020 13:13:34 -0600 Subject: [PATCH 1/2] [Draft] Fix airfoil data detection regex The regular expression that Draft's airfoil data importer uses did not allow for lowercase "e" when using scientific notation. This corrects that, and silences Python Developer Mode warnings about deprecated escape sequences by converting most of the regex to use raw strings. --- src/Mod/Draft/importAirfoilDAT.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Mod/Draft/importAirfoilDAT.py b/src/Mod/Draft/importAirfoilDAT.py index 4b19e34ab7..c49fa61efa 100644 --- a/src/Mod/Draft/importAirfoilDAT.py +++ b/src/Mod/Draft/importAirfoilDAT.py @@ -157,9 +157,9 @@ def process(doc, filename): with the parsed information. """ # Regex to identify data rows and throw away unused metadata - xval = '(?P(\-|\d*)\.\d+(E\-?\d+)?)' - yval = '(?P\-?\s*\d*\.\d+(E\-?\d+)?)' - _regex = '^\s*' + xval + '\,?\s*' + yval + '\s*$' + xval = r'(?P(\-|\d*)\.\d+([Ee]\-?\d+)?)' + yval = r'(?P\-?\s*\d*\.\d+([Ee]\-?\d+)?)' + _regex = r'^\s*' + xval + r'\,?\s*' + yval + r'\s*$' regex = re.compile(_regex) afile = pythonopen(filename, 'r') From 4f96e3c5680adf14c5555d0d6c0d82ea0d044b22 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Wed, 9 Dec 2020 08:32:43 -0600 Subject: [PATCH 2/2] Add support for integer values. --- src/Mod/Draft/importAirfoilDAT.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Mod/Draft/importAirfoilDAT.py b/src/Mod/Draft/importAirfoilDAT.py index c49fa61efa..e496667a4c 100644 --- a/src/Mod/Draft/importAirfoilDAT.py +++ b/src/Mod/Draft/importAirfoilDAT.py @@ -157,8 +157,8 @@ def process(doc, filename): with the parsed information. """ # Regex to identify data rows and throw away unused metadata - xval = r'(?P(\-|\d*)\.\d+([Ee]\-?\d+)?)' - yval = r'(?P\-?\s*\d*\.\d+([Ee]\-?\d+)?)' + xval = r'(?P(\-|\d*)\.*\d*([Ee]\-?\d+)?)' + yval = r'(?P\-?\s*\d*\.*\d*([Ee]\-?\d+)?)' _regex = r'^\s*' + xval + r'\,?\s*' + yval + r'\s*$' regex = re.compile(_regex)