Git Product home page Git Product logo

jlckicadtools's Introduction

JLCKicadTools

Overview

JLCKicadTools is a tool aims to work with JLCPCB assembly service featuring KiCad 5+ (5/6/7 tested).

See this blog post for instructions.

Requirements

Python 3.7+

Installation

pip install git+https://github.com/matthewlai/JLCKicadTools

In case you do not have pip installed. See:

Fedora

sudo dnf install python-pip

Debian and Ubuntu

sudo apt-get install python-pip

How to use

JLCKicadTools comes as a nice command line interface named kicad-jlc-tool. To see how it works just simply issue at your shell prompt:

$ jlc-kicad-tools

FAQ

  1. Why are some components in the generated files but don't show up on JLCPCB preview?

    • Make sure there are no non-ASCII characters in any of the fields. See: #45

    • Please update to latest version.

jlckicadtools's People

Contributors

ademuri avatar antoinealb avatar bieber avatar blocktrron avatar dabryant avatar diegoherranz avatar dongly avatar dudanov avatar harvie avatar iotmaestro avatar ja-ko avatar jabdoa2 avatar kroesche avatar manawyrm avatar marcelkr avatar matthew-suter avatar matthewlai avatar oliv4945 avatar pacew avatar polwel avatar purdeaandrei avatar shackmeister avatar sophiekovalevsky avatar tobleminer avatar twam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jlckicadtools's Issues

sqlite3 vs pandas

Hi,
I wanted to try this plugin but had trouble because I'm using OSX and the way it attempts to install pip doesn't work because OSX won't load the unsigned numpy extensions into KiCAD (which is signed). It also appears to break the KiCAD install, although maybe that was something else.

I pondered making a pure python parser but figured it would be too slow, then I realised I can use sqlite3 for most of the heavy lifting.

My code is at https://github.com/DanielO/JLCKicadTools/tree/sqlite if you want to take a look.

The most horrible part is loading into the DB - I had it call the iconv binary to convert from gbk to UTF-8 (sqlite does not support many encodings).

broken just for me or is this normal?

when using the generated placement file, i get no components whatsoever.

strangely when i remove some components from the placement file it starts working, but they're literally the same components as some others that work fine.

there's one interesting lead (edit, never mind, thats just because the BOM didnt match. not useful info. continuing to dig)

Python Package Index & Semantic Versioning.

Have you ever considered using some for of semantic versioning and publishing this tool via pypi. It would lower the barrier on entry and would make it easier for users to update things. I would be willing to help here if you are up for it.

My thought process:

  1. Separate rotation/other database from code.
  2. Add update command where the latest database could be pulled from github
  3. Use git actions to CI/CD to push tagged commits into Pypi.
  4. Only push a tagged commit when code changes are made. Database changes can happen in the background.

What do you think?

components being grouped across different designators

From how I see it, the tool should only try to group components if they are the same designator type (R1, R5, R10 etc) besides FP, value etc.

An NTC resistor with same value and FP as a normal resistor, gave me this warning:
"Components R5, TH1 from same group have different LCSC part numbers: C25744, C92371"
Is this a bug or by design?

JLC have inconsistent rotations across *same* footprint

I just needed to replace a diode (C95872 by C412437) because JLC went out of stock on the former.
I now see that the new diode is incorrectly rotated, although I am confident that the rotation was correct with the other part number. I cannot verify now, because, well, JLC won't allow me to visualize any components that are out of stock...

Anyhow, this strongly suggests that not all the components of the same package are oriented the same way. It might just be an oversight on JLC's side.

This script should support a by-part-number rotation.

Part being listed in BOM but not in CPL file

Hi, thanks for the great tool. I am having an issue generating the files - a particular part (C620322) shows up in the BOM file but not in the CPL file. There are no errors or complaints when running the script.

Relevant row in BOM:
"1825910-6","S1,S2,S3","SW_SMD-4P_Switch","C620322"

Nothing in the CPL file.

Your help in figuring out what the problem is would be much appreciated.

Components in bom.csv but not in cpl

Hi Matthew,

I am having an issue that would love to hear your feed back on. I generated the JLCPCB files and when i got the pcbs a few components were not placed on the pcb. I contacted jlcpcb and they told me that those components were not in the files and that it why they had not been placed.
Sure enough when i checked the files i discovered that they are in the generated bom file but not in the cpl file. I am including the files.
For example, the following components are present in the bom but not in the cpl:

