From 03acbb74410c97ac99ee31cbc209beb257b4020f Mon Sep 17 00:00:00 2001 From: Sebastian Hoogen Date: Thu, 3 May 2012 11:08:40 +0200 Subject: [PATCH] importSVG support numbers only seperated through a minus sign in path definition. Like in files created by Adobe Ilustrator. --- src/Mod/Draft/importSVG.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Mod/Draft/importSVG.py b/src/Mod/Draft/importSVG.py index e30e0cadb5..5de678d519 100644 --- a/src/Mod/Draft/importSVG.py +++ b/src/Mod/Draft/importSVG.py @@ -256,7 +256,7 @@ def getsize(length,mode='discard',base=1): elif mode == 'tuple': return float(number),unit elif mode == 'isabsolute': - return unit in ['mm','cm','in','px','pt'] + return unit in ('mm','cm','in','px','pt') elif mode == 'mm': return float(number)*tomm[unit] elif mode == 'css': @@ -525,9 +525,11 @@ class svgHandler(xml.sax.ContentHandler): self.lastdim = obj data['d']=[] pathcommandsre=re.compile('\s*?([mMlLhHvVaAcCqQsStTzZ])\s*?([^mMlLhHvVaAcCqQsStTzZ]*)\s*?',re.DOTALL) + pointsre=re.compile('([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)',re.DOTALL) for d,pointsstr in pathcommandsre.findall(' '.join(data['d'])): relative = d.islower() - pointlist = [float(str1) for str1 in pointsstr.replace(',',' ').split()] + pointlist = [float(number) for number,exponent in pointsre.findall(pointsstr.replace(',',' '))] + if (d == "M" or d == "m"): x = pointlist.pop(0) y = pointlist.pop(0)