Draft: importSVG.py: check and fix path faces

Fixes #10659.
This commit is contained in:
Roy-043
2023-09-12 19:10:42 +02:00
parent 89bb28239e
commit 59527022da

View File

@@ -955,6 +955,8 @@ class svgHandler(xml.sax.ContentHandler):
sh = makewire(path)
if self.fill and sh.isClosed():
sh = Part.Face(sh)
if sh.isValid() is False:
sh.fix(1e-6, 0, 1)
sh = self.applyTrans(sh)
obj = self.doc.addObject("Part::Feature", pathname)
obj.Shape = sh
@@ -1227,6 +1229,8 @@ class svgHandler(xml.sax.ContentHandler):
and len(sh.Wires) == 1 \
and sh.Wires[0].isClosed():
sh = Part.Face(sh)
if sh.isValid() is False:
sh.fix(1e-6, 0, 1)
sh = self.applyTrans(sh)
obj = self.doc.addObject("Part::Feature", pathname)
obj.Shape = sh
@@ -1244,6 +1248,8 @@ class svgHandler(xml.sax.ContentHandler):
# sh = Part.Wire(path)
if self.fill and sh.isClosed():
sh = Part.Face(sh)
if sh.isValid() is False:
sh.fix(1e-6, 0, 1)
sh = self.applyTrans(sh)
obj = self.doc.addObject("Part::Feature", pathname)
obj.Shape = sh