I’ve just been playing around with @qu1ck 's amazing Interactive HTML BOM plugin in KiCad v5.99 (https://github.com/openscopeproject/InteractiveHtmlBom). It works really well and I really like the fact that I can generate a netlist in the schematic and have all the component fields available to be shown.
However, I haven’t been able to figure out how to add the component “Description” as shown in the library. Has someone been able to do this successfully?
Description is not a part field, it’s a component field, in other words its immutable for component instance placed on schematic and is inherited from library component.
That’s why it’s not supported right now but a feature can be added as optional extra field in ibom.
However the method of parsing .net or .xml files for schematic fields will be deprecated soon since kicad 6 has schematic fields are imported into pcb data. Description isn’t imported though. I’ll see if kicad folks are open to importing that as well.
Thanks for the @qu1ck reply! I will thumbs up your issue for v7.
In the meantime might it be possible to use the legacy netlist file for this? I just had a look and it seems that the description field is transferred via the libsource token:
Yes, the data is there so it’s possible, like I said. But I’m reluctant to add it if equivalent feature will not be available in v6 and I want to move away from parsing netlist file.
Ok I think I understand where you are coming from in terms of plugin maintenance. I have managed to get it working by editing the netlist parser. (By the way Kudos for the simplicity of the plugin: it does make it very easy to add to it!)
For the benefit of others reading this thread, I have been able to get this to work with some small changes to the file InteractiveHtmlBom/ecad/kicad_extra/netlistparser.py. The diff is below, as well as the full file attached for those not using git. All you need to do is replace the file and reload the plugin.
Click to expand diff
InteractiveHtmlBom/ecad/kicad_extra/netlistparser.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/InteractiveHtmlBom/ecad/kicad_extra/netlistparser.py b/InteractiveHtmlBom/ecad/kicad_extra/netlistparser.py
index 724673b..d1c395b 100644
--- a/InteractiveHtmlBom/ecad/kicad_extra/netlistparser.py
+++ b/InteractiveHtmlBom/ecad/kicad_extra/netlistparser.py
@@ -20,6 +20,7 @@ class NetlistParser(ParserBase):
ref = None
fields = None
datasheet = None
+ libsource = None
for f in c[1:]:
if f[0] == 'ref':
ref = f[1]
@@ -27,12 +28,19 @@ class NetlistParser(ParserBase):
fields = f[1:]
if f[0] == 'datasheet':
datasheet = f[1]
+ if f[0] == 'libsource':
+ libsource = f[1:]
if ref is None:
return None
ref_fields = comp_dict.setdefault(ref, {})
if datasheet and datasheet != '~':
field_set.add('datasheet')
ref_fields['datasheet'] = datasheet
+ if libsource is not None:
+ for libField in libsource:
+ if libField[0] == 'description':
+ field_set.add('Description')
+ ref_fields['Description'] = libField[1]
if fields is None:
continue
for f in fields:
I looked at your diff and realized that I already have custom logic for datasheet field which is also not transferred to pcb. So my reasoning is moot and I probably am stuck with parsing netlist either way.