importSVG: create Face only if path is closed

This commit is contained in:
Sebastian Hoogen 2012-06-21 15:11:16 +02:00
parent 94d389ae1c
commit 7147f3dd55

View File

@ -51,8 +51,8 @@ if open.__module__ == '__builtin__':
pythonopen = open
svgcolors = {
'Pink': (255, 192, 203),
'Blue': (0, 0, 255),
'Pink': (255, 192, 203),
'Blue': (0, 0, 255),
'Honeydew': (240, 255, 240),
'Purple': (128, 0, 128),
'Fuchsia': (255, 0, 255),
@ -269,7 +269,7 @@ def makewire(path,checkclosed=False,donttry=False):
#ToDo Do not catch all exceptions
if not donttry:
try:
sh = Part.Wire(DraftGeomUtils.sortEdges(path))
sh = Part.Wire(DraftGeomUtils.sortEdges(path))
#sh = Part.Wire(path)
isok = (not checkclosed) or sh.isClosed()
except:# BRep_API:command not done
@ -533,7 +533,8 @@ class svgHandler(xml.sax.ContentHandler):
if path:
#sh = Part.Wire(path)
sh = makewire(path)
if self.fill: sh = Part.Face(sh)
if self.fill and sh.isClosed():
sh = Part.Face(sh)
sh = self.applyTrans(sh)
obj = self.doc.addObject("Part::Feature",pathname)
obj.Shape = sh
@ -750,7 +751,8 @@ class svgHandler(xml.sax.ContentHandler):
if path:
sh=makewire(path,checkclosed=False)
#sh = Part.Wire(path)
if self.fill: sh = Part.Face(sh)
if self.fill and sh.isClosed():
sh = Part.Face(sh)
sh = self.applyTrans(sh)
obj = self.doc.addObject("Part::Feature",pathname)
obj.Shape = sh
@ -828,7 +830,6 @@ class svgHandler(xml.sax.ContentHandler):
obj = self.doc.addObject("Part::Feature",pathname)
obj.Shape = sh
self.format(obj)
# processing lines
if name == "line":
@ -864,7 +865,8 @@ class svgHandler(xml.sax.ContentHandler):
path.append(seg)
if path:
sh = Part.Wire(path)
if self.fill: sh = Part.Face(sh)
if self.fill and sh.isClosed():
sh = Part.Face(sh)
sh = self.applyTrans(sh)
obj = self.doc.addObject("Part::Feature",pathname)
obj.Shape = sh