C10 C14 C18 C22 C27
J13 J29
J10
C27
C11 C15 C19 C23 C25

Do you have any suggestions as to what i could be doing wrong in my kicad files for the components not to appear in the cpl file?

Thanks

valentino_2104.pro_bom_jlc.csv
valentino_2104.pro_cpl_jlc.csv

How to rotate

Hello,
First off thanks for the blog post and the script. I got it working to the point where i can produce the needed files.
The problem that i have is that one of my components needs to be rotated by 90 degrees.
I tried following your instructions but i cant find the ‘cpl_totations_db.csv’ file. You mentioned that is in the same
directory as the conversion script, but I cant find that either.

I am running on OSX, and while i can execute the command

jlc-kicad-tools /Users/arifainchtein/Data/DigitalStables/mcu/kicad_designs/GloriaField/GloriaField

i dont know where the files are installed and therefore the cpl files generated dont have the corrections
. Could you give me some suggestions?

thanks

ESP32-WROOM-32 Placement issue

Hello! Thanks for your help. I found this issue that may affect a class of ICs, but I only verified it with the one IC that I noticed it with initially.

Overview

I have a PCB that involves a ESP32-WROOM-32 SoC.

I noticed that in the jlcpcb rendering that the ESP32-WROOM-32 seems to be placed lower then it ought to. (see image) jlcpcb seems to correct this manually, but ideally this should not be needed.

esp32-bug

Reproduction

I have not not rigorously tested this issue but I get it by:

Use JLCKicadTools version with commit hash 62cd76c

  1. Include a ESP32-WROOM-32 SoC in your Eeschema with RF_Module:ESP32-WROOM-32 symbol and the RF_Module:ESP32-WROOM-32 footprint.
  2. Generate BoM/Netlist
  3. In Pcbnew import that netlist and position the ESP32-WROOM-32
  4. Generate a .pos footprint file
  5. Generate drill/plot files
  6. Enter working dir and run jlc-kicad-tools -n my_project -v --warn-no-lcsc-partnumber . -o g
  7. Upload files to to jlcpcb
  8. Upload generated bom and cpl files.
  9. View misplaced ESP32-WROOM-32

Addition of an extra database file

Having an option for an extra database file would be great for personal libraries.
This way I wouldn't need to flood the current database with own namescheme FP's :)

Update README

Hello,

just to let know that command
sudo apt-get install python-pip

has to be changed for
sudo apt-get install python3-pip

and read

... since the script needs Python 3.7 up.

Mounting on backside of PCB

Anyone having luck with exporting placement file for the backside? Mine seem to be completely off in the preview.
Not sure if this is script or JLC related

Issue with extended character set

I had a component (C83451) where I had copy-pasted a description including the symbol for ohm (137MΩ) into the value field. It appears the JLC tools don't like this as the component appeared in the review tables when ordering but it was not shown on the graphical review. Changing the value in the schematic editor to remove the Ohm "Ω" character (and re-generating the BOM and CPL using your script) fixed the problem and the component was shown in the review window properly.

Maybe consider looking for non-standard (non-UTF-8?) characters in the script and fixing or warning the user?

Thanks for the script - I have just placed my first order using it!

wrong placement for TH models with different orientation in the same pcb

Hi,
when a TH footprint is present in a pcb with a different orientation, the script should adjust the translation considering the footprint orientation in the pcb (getting it from -all-pos.csv file).
For SMD fp the issue is not present because they are placed on fp center, in case of TH fp, the anchor is instead on first pin.
This is generating a misplacement in JLC assembly service
i.e. in case of a PinHeader placed in the pcb with 0deg, 90deg, 180deg and 270deg, the transformation will generate 4 different alignment to the original footprint
"^PinHeader_1x02_P2\.54mm_Vertical",90,1.27,0.0

jlc-tools-test

JLCPCB component placement oddities

I would like to describe an interesting situation. Maybe someone had experience.
When placing an order, the position of the component SOT-363 appears to be correct.
partPlacement
But in DFM analysis the position is wrong, which is corrected by the JLCPCB engineer.
Before:
dfm_before
After:
dfm_after
It seems to me that DFM analysis should be trusted. So I added the component to the database in #66 .

