BOM Generation: Unifying reference concatenation using more pythonic string join to avoid trailing comma.
This commit is contained in:
parent
fd91f8933e
commit
2ee75b1aec
|
@ -125,15 +125,16 @@ item = 0
|
||||||
for group in grouped:
|
for group in grouped:
|
||||||
del row[:]
|
del row[:]
|
||||||
refs = ""
|
refs = ""
|
||||||
|
refs_l = []
|
||||||
|
|
||||||
# Add the reference of every component in the group and keep a reference
|
# Add the reference of every component in the group and keep a reference
|
||||||
# to the component so that the other data can be filled in once per group
|
# to the component so that the other data can be filled in once per group
|
||||||
for component in group:
|
for component in group:
|
||||||
if len(refs) > 0:
|
refs_l.append( component.getRef() )
|
||||||
refs += ", "
|
|
||||||
refs += component.getRef()
|
|
||||||
c = component
|
c = component
|
||||||
|
|
||||||
|
refs = ", ".join(refs_l)
|
||||||
|
|
||||||
# Fill in the component groups common data
|
# Fill in the component groups common data
|
||||||
# columns = ['Item', 'Qty', 'Reference(s)', 'Value', 'LibPart', 'Footprint', 'Datasheet', 'DNP'] + sorted(list(columnset))
|
# columns = ['Item', 'Qty', 'Reference(s)', 'Value', 'LibPart', 'Footprint', 'Datasheet', 'DNP'] + sorted(list(columnset))
|
||||||
item += 1
|
item += 1
|
||||||
|
@ -155,4 +156,4 @@ for group in grouped:
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
if not canOpenFile:
|
if not canOpenFile:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
|
@ -60,15 +60,16 @@ grouped = net.groupComponents()
|
||||||
# Output all of the component information
|
# Output all of the component information
|
||||||
for group in grouped:
|
for group in grouped:
|
||||||
refs = ""
|
refs = ""
|
||||||
|
refs_l = []
|
||||||
|
|
||||||
# Add the reference of every component in the group and keep a reference
|
# Add the reference of every component in the group and keep a reference
|
||||||
# to the component so that the other data can be filled in once per group
|
# to the component so that the other data can be filled in once per group
|
||||||
for component in group:
|
for component in group:
|
||||||
if refs != "":
|
refs_l.append( fromNetlistText( component.getRef() ) )
|
||||||
refs += ", "
|
|
||||||
refs += fromNetlistText( component.getRef() )
|
|
||||||
c = component
|
c = component
|
||||||
|
|
||||||
|
refs = ", ".join(refs_l)
|
||||||
|
|
||||||
# Fill in the component groups common data
|
# Fill in the component groups common data
|
||||||
out.writerow([refs, len(group),
|
out.writerow([refs, len(group),
|
||||||
fromNetlistText( c.getValue() ),
|
fromNetlistText( c.getValue() ),
|
||||||
|
@ -79,4 +80,4 @@ for group in grouped:
|
||||||
c.getDNPString()])
|
c.getDNPString()])
|
||||||
|
|
||||||
if not canOpenFile:
|
if not canOpenFile:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
|
@ -94,16 +94,16 @@ grouped = net.groupComponents()
|
||||||
index = 1
|
index = 1
|
||||||
for group in grouped:
|
for group in grouped:
|
||||||
refs = ""
|
refs = ""
|
||||||
|
refs_l = []
|
||||||
|
|
||||||
# Add the reference of every component in the group and keep a reference
|
# Add the reference of every component in the group and keep a reference
|
||||||
# to the component so that the other data can be filled in once per group
|
# to the component so that the other data can be filled in once per group
|
||||||
for component in group:
|
for component in group:
|
||||||
refs += component.getRef() + ", "
|
refs_l.append( component.getRef() )
|
||||||
c = component
|
c = component
|
||||||
|
|
||||||
# Remove trailing comma
|
refs = ", ".join(refs_l)
|
||||||
refs = refs[:-2]
|
|
||||||
|
|
||||||
# Fill in the component groups common data
|
# Fill in the component groups common data
|
||||||
row = []
|
row = []
|
||||||
row.append( index )
|
row.append( index )
|
||||||
|
|
Loading…
Reference in New Issue