wokwi / kicad-jlcpcb-bom-plugin

Export a JLCPCB Compatible BOM directly from your KiCad schematic

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Trouble using plugin

burnt-past opened this issue · comments

Getting this error whenever I try to use this plugin.

I am on Windows 10 using KiCad 5.1.10

This is the Command I am using:

python3 "C:\Program Files\KiCad\bin\scripting\plugins/bom_csv_jlcpcb.py" "%I" "%O.csv"

Error:

Error messages:
Traceback (most recent call last):
  File "C:\Program Files\KiCad\bin\scripting\plugins\bom_csv_jlcpcb.py", line 48, in <module>
    out.writerow([c.getValue() + " " + c.getDescription(), ",".join(refs), c.getFootprint().split(':')[1],
IndexError: list index out of range

I have the exact same issue. Has this been resolved?

No, I have not found a solution.

I found a solution...open your kicad installation folder by right clicking on the kicad icon and select "open installation folder"...open "scripting" folder... you will see a "plugin" folder in it...open it and copy the files there...simple as that

@zeeblaze , I am in a Windows environment. This is not applicable. If you would have looked at my original post, you would see that I am using the KiCad directory.

Am also a windows user...and it worked for me ....try it..

Your kicad will be the problem then... because I see the kicad you are using is 5.1.X version...

Well I use the same...but the thing is ..5.1.x uses python 2...so it's the older version of this script that will work for you 🙂

That doesn't make sense, I have Python 3 installed and I'm using a higher version than what this plugin has been tested on.

Having the same issue...

@burnt-past The fix for me was to replace the [1] with a [0] in the code on line 48. Some designators are not in a folder and therefore only have one element

So line 48 should look like this:
out.writerow([c.getValue(),",".join(refs), c.getFootprint().split(":")[0]])

I am also windows user and manage to use python3 using the command py because python3 was not working for me.
py "C:\Program Files\KiCad\bin\scripting\plugins\bom_csv_jlcpcb.py" "%I" "%O.csv"

I get the same error :

Traceback (most recent call last):
  File "C:\Program Files\KiCad\bin\scripting\plugins\bom_csv_jlcpcb.py", line 48, in <module>
    out.writerow([c.getValue() + " " + c.getDescription(), ",".join(refs), c.getFootprint().split(':')[1],
IndexError: list index out of range

As @matteocordray have done I change the 1 to be 0 in line 48 and it worked !!! 🥳

Now it look like that : (line 48 and 49)

out.writerow([c.getValue() + " " + c.getDescription(), ",".join(refs), c.getFootprint().split(':')[0],
lcsc_pn])

That Removes the data that you would want in the BOM. It seems the issue with the footprint name not containing a referenced library.

This will correctly print the values and remove a library name if it exists.

if ':' in c.getFootprint():
   out.writerow([c.getValue(), ",".join(refs), c.getFootprint().split(':')[1],
   lcsc_pn])
else:
   out.writerow([c.getValue(), ",".join(refs), c.getFootprint().split(':')[0],
   lcsc_pn])