Draft: Fixes in DXF exporter

This commit is contained in:
Yorik van Havre 2013-08-11 12:46:36 -03:00
parent 58dd79e79b
commit 1446ee0b69
3 changed files with 226 additions and 209 deletions

View File

@ -278,6 +278,10 @@ def getGroupContents(objectslist,walls=False):
newlist = []
for obj in objectslist:
if obj.isDerivedFrom("App::DocumentObjectGroup"):
if obj.isDerivedFrom("Drawing::FeaturePage"):
# skip if the grou is a page
newlist.append(obj)
else:
newlist.extend(getGroupContents(obj.Group))
else:
newlist.append(obj)

View File

@ -1487,8 +1487,12 @@ def export(objectslist,filename,nospline=False):
global exportList
exportList = objectslist
print exportList
exportList = Draft.getGroupContents(exportList)
print exportList
if (len(exportList) == 1) and (Draft.getType(exportList[0]) == "ArchSectionView"):
# arch view: export it "as is"
dxf = exportList[0].Proxy.getDXF()

View File

@ -413,8 +413,10 @@ class svgHandler(xml.sax.ContentHandler):
data = {}
for (keyword,content) in attrs.items():
#print keyword,content
content = content.replace(',',' ')
content = content.split()
#print keyword,content
data[keyword]=content
if 'style' in data:
@ -434,6 +436,9 @@ class svgHandler(xml.sax.ContentHandler):
for k in ['fill','stroke','stroke-width','font-size']:
if k in data:
if isinstance(data[k],list):
if data[k][0].lower().startswith("rgb("):
data[k] = ",".join(data[k])
else:
data[k]=data[k][0]
# extracting style info
@ -748,7 +753,11 @@ class svgHandler(xml.sax.ContentHandler):
path.append(seg)
elif (d == "Z") or (d == "z"):
if not DraftVecUtils.equals(lastvec,firstvec):
try:
seg = Part.Line(lastvec,firstvec).toShape()
except:
pass
else:
path.append(seg)
if path: #the path should be closed by now
#sh=makewire(path,True)