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

Fix parsing name of top level schematic lib symbols #112

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Frzoen
Copy link
Contributor

@Frzoen Frzoen commented Feb 26, 2024

I had an issue with Kiutils parsing locally edited symbols with names ending with _NUMBER as symbol with unitId and styleId, example:
have symbol called C_100n_0402 from some lib, modify symbol on the schematic. KiCad adds entry called C_100n_0402_1 to lib_symbols. This only occurs if there is multiple symbols/units from given library and one/more of them is modified on schematic


Here is how changes looks like in the file.

initial schematic symbol s-expression

(symbol  (lib_id "original_lib:C_100n_0402") (at 266.7 170.18 90) (unit 1)
    (in_bom yes) (on_board yes) (dnp no) (fields_autoplaced)
    (uuid 03f7402a-7464-4b4e-b06d-ffbb6bd78c22)
    (property "Reference" "CX" (at 269.24 166.3636 90)
      (effects (font (size 1.27 1.27) (thickness 0.15)) (justify right))
    )
....

after editing C_100n_0402 symbol on schematic:

(symbol (lib_name "C_100n_0402_1") (lib_id "origianl_lib:C_100n_0402") (at 266.7 170.18 90) (unit 1)
    (in_bom yes) (on_board yes) (dnp no) (fields_autoplaced)
    (uuid 03f7402a-7464-4b4e-b06d-ffbb6bd78c22)
    (property "Reference" "CX" (at 269.24 166.3636 90)
      (effects (font (size 1.27 1.27) (thickness 0.15)) (justify right))
    )
...

and symbol added to lib_symbols by KiCad

(symbol "C_100n_0402_1" (pin_numbers hide) (pin_names hide) (in_bom yes) (on_board yes)
      (property "Reference" "C" (at 20.32 -5.08 0)
        (effects (font (size 1.27 1.27) (thickness 0.15)) (justify left bottom))
      )
...

And parsing this entry from lib_symbols results in following Symbol object:

[Symbol(libraryNickname=None, entryName='C_100n', unitId=402, styleId=1, extends=None, ....

as the name matched regex in libId setter in Symbol class and was parsed as name containing unitId and styleId


For multi unit symbols case looks this same, _1/_2... is added to the name of the symbol and copy of it is stored in the lib_symbols section.

Using KiCad 7.0.11

Example project with symbol affected with this:
issue_example.zip

@Frzoen Frzoen changed the title Fix handling of top level schematic lib symbols Fix parsing name of top level schematic lib symbols Feb 26, 2024
@mvnmgrx mvnmgrx mentioned this pull request May 2, 2024
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

Successfully merging this pull request may close these issues.

2 participants