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 += "Ref" row += "Qnty" row += "Value" + "Part" + "Datasheet" -row += "Description" + "Vendor" +row += "Description" + "Vendor" + "DNP" html = html.replace('', row + "") @@ -94,7 +94,8 @@ for group in grouped: row += "" + c.getLibName() + ":" + c.getPartName() row += "" + c.getDatasheet() row += "" + c.getDescription() - row += "" + c.getField("Vendor")+ "" + row += "" + c.getField("Vendor") + row += "" + c.getDNPString() + "" row += "\n" html = html.replace('', row + "") diff --git a/eeschema/plugins/python_scripts/bom_html_with_advanced_grouping.py b/eeschema/plugins/python_scripts/bom_html_with_advanced_grouping.py index 3c4c7e55d8..e1dbd66188 100644 --- a/eeschema/plugins/python_scripts/bom_html_with_advanced_grouping.py +++ b/eeschema/plugins/python_scripts/bom_html_with_advanced_grouping.py @@ -69,6 +69,8 @@ def myEqu(self, other): result = False elif self.getField("Voltage") != other.getField("Voltage"): result = False + elif self.getDNP() != other.getDNP(): + result = False return result @@ -99,7 +101,7 @@ html = html.replace('', "Component Count:" + \ row = "Ref" + "Qnty" row += "Value" + "Part" + "Footprint" -row += "Description" + "Vendor" +row += "Description" + "Vendor + "DNP" html = html.replace('', row + "") @@ -125,7 +127,8 @@ for group in grouped: row += "" + refs +"" + str(len(group)) row += "" + c.getValue() + "" + c.getLibName() + ":" row += c.getPartName() + "" + c.getFootprint() + "" - row += c.getDescription() + "" + c.getField("Vendor") + row += c.getDescription() + "" + c.getField("Vendor") + "" + row += c.getDNPString() row += "" html = html.replace('', row + "") diff --git a/eeschema/plugins/python_scripts/bom_txt_sorted_by_ref.py b/eeschema/plugins/python_scripts/bom_txt_sorted_by_ref.py index 2ad3cb90b4..00322e7642 100644 --- a/eeschema/plugins/python_scripts/bom_txt_sorted_by_ref.py +++ b/eeschema/plugins/python_scripts/bom_txt_sorted_by_ref.py @@ -59,9 +59,9 @@ 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', 'Part', 'Footprint', 'Description', 'Vendor'] ) +writerow( out, ['Ref', 'Value', 'Part', 'Footprint', 'Description', 'Vendor', 'DNP'] ) # Output all of the component information for c in components: writerow( out, [c.getRef(), c.getValue(), c.getLibName() + ":" + c.getPartName(), - c.getFootprint(), c.getDescription(), c.getField("Vendor")]) + c.getFootprint(), c.getDescription(), c.getField("Vendor"), c.getDNPString()]) diff --git a/eeschema/plugins/python_scripts/kicad_netlist_reader.py b/eeschema/plugins/python_scripts/kicad_netlist_reader.py index e53c65e998..1a4146eb3c 100644 --- a/eeschema/plugins/python_scripts/kicad_netlist_reader.py +++ b/eeschema/plugins/python_scripts/kicad_netlist_reader.py @@ -331,7 +331,7 @@ class comp(): def __eq__(self, other): """ Equivalency operator, remember this can be easily overloaded 2 components are equivalent ( i.e. can be grouped - if they have same value and same footprint + if they have same value and same footprint and are both set to be populated Override the component equivalence operator must be done before loading the netlist, otherwise all components will have the original @@ -347,7 +347,8 @@ class comp(): if self.getValue() == other.getValue(): if self.getFootprint() == other.getFootprint(): if self.getRef().rstrip(string.digits) == other.getRef().rstrip(string.digits): - result = True + if self.getDNP() == other.getDNP(): + result = True return result def setLibPart(self, part): @@ -418,6 +419,15 @@ class comp(): return False + ''' + Return 'DNP' if the component has the DNP property set + ''' + def getDNPString(self): + if self.getDNP(): + return 'DNP' + + return '' + ''' Return true if the component has the exclude from BOM property set ''' @@ -758,7 +768,6 @@ class netlist(): # Make sure to start off will all components ungrouped to begin with for c in components: c.grouped = False - c.getExcludeFromBOM() # Group components based on the value, library and part identifiers for c in components: