Closed dzid26 closed 5 months ago
Hi. Just a comment on this change, which was breaking for me. I had built my footprints setting the footprint anchor where I wanted the component placed. This change moves what was deliberately designed by me to some point at the center of all pads in the component, over which I have no control other than manually adding a hard to compute offset to each component. I have no control over the bounding box as far as I can tell. Looks like a great change for some components, not so great when you need to be specific about the origin. Really loving the plugin in general otherwise.
I had built my footprints setting the footprint anchor where I wanted the component placed.
Please explain how moving the anchor is easier than using offset feature. (I agree that calculating offset based on JLC render is not easy for some reason). Moving the anchor has a disadvantage that it also moves the footprint in Kicad pcb design. (Unless they changed it in Kicad 8).
Btw, the anchor is still used for SMD type components - this is because they were usually not a problem (the anchor is usually in the center anyway).
Moving the anchor is literally two clicks. To use offset, I have to figure out the coordinates of the center of all existing pads, then edit symbol fields and add the opposite offset to every occurrence of that component. Let's take as an example a 1U MX switch with a LED footprint. There are two through-hole pads, two SMD pads for the LED and three drills: With the current version, the center of all pads is an entirely meaningless point somewhere near (but not at) the middle of the central drill, because of how asymmetrical switches are. With the previous version, I had set the center to where it most makes sense for fabrication: in the center of the SMD pads, which is where JLC will assemble the LED. I set the anchor when I created the footprint, before I design the PCB. Having to design around the anchor is no problem, I usually move the grid origin while I'm working on those components to take it into account. So I have tried yesterday to change the footprints to be marked as SMD, because I thought that would help, but it didn't. Maybe I forgot to do something to have it acknowledged but I don't think I did: I changed the footprint type, updated the footprints and regenerated the fabrication files, and the switch LEDs were still offset. My current workaround is that I edited the two lines in the plugin code locally to restore the old formula. That works for the moment, but I'll have to re-patch every time I get an updated plugin... Thanks for looking into this, much appreciated, and again, the plugin is such a great time saver!
@bleroy I am going make some assumptions, so excuse me if I am mistaken. It seems that you or someone created a footprint that contains two parts - smd LED and PTH MX switch. If you split them in two separate components you wouldn't have the issue. (although your schematic would need to be probably changed too). If you wanted JLC to hand-solder the switch and the LED, you would need to split those two footprints anyway.
Another solution, as I mentioned previously, is to change this footprint type to the SMD then the anchor should be used. This is probably preferred for you.
Typically, for more complex footprints (horizontal USB-C ports, etc) it is not clear where the fabrication center should be placed so it requires a back and forth with JLC render to either place the anchor or add offset in BOM.
Splitting the footprint would be a huge hassle, as I would have to position two components where I have one today, and I move these around a lot when working on a keyboard layout. I can try to change it into a SMD footprint again, but as I said in my previous message that didn't work when I tried it. Ideally we'd have a setting to specify what position mode to use, between anchor and pad center...
Rationale
This helps with positioning of thruhole and unspecified component footprint types.
Description
Unlike the smd type, thru hole components in kicad library have their anchor on pin 1. This is an issue because it always requires adding position offset to thru hole components before exporting position file. This update uses bounding box center instead of the default anchor to solve this.
Additionally, I compute bounding box center based on copper pads for unspecified footprint types.
It could be done that way for all type of footprints, as I did in this PR https://github.com/Bouni/kicad-jlcpcb-tools/pull/381 but there they were using bounding box center anyways so the change was less drastic. Here we may still want to use kicad anchor for smt for some compatibility reasons.
I decided to use bounding box center based on copper pads for unspecified footprint types, because I know this type of computation is needed for footprints in projects imported from Altium (which by default are set as unspecified and always have an anchor on pin 1 regardless being SMT or thruhole).
Testing
I tested the change on kicad 7 and 8.
Here is an example of the thru-hole components test.zip from https://github.com/bennymeg/JLC-Plugin-for-KiCad/issues/101: Before: After:
Also, as mentioned, I use this change on a project that uses a lot of unspecified footprints imported from Altium and also few SMT components from kicad library.
Compatibility
The most affected projects will be those that used thru-hole components before the change. When regenerating position files with this update, they will most likely have to remove position offset.