Actually the question: did I do the right thing and did anyone deal with such oddities?

a mistake in the listing i gave you

Hi Matt,
I received the cbs last week and i have been working on the code. Yesterday I started testing the relay and i could not get it to switch. I checked that the NC was working but the NO did not work. I reviewd every component of that part of the circuit and i think the culprit is the relay. It is placed reverse. the coil side is 180 degrees opposite of it should be.

I had add it this line to the ritation file:

"^Relay_DPDT_Omron_G6K-2F",-90

because originally was placed perpendicular, I guess i should have one:
"^Relay_DPDT_Omron_G6K-2F",90

Just wanted to give you a head's up. I am working through the pcb and i expect to make the next version in a couple of weeks.
Will send you an update once i have verified that this correction fixes the problem

thanks

SOIC-14 has incorrect rotation

A part with SOIC-14_3.9x8.7mm_P1.27mm footprint has incorrect rotation, it needs to be corrected by 270 degrees (like the SOIC-8 and SOIC-18 already in the corrections file). It wouldn't surprise me if all SOIC-* packages need 270 degrees rotation (but I haven't checked that).

QFN-48 incorrect rotation in CPL file

When placing a QFN-48 chip (ESP32-PICO-D4 as example) with pin 1 as right side bottom most pin the CPL puts it as bottom edge left most pin.

The KiCad all-pos csv shows it as:

"U6","ESP32-PICO-D4","QFN-48-1EP_7x7mm_P0.5mm_EP5.3x5.3mm_ThermalVias",163.576000,-91.440000,180.000000,top

generated CPL file shows it as:

U6,ESP32-PICO-D4,QFN-48-1EP_7x7mm_P0.5mm_EP5.3x5.3mm_ThermalVias,163.576000,-91.440000,90.0,top

Cannot handle unicode characters correctly

Hello, great project!

If a component has a value with a unicode character like 10KΩ an error occurs

Traceback (most recent call last):
  File "generate_jlc_files.py", line 78, in <module>
    main()
  File "generate_jlc_files.py", line 71, in main
    if GenerateBOM(netlist_path, bom_output_path) and FixRotations(cpl_path, cpl_output_path, db):
  File "E:\source\JLCKicadTools\jlc_lib\generate_bom.py", line 65, in GenerateBOM
    out.writerow([c.getValue(), ",".join(refs), footprint, lcsc_part_number])
  File "c:\Python34\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u03a9' in position 4: character maps to <undefined>

Using "this folder" as argument

Hi Matthew & Co

Is there a way to run the tool in the current folder?
Perhaps this could be done when no other argument is provided.

Currently I need to use "cd .." and then add the right folder to the tool.
(going one back often brings my PCB repo, hence finding the right folder again can take a while)

Error on Backside component placement

When having the following input from the POS file:

Ref,Val,Package,PosX,PosY,Rot,Side
"H1","Pogopin_PNP","Mill-Max_Pogopin_0906-8-15-20-76-14-11-0_PNP_DUMMY",16.335000,1.485000,180.000000,bottom
"H2","Pogopin_PNP","Mill-Max_Pogopin_0906-8-15-20-76-14-11-0_PNP_DUMMY",-13.365000,1.485000,180.000000,bottom
"H3","Pogopin_PNP","Mill-Max_Pogopin_0906-8-15-20-76-14-11-0_PNP_DUMMY",-16.335000,-1.485000,180.000000,bottom
"H4","Pogopin_PNP","Mill-Max_Pogopin_0906-8-15-20-76-14-11-0_PNP_DUMMY",-16.335000,1.485000,180.000000,bottom
"H5","Pogopin_PNP","Mill-Max_Pogopin_0906-8-15-20-76-14-11-0_PNP_DUMMY",4.455000,1.485000,180.000000,bottom
"H6","Pogopin_PNP","Mill-Max_Pogopin_0906-8-15-20-76-14-11-0_PNP_DUMMY",7.425000,1.485000,180.000000,bottom
"H7","Pogopin_PNP","Mill-Max_Pogopin_0906-8-15-20-76-14-11-0_PNP_DUMMY",13.365000,-1.485000,180.000000,bottom

I get the following output in the CPL file:

