Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misaligned midpoint in some footprints #24

Closed
Xyntexx opened this issue Nov 6, 2022 · 10 comments
Closed

Misaligned midpoint in some footprints #24

Xyntexx opened this issue Nov 6, 2022 · 10 comments

Comments

@Xyntexx
Copy link
Contributor

Xyntexx commented Nov 6, 2022

When using the preview of the JLCPCB assembly service some footprints are not positioned correctly.
This issue appears on footprints that have a silkscreen that moves the midpoint of the footprint away from the midpoint of the pads.

Part#: C2934560

image
Original part.

image
After I moved the footprint midpoint to the centre of the pads.

image
The same problem appears on this USB-C connector, part# C2765186

I haven't tested this on any other than these two parts. I could not find a source on where the midpoint should be.

@TousstNicolas
Copy link
Owner

Is it also the case with footprints not created by my script ?
I found an issue that seems similar : Bouni/kicad-jlcpcb-tools#143
Looks like it might be an issue that come from the way JLC handles the kicad footprints, and does not come from how the footprint is generated.

I will try to get deeper in the issue when I have more time.

@Xyntexx
Copy link
Contributor Author

Xyntexx commented Nov 29, 2022

I think I've created a working workaround where I search for the middle point of the pads. Should we create a branch for this?

@TousstNicolas
Copy link
Owner

Yes, it might be better to create a new branch if we need to work on this.
Thanks for the work !

@Xyntexx
Copy link
Contributor Author

Xyntexx commented Jan 16, 2023

I've pushed the workaround to a branch in my fork. https://github.com/Xyntexx/JLC2KiCad_lib/tree/Pad__center

@TousstNicolas
Copy link
Owner

TousstNicolas commented Jan 21, 2023

So based on your changes, if I understand correctly, the issue was that JLCPCB only takes into account the pads when centering the component while I also took other parts ?

Are there any cases where a footprints does not have any pads ? I don't recall ever encountering this case. It might be too much to keep track of the positions of the pads only, and every other parts in the footprint_info class.

It also seems to bring issues with the 3D models centering, check with component C698918 for example where the X axis is not right (while correct with the current version).

Also, can you try to use black to format your code and keep it consistent with the rest.

As always, a big thanks for your work !

@Xyntexx
Copy link
Contributor Author

Xyntexx commented Jan 21, 2023

Is there any reason not to use the origin coordinates for the translation provided in the footprint data?
x and y from the data from C698918

{
  "head": {
    "docType": "4",
    "editorVersion": "6.5.22",
    "c_para": {
      "package": "DO-218AB_L13.5-W8.4-LS15.5-FD",
      "pre": "D?",
      "Contributor": "lcsc",
      "link": "https://item.szlcsc.com/296833.html",
      "3DModel": "DO-218AB_L13.5-W8.4-LS15.5-FD"
    },
    "hasIdFlag": true,
    "x": 4032.4,
    "y": 3000.5,
    "utime": 1626858189,
    "uuid": "aa4c8bfeca62411b90acab80a9905e2f",
    "importFlag": 0,
    "transformList": ""

@TousstNicolas
Copy link
Owner

It's been a long time since I did this part, but from what I remember, These data where not matching the expected offset.

@Xyntexx
Copy link
Contributor Author

Xyntexx commented Jan 22, 2023

I've updated the https://github.com/Xyntexx/JLC2KiCad_lib/tree/Pad__center branch and used the origin coordinates provided in the data to keep the origin of the part where it's intended.
The main reason for me is to keep the footprint compatible with JLCPCB assemble service part origins.

Apparently, EasyEDA automatically uses the middle of the 3d model and places it flat on the board regardless of the origin of the 3d model. Kicad uses the origin of the 3d model as the reference. With a few extra lines, we can calculate the midpoint of the 3d model and translate the 3d model accordingly.
3D-model alignment should even improve when using this method.

It seems to work for me but let me know if you find some problems.

I added a black formatting GitHub action to my main branch just to test it. That might be a good way to make sure the contributed code is on par with the repository requirements. It can even make a commit or a pull request with the correctly formatted code. 😉

@TousstNicolas
Copy link
Owner

That's a lot of stuff done, thank you !

I will try to test everything today.

@TousstNicolas
Copy link
Owner

merged in 12c6860

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants