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

Adds support for hierarchical sheets when rewriting schematics files. #506

Merged
merged 2 commits into from
Aug 2, 2024

Conversation

gonzalop
Copy link
Contributor

@gonzalop gonzalop commented Jul 28, 2024

Recursively proceses hierarchical sheets when rewriting schematics files.

@chmorgan
Copy link
Collaborator

@gonzalop the plugin already supports generating design packages for hierarchical sheets. Is this adding support to another feature area of the plugin? If so, can the commit subject be clarified?

@gonzalop gonzalop changed the title Adds support for hierarchical sheets. Adds support for hierarchical sheets when rewriting schematics files. Jul 28, 2024
@gonzalop
Copy link
Contributor Author

gonzalop commented Jul 28, 2024

Updated. the subject The code makes it rewrite schematics files when exporting changes made by the plugin. Before this change, only the main schematics file was updated.

@chmorgan
Copy link
Collaborator

@gonzalop ahh gotcha, can you update the commit message itself? The subject of the PR might default to the subject of the first commit or something but editing the PR subject doesn't directly edit the commit log message. Should be possible to edit it via 'git commit --amend' or with a git rebase.

@gonzalop
Copy link
Contributor Author

Done.

Thanks.

@Bouni
Copy link
Owner

Bouni commented Jul 30, 2024

@chmorgan Did you already test this PR? I have never before used hierarchical sheets in KiCAD, so I canno really test this ...

@chmorgan
Copy link
Collaborator

chmorgan commented Jul 30, 2024 via email

@Bouni
Copy link
Owner

Bouni commented Jul 30, 2024

The export function writes LCSC data that was set via the Plugin back to the schematic.

@gonzalop Can you provide an example project so that I can test this PR?

@gonzalop
Copy link
Contributor Author

gonzalop commented Jul 30, 2024

Here's an example project: 6-example.prj.zip
And here's a screenshot of the output when exporting to schematic:
Screenshot from 2024-07-30 18-07-55
(the screenshot shows 'LCSC Part' which I added in another pull request)

@Bouni
Copy link
Owner

Bouni commented Jul 31, 2024

For whatever reason this does not work for me ...

I run KiCAD 8.0.4

If I extract your zip and open the project, the export to schematic function does not find the correct kicad_sch file because of the .prj in the filename. If I then select the right file 6-example.prj.kicad_sch in this case, the only ozutput I see is

2024.07.31 16:03:12 - INFO - load_schematic -  Kicad 8+...
2024.07.31 16:03:12 - INFO - _update_schematic8 -  Reading C:\Projekte\KiCad\6-example.prj\6-example.prj.kicad_sch...

Nothing happens to the another-sheet.kicad_sch file.

Furthermore, none of the two resistors in the schematic files gets the LCSC property set ...

@gonzalop
Copy link
Contributor Author

That's odd. It might be some windows oddity. I'll find a windows machine to test on later today and report back.

@gonzalop
Copy link
Contributor Author

It worked for me just now!?
kicad8-windows-sheet

@Bouni
Copy link
Owner

Bouni commented Jul 31, 2024

Very strange. Let me look into it on Friday again, tomorrow is a public holiday 😁

@gonzalop
Copy link
Contributor Author

gonzalop commented Jul 31, 2024

Enjoy the holiday!

FWIW, this was a fresh install of KiCAD 8.0.4 on a Windows 10 machine, and I cloned the branch with this pull request into the scripting/ folder, then cloned the example project and loaded it up in KiCAD.

@Bouni
Copy link
Owner

Bouni commented Aug 2, 2024

Ok, I think I figured it out!

This returns a dict after #487 was merged:

store_parts = self.parent.store.read_all()

so this no longer works:

for part in store_parts:
if value == part[0]:
newLcsc = part[3]
break

replaceing

                    for part in store_parts:
                        if value == part[0]:
                            newLcsc = part[3]

with this

                    for part in store_parts:
                        if value == part["reference"]:
                            newLcsc = part["lcsc"]

solves the issue.

Can you please update and rebase your PR

@gonzalop
Copy link
Contributor Author

gonzalop commented Aug 2, 2024

Done.

Recursively proceses hierarchical sheets when rewriting schematics
files.

This only affects KiCad 8+.
@Bouni Bouni merged commit b8a88c1 into Bouni:main Aug 2, 2024
2 checks passed
@Bouni Bouni added the enhancement New feature or request label Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants