diff --git a/eeschema/python_scripts/bom_csv_grouped_by_value.py b/eeschema/python_scripts/bom_csv_grouped_by_value.py index e47a93fde7..d30344a2c5 100644 --- a/eeschema/python_scripts/bom_csv_grouped_by_value.py +++ b/eeschema/python_scripts/bom_csv_grouped_by_value.py @@ -125,15 +125,16 @@ item = 0 for group in grouped: del row[:] refs = "" + refs_l = [] # 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 for component in group: - if len(refs) > 0: - refs += ", " - refs += component.getRef() + refs_l.append( component.getRef() ) c = component - + + refs = ", ".join(refs_l) + # Fill in the component groups common data # columns = ['Item', 'Qty', 'Reference(s)', 'Value', 'LibPart', 'Footprint', 'Datasheet', 'DNP'] + sorted(list(columnset)) item += 1 @@ -155,4 +156,4 @@ for group in grouped: f.close() if not canOpenFile: - sys.exit(1) \ No newline at end of file + sys.exit(1) diff --git a/eeschema/python_scripts/bom_csv_grouped_by_value_with_fp.py b/eeschema/python_scripts/bom_csv_grouped_by_value_with_fp.py index ca0b62d37d..7815ee1a5a 100644 --- a/eeschema/python_scripts/bom_csv_grouped_by_value_with_fp.py +++ b/eeschema/python_scripts/bom_csv_grouped_by_value_with_fp.py @@ -60,15 +60,16 @@ grouped = net.groupComponents() # Output all of the component information for group in grouped: refs = "" + refs_l = [] # 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 for component in group: - if refs != "": - refs += ", " - refs += fromNetlistText( component.getRef() ) + refs_l.append( fromNetlistText( component.getRef() ) ) c = component - + + refs = ", ".join(refs_l) + # Fill in the component groups common data out.writerow([refs, len(group), fromNetlistText( c.getValue() ), @@ -79,4 +80,4 @@ for group in grouped: c.getDNPString()]) if not canOpenFile: - sys.exit(1) \ No newline at end of file + sys.exit(1) diff --git a/eeschema/python_scripts/bom_csv_grouped_extra.py b/eeschema/python_scripts/bom_csv_grouped_extra.py index 4516ba9303..d07b8b0421 100644 --- a/eeschema/python_scripts/bom_csv_grouped_extra.py +++ b/eeschema/python_scripts/bom_csv_grouped_extra.py @@ -94,16 +94,16 @@ grouped = net.groupComponents() index = 1 for group in grouped: refs = "" + refs_l = [] # 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 for component in group: - refs += component.getRef() + ", " + refs_l.append( component.getRef() ) c = component - - # Remove trailing comma - refs = refs[:-2] - + + refs = ", ".join(refs_l) + # Fill in the component groups common data row = [] row.append( index )