mvnmgrx / kiutils

Simple and SCM-friendly KiCad file parser based on Python dataclasses for KiCad 6.0 and up.
GNU General Public License v3.0
78 stars 25 forks source link

Adding support for bus_alias S-Expression. #92

Closed hlprasu closed 1 year ago

hlprasu commented 1 year ago

See https://gitlab.com/kicad/services/kicad-dev-docs/-/merge_requests/53/diffs

mvnmgrx commented 1 year ago

Thanks for your PR. I've added some minor comments, after which i am happy to merge your changes. I've furthermore added a small testcase in #94 that you can use to validate your code. If i understood bus_aliases correctly, the test at should pass with your changes.

Also, you have to add the following to the symbol class for the changes to show up in a schematic's S-Expression:

        # (...)

        if self.busAliases:
            expression += '\n'
            for item in self.busAliases:
                expression += item.to_sexpr(indent+2)

        # (...)

Bus aliases seem to be listed above junctions in a schematic, so this has to go on this line here:

https://github.com/mvnmgrx/kiutils/blob/25711d69841e83d392fd9c61d97e90e24737929f/src/kiutils/schematic.py#L256

hlprasu commented 1 year ago

if self.busAliases: expression += '\n' for item in self.busAliases: expression += item.to_sexpr(indent+2)

Done!

mvnmgrx commented 1 year ago

Fixes #93