Draft: Fixes in DXF exporter
This commit is contained in:
parent
58dd79e79b
commit
1446ee0b69
|
@ -278,6 +278,10 @@ def getGroupContents(objectslist,walls=False):
|
||||||
newlist = []
|
newlist = []
|
||||||
for obj in objectslist:
|
for obj in objectslist:
|
||||||
if obj.isDerivedFrom("App::DocumentObjectGroup"):
|
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))
|
newlist.extend(getGroupContents(obj.Group))
|
||||||
else:
|
else:
|
||||||
newlist.append(obj)
|
newlist.append(obj)
|
||||||
|
|
|
@ -1487,8 +1487,12 @@ def export(objectslist,filename,nospline=False):
|
||||||
global exportList
|
global exportList
|
||||||
exportList = objectslist
|
exportList = objectslist
|
||||||
|
|
||||||
|
print exportList
|
||||||
|
|
||||||
exportList = Draft.getGroupContents(exportList)
|
exportList = Draft.getGroupContents(exportList)
|
||||||
|
|
||||||
|
print exportList
|
||||||
|
|
||||||
if (len(exportList) == 1) and (Draft.getType(exportList[0]) == "ArchSectionView"):
|
if (len(exportList) == 1) and (Draft.getType(exportList[0]) == "ArchSectionView"):
|
||||||
# arch view: export it "as is"
|
# arch view: export it "as is"
|
||||||
dxf = exportList[0].Proxy.getDXF()
|
dxf = exportList[0].Proxy.getDXF()
|
||||||
|
|
|
@ -413,8 +413,10 @@ class svgHandler(xml.sax.ContentHandler):
|
||||||
|
|
||||||
data = {}
|
data = {}
|
||||||
for (keyword,content) in attrs.items():
|
for (keyword,content) in attrs.items():
|
||||||
|
#print keyword,content
|
||||||
content = content.replace(',',' ')
|
content = content.replace(',',' ')
|
||||||
content = content.split()
|
content = content.split()
|
||||||
|
#print keyword,content
|
||||||
data[keyword]=content
|
data[keyword]=content
|
||||||
|
|
||||||
if 'style' in data:
|
if 'style' in data:
|
||||||
|
@ -434,6 +436,9 @@ class svgHandler(xml.sax.ContentHandler):
|
||||||
for k in ['fill','stroke','stroke-width','font-size']:
|
for k in ['fill','stroke','stroke-width','font-size']:
|
||||||
if k in data:
|
if k in data:
|
||||||
if isinstance(data[k],list):
|
if isinstance(data[k],list):
|
||||||
|
if data[k][0].lower().startswith("rgb("):
|
||||||
|
data[k] = ",".join(data[k])
|
||||||
|
else:
|
||||||
data[k]=data[k][0]
|
data[k]=data[k][0]
|
||||||
|
|
||||||
# extracting style info
|
# extracting style info
|
||||||
|
@ -748,7 +753,11 @@ class svgHandler(xml.sax.ContentHandler):
|
||||||
path.append(seg)
|
path.append(seg)
|
||||||
elif (d == "Z") or (d == "z"):
|
elif (d == "Z") or (d == "z"):
|
||||||
if not DraftVecUtils.equals(lastvec,firstvec):
|
if not DraftVecUtils.equals(lastvec,firstvec):
|
||||||
|
try:
|
||||||
seg = Part.Line(lastvec,firstvec).toShape()
|
seg = Part.Line(lastvec,firstvec).toShape()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
path.append(seg)
|
path.append(seg)
|
||||||
if path: #the path should be closed by now
|
if path: #the path should be closed by now
|
||||||
#sh=makewire(path,True)
|
#sh=makewire(path,True)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user