Material, mat card writer, do not write empty sections

This commit is contained in:
Bernd Hahnebach
2019-02-15 12:53:53 +01:00
committed by wmayer
parent 71416a4005
commit 19926d7beb

View File

@@ -142,7 +142,7 @@ def write(filename, dictionary):
user = contents[-1]
for proper in group.getchildren():
properName = proper.attrib['Name']
contents[-1][properName] = ""
contents[-1][properName] = ''
for k, i in dictionary.items():
found = False
for group in contents:
@@ -152,6 +152,11 @@ def write(filename, dictionary):
found = True
if not found:
user[k] = i
# delete empty properties
for group in contents:
for k in list(group.keys()): # iterating over a dict and changing it is not allowed, thus we iterate over a list of the keys
if group[k] == '':
del group[k]
# card writer
rev = FreeCAD.ConfigGet("BuildVersionMajor") + "." + FreeCAD.ConfigGet("BuildVersionMinor") + "." + FreeCAD.ConfigGet("BuildRevision")