diff --git a/eeschema/plugins/python_scripts/bom_csv_grouped_by_value.py b/eeschema/plugins/python_scripts/bom_csv_grouped_by_value.py index b6f58a46ec..3a47af0c2f 100644 --- a/eeschema/plugins/python_scripts/bom_csv_grouped_by_value.py +++ b/eeschema/plugins/python_scripts/bom_csv_grouped_by_value.py @@ -45,6 +45,8 @@ def myEqu(self, other): result = False elif self.getFootprint() != other.getFootprint(): result = False + elif self.getDNP() != other.getDNP(): + result = False return result @@ -84,7 +86,7 @@ partfields -= set( ['Reference', 'Value', 'Datasheet', 'Footprint'] ) columnset = compfields | partfields # union # prepend an initial 'hard coded' list and put the enchillada into list 'columns' -columns = ['Item', 'Qty', 'Reference(s)', 'Value', 'LibPart', 'Footprint', 'Datasheet'] + sorted(list(columnset)) +columns = ['Item', 'Qty', 'Reference(s)', 'Value', 'LibPart', 'Footprint', 'Datasheet', 'DNP'] + sorted(list(columnset)) # Create a new csv writer object to use as the output formatter out = csv.writer( f, lineterminator='\n', delimiter=',', quotechar='\"', quoting=csv.QUOTE_ALL ) @@ -103,39 +105,12 @@ writerow( out, ['Tool:', net.getTool()] ) writerow( out, ['Generator:', sys.argv[0]] ) writerow( out, ['Component Count:', len(components)] ) writerow( out, [] ) -writerow( out, ['Individual Components:'] ) -writerow( out, [] ) # blank line -writerow( out, columns ) - -# Output all the interesting components individually first: -row = [] -for c in components: - del row[:] - row.append('') # item is blank in individual table - row.append('') # Qty is always 1, why print it - row.append( c.getRef() ) # Reference - row.append( c.getValue() ) # Value - row.append( c.getLibName() + ":" + c.getPartName() ) # LibPart - #row.append( c.getDescription() ) - row.append( c.getFootprint() ) - row.append( c.getDatasheet() ) - - # from column 7 upwards, use the fieldnames to grab the data - for field in columns[7:]: - row.append( c.getField( field ) ); - - writerow( out, row ) - - -writerow( out, [] ) # blank line -writerow( out, [] ) # blank line -writerow( out, [] ) # blank line writerow( out, ['Collated Components:'] ) writerow( out, [] ) # blank line writerow( out, columns ) # reuse same columns - +row=[] # Get all of the components in groups of matching parts + values # (see kicad_netlist_reader.py) @@ -147,7 +122,7 @@ item = 0 for group in grouped: del row[:] refs = "" - + # 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: @@ -157,7 +132,7 @@ for group in grouped: c = component # Fill in the component groups common data - # columns = ['Item', 'Qty', 'Reference(s)', 'Value', 'LibPart', 'Footprint', 'Datasheet'] + sorted(list(columnset)) + # columns = ['Item', 'Qty', 'Reference(s)', 'Value', 'LibPart', 'Footprint', 'Datasheet', 'DNP'] + sorted(list(columnset)) item += 1 row.append( item ) row.append( len(group) ) @@ -166,6 +141,7 @@ for group in grouped: row.append( c.getLibName() + ":" + c.getPartName() ) row.append( net.getGroupFootprint(group) ) row.append( net.getGroupDatasheet(group) ) + row.append( c.getDNPString() ) # from column 7 upwards, use the fieldnames to grab the data for field in columns[7:]: diff --git a/eeschema/plugins/python_scripts/bom_csv_grouped_by_value_with_fp.py b/eeschema/plugins/python_scripts/bom_csv_grouped_by_value_with_fp.py index a32c9c18b1..12d99585d0 100644 --- a/eeschema/plugins/python_scripts/bom_csv_grouped_by_value_with_fp.py +++ b/eeschema/plugins/python_scripts/bom_csv_grouped_by_value_with_fp.py @@ -48,7 +48,7 @@ out.writerow(['Date:', net.getDate()]) out.writerow(['Tool:', net.getTool()]) out.writerow( ['Generator:', sys.argv[0]] ) out.writerow(['Component Count:', len(net.components)]) -out.writerow(['Ref', 'Qnty', 'Value', 'Cmp name', 'Footprint', 'Description', 'Vendor']) +out.writerow(['Ref', 'Qnty', 'Value', 'Cmp name', 'Footprint', 'Description', 'Vendor', 'DNP']) # Get all of the components in groups of matching parts + values @@ -74,6 +74,7 @@ for group in grouped: fromNetlistText( c.getPartName() ), fromNetlistText( c.getFootprint() ), fromNetlistText( c.getDescription() ), - fromNetlistText( c.getField("Vendor") )]) + fromNetlistText( c.getField("Vendor") ), + c.getDNPString()]) diff --git a/eeschema/plugins/python_scripts/bom_csv_grouped_extra.py b/eeschema/plugins/python_scripts/bom_csv_grouped_extra.py index 3285dde9bb..5515b0b6fa 100644 --- a/eeschema/plugins/python_scripts/bom_csv_grouped_extra.py +++ b/eeschema/plugins/python_scripts/bom_csv_grouped_extra.py @@ -43,6 +43,8 @@ def myEqu(self, other): result = False elif self.getFootprint() != other.getFootprint(): result = False + elif self.getDNP() != other.getDNP(): + result = False else: for field_name in extra_fields: if self.getField(field_name) != other.getField(field_name): @@ -72,7 +74,7 @@ except IOError: out = csv.writer(f, lineterminator='\n', delimiter=',', quotechar='\"', quoting=csv.QUOTE_ALL) # Output a CSV header -out.writerow(['#', 'Reference', 'Qty', 'Value', 'Footprint'] + extra_fields) +out.writerow(['#', 'Reference', 'Qty', 'Value', 'Footprint', 'DNP'] + extra_fields) # Get all of the components in groups of matching parts + values # (see kicad_netlist_reader.py) @@ -99,6 +101,7 @@ for group in grouped: row.append( len(group) ) row.append( c.getValue() ) row.append( c.getFootprint() ) + row.append( c.getDNPString() ) # Add the values of extra fields for field_name in extra_fields: diff --git a/eeschema/plugins/python_scripts/bom_csv_sorted_by_ref.py b/eeschema/plugins/python_scripts/bom_csv_sorted_by_ref.py index 6441867567..007d372a88 100644 --- a/eeschema/plugins/python_scripts/bom_csv_sorted_by_ref.py +++ b/eeschema/plugins/python_scripts/bom_csv_sorted_by_ref.py @@ -58,10 +58,10 @@ writerow( out, ['Source:', net.getSource()] ) writerow( out, ['Date:', net.getDate()] ) writerow( out, ['Tool:', net.getTool()] ) writerow( out, ['Component Count:', len(components)] ) -writerow( out, ['Ref', 'Value', 'Footprint', 'Datasheet', 'Manufacturer', 'Vendor'] ) +writerow( out, ['Ref', 'Value', 'Footprint', 'Datasheet', 'Manufacturer', 'Vendor', 'DNP'] ) # Output all of the component information (One component per row) for c in components: writerow( out, [c.getRef(), c.getValue(), c.getFootprint(), c.getDatasheet(), - c.getField("Manufacturer"), c.getField("Vendor")]) + c.getField("Manufacturer"), c.getField("Vendor"), c.getDNPString()]) diff --git a/eeschema/plugins/python_scripts/bom_html_grouped_by_value.py b/eeschema/plugins/python_scripts/bom_html_grouped_by_value.py index 281bbadabb..c7828bf81c 100644 --- a/eeschema/plugins/python_scripts/bom_html_grouped_by_value.py +++ b/eeschema/plugins/python_scripts/bom_html_grouped_by_value.py @@ -69,7 +69,7 @@ row ="" row += "