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

Adding a new symbol from the library #1

Open
Monacrylic opened this issue Mar 13, 2024 · 2 comments
Open

Adding a new symbol from the library #1

Monacrylic opened this issue Mar 13, 2024 · 2 comments

Comments

@Monacrylic
Copy link

Thank you for the pioneering work!

I was trying add a new symbol from the KiCAD library (installed on my PC). There doesn't seem to be function that allows me to do so, or maybe I'm not using it correctly :)

@psychogenic
Copy link
Owner

Hello Siddharth,

Thanks :)

Short version: no, you're not using it wrong, there simply is no such functionality (at least at this stage).

Symbols may be clone()d, but constructing them from scratch was a toughie. If you read in any schematic, choose one of the symbols and use the not-really-documented raw() method
myschem.symbol[0].raw()
you'll see, under the hood the symbols are rather complex beasts. They are based on one of the lib_symbol items (that's only present in the schem file when that symbol type is actually in the schematic), and then derive their pins and other things from that, plus having all the properties etc.
In order to support just creating symbols, we'd have to have a way to either replicate kicad's functionality (meaning locate and parse the various symbol libraries) and then fill in all the extra symbol bits... I didn't want to start re-implementing kicad to that extent, so... it's just not there.
Maybe there's a way to do this simply, but for the moment if you want a power symbol, you'd have to

  1. have another of same type in schem
  2. find it--the power symbols have autogenerated names PWR1234 or something, so you actually only get to know which it is based on properties
  3. clone it

Simpler objects can be created fresh, and these are actually instantiated based on templates in skip.element_template. In theory, the same might be doable for symbols, but the raw() dump above will give you an idea of just how many elements you'd have to tweak (meaning either make the user responsible for, or actually force as arguments to the constructor).

Sorry I can't give you a better answer on that front.

@Monacrylic
Copy link
Author

Thanks Pat,

I totally understand. I was just going through the templates in skip.element_template, and understood what maybe limiting the generalization. Just wondering if there could be some code that we could borrow from skidl (https://github.com/devbisme/skidl).
Since they've already implemented the Symbol parsing from KiCAD's libraries.

That said, I'm new to library development, but I'll be super happy to take a shot at implementing this functionality. This library has the potential to open up a new world of possibilities for integrating AI into KiCAD. The lack of an eeschema API is the primary roadblock!

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