KiCad / kicad-library-utils

Some scripts for helping with library development
GNU General Public License v3.0
128 stars 95 forks source link

Handle footprint name as string #336

Open akosmarton opened 3 years ago

akosmarton commented 3 years ago

If the footprint name contains only numeric characters, it should be converted to string to ensure the proper rules checking.

evanshultz commented 3 years ago

That is not a valid footprint name for this library. See our footprint naming scheme at https://kicad-pcb.org/libraries/klc/F3.6/. And these check scripts are for those guidelines/rules. So as @cpresser said, this doesn't hurt anything but it's not needed when building footprints that conform to the rules of this library.

cpresser commented 3 years ago

I think this is a use full addition anyway. The scripts should not throw a cryptic error message just because the user put in stupid input.

The next logical step is to create a F3.py that actually checks that rule. I just skimmed over the F3 section of KLC, and it seems there is no way a footprint can only contain numbers. So we could check that. And perhaps throw a warning if its number of characters is <3. And throw errors if it contains evil code-points (thinking of emojis, german umlauts, ...)

chschlue commented 3 years ago

german umlauts

Those are still considered evil? SCNR

chschlue commented 3 years ago

Bad jokes aside, we might have to (and be able to) relax naming rules. See https://github.com/KiCad/kicad-symbols/pull/2938

cpresser commented 3 years ago

Nevertheless, we can have a script output a warning if non latin chars are used. A good check would verify that any char is present in the kicad font. Basically an explicit whitelist.

Somewhat off-topic Footprint-names are also file-names. Yay! I have no clue how the Pi would do as filename for windows/linux/mac users. With different locales even more complication could arise.

chschlue commented 3 years ago

Yes, I'm not opposed to this PR.

OT: True, the π example is a symbol. But all supported platforms can handle multibyte filenames and assuming there have already been users calling their schematics MyCool80'sHeävÿMëtälPCB.sch or something without issue, I guess KiCad's codebase isn't too brittle.

Even more OT: I wonder how many ERP systems these π parts broke along the supply chain ;)

Edit: Not to mention Cyrillic/Greek/Arabic/whatever users in general.