Designator,Val,Package,Mid X,Mid Y,Rotation,Layer
H1,Pogopin_PNP,Mill-Max_Pogopin_0906-8-15-20-76-14-11-0_PNP_DUMMY,16.335000,1.485000,0.000000,bottom
H2,Pogopin_PNP,Mill-Max_Pogopin_0906-8-15-20-76-14-11-0_PNP_DUMMY,13.365000,1.485000,0.000000,bottom
H3,Pogopin_PNP,Mill-Max_Pogopin_0906-8-15-20-76-14-11-0_PNP_DUMMY,16.335000,-1.485000,0.000000,bottom
H4,Pogopin_PNP,Mill-Max_Pogopin_0906-8-15-20-76-14-11-0_PNP_DUMMY,16.335000,1.485000,0.000000,bottom
H5,Pogopin_PNP,Mill-Max_Pogopin_0906-8-15-20-76-14-11-0_PNP_DUMMY,4.455000,1.485000,0.000000,bottom
H6,Pogopin_PNP,Mill-Max_Pogopin_0906-8-15-20-76-14-11-0_PNP_DUMMY,7.425000,1.485000,0.000000,bottom
H7,Pogopin_PNP,Mill-Max_Pogopin_0906-8-15-20-76-14-11-0_PNP_DUMMY,13.365000,-1.485000,0.000000,bottom

Please note H1 and H4 is suddently placed in the same position!

Throw error if multiple files are present

Hi All
I have spent a good half hour debugging why one component was missing in the JLC bom.
Turns out I had a seperate export folder, which also had a valid .pos file.
Could we perhaps throw an error if there are multiple XML, pos files etc?
alternatively use the latest one.

These file inconsistencies can be quite dangerous IMO

Thanks for a great tool!

Require documentation/examples when changing rotation database?

I have used this tool a few times already, and I am loving it.

I still frequently come across components, that are incorrectly rotated. For instance, just now I see a tantalum cap that is reversed (C7171). There is a particular rule about this one package in the database already:

"^CP_Tantalum_Case-A_EIA-3216-18",180

So either

  1. the original rule was incorrect;
  2. JLC are inconsistent even among the same package;
  3. JLC have updated their orientation.

Neither strikes confidence in JLC or JLCKicadTools. The last one would be particularly disastrous for when I'd like to reorder an old design.

I suggest that in the future all changes to cpl_rotations_db.csv are required to be documented with an example component. This could just be a additional column (AFAICT, that is acceptable even without any changes to the current script).

This way, I can at least verify that particular rule.

What's more, there should be a reference board maintained somewhere (perhaps even in this same repo), that includes all of those components. This is important for regression testing: The database features both generic rules (^QFN-) and more specific ones (^(.*?_|V)?QFN-(16|20|24|28|40)(-|_|$)). I can easily see how changes could cascade and break components the author did not intend to touch.

Ideally testing would be automated, but I don't see how that could happen :)

Components with footprints from my own library do not show up in th ecpl file

Hello,
I did all the steps outlined in your blog and i discovered that all the components that use footprints which i created do not show up in the cpl file generated. They do show up in the bom file generated. I am assuming i am missing something in my footprints, but cant figure out what.

Do you have any suggestions? I am running on OS X
thanks

Component not being replaced

Hi Matthew,
Here is the case.
I made a project, did everything according to the instructions and generated the files. I uploaded the gerners, the bom and the cpl to jlcpcb and discovered that two components where out of stock.
I went back chose replacements for those two components and made sure that all the places of those compnents had the new JLCPCB codes in the components in the sch.
I then generated the bom and check the xml file to make sure that the new JLCPCB codes where in the xml.
Then when i ran the jlckicadtools script it kept using the old components code.
I cant seem to find where is the jlckicadtools is getting the previous code since there is nowhere in the kicad files

Moving to Kicad-plugin?

Hi @matthewlai

First, thanks for the great work :)
I noticed V6 imports all the extra fields from schematic (LCSC etc).
I guess this would make it possible to run the script from PCBnew, and avoid a bunch of the export steps.
Perhaps it could even be made as an actionplugin.
Would this make sense?

I do understand if the amount of work would not be worth the gain.

Kindest regards

Moving requirement for logzero to setup.py

Thank you for making this tool. It is very useful for generating JLC production files.

Is there a reason you have the two-step install, using pip to install requirements instead of just putting the requirement for logzero in the setup.py file? If not, then I would be happy to submit a PR to move this requirement into the setup.py.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.