se...@malmoset.com
unread,Mar 14, 2025, 10:33:05 AMMar 14Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to KiCad Developers
Problem:
The gencad export duplicates every footprint regardless of the setting of the "Generate a new shape" option.
Cause:
In export_gencad_writer.cpp (hashFootprint around line 615), footprints are hashed to determine duplicates. The hashing has some limitations though. First off, it hashes the fields. Those will always be different, since it includes the reference. Even excluding the reference, they're usually different. Example: 0402 Capacitors. Many different capacitors, same footprint, but the export generates a footprint for each.
Next up, the GraphicalItems hashing. This can also be problematic because the lines around a footprint can end up saved in a different order, even if they came from the same library footprint. I'm not sure of the underlying cause here, but it breaks the hashing.
Solutions:
Easiest:
1. I think we should eliminate hashing of the fields (remove lines 617,618). I can't think of why this is useful.
2. For my use, I could also safely eliminate the hashing of graphical items (silk screen), since the differences aren't visible anyway. Others might disagree on this.
Thoughts:
Field hashing should probably always be removed. It essentially forces on the "UsePinNamesUnique" option.
1. The UsePinNamesUnique option provides a means to get individual footprints generated for everything. So, I don't see a big need for the hashing function to be super conservative. There's an easy way for a user to get a conservative output if they want it. Thus, I'd suggest removing both the field hash and the graphical hash.
2. The next possibility is to remove the field hash and to sort the lines of the graphical elements in such a way that they will always output in the same order and the hashes will be compatible. I've tried to come up with a sort method for this and haven't come up with one.
3. Add another option to the export called "Precise footprint comparison" or similar that enables the graphical hash. Turn it off by default.
I'm happy to produce patches for any of these options, just wanted to query the maintainers about what they think is the best approach before I built and submitted the patch.
Thanks,
Sean