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

Support merging multiple schematics for fab output #632

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mvirkkunen
Copy link

I want to be able to panelize boards from multiple different projects together in the same panel. This is an open feature request elsewhere, but for my purposes I just implemented a simple layout plugin to handle it. The plug in API is nice!

However for "fab --assembly" to work I also need to be able to merge the schematics for each board. This PR allows the user to specify the "--schematic" argument multiple times, and all components will be merged from each schematic.

For this to work, the reference designators must be unique across all schematics and I added validation to check that. Currently I think duplicate references are happily added to the BOM. This requirement could be relaxed if UUIDs were used to correlate components and reference designators were renamed to be unique for each board, however I think that would confuse both users and fabricators pretty fast. And it's pretty easy to have unique references by just setting the starting index for generating them to different values for each project.

If this is too much of a hack, feel free to close. I also de-duplicated the code that filters parts out of the BOM to make the uniqueness check work more nicely.

Also added uniqueness validation for reference designators.
@yaqwsx yaqwsx force-pushed the master branch 5 times, most recently from 63883b3 to e0c897b Compare February 26, 2024 06:43
@yaqwsx
Copy link
Owner

yaqwsx commented Mar 17, 2024

Hi, I am sorry for not responding sooner enough. I am well aware of this problem, and I already know the proper solution. It has not been implemented yet as there are several complications with differences between KiCAD 7 & KiCAD 8.

The idea is the following:

  • Panelized PCB no longer has any connections to the schematic. There is no 1:1 mapping between it and the panel.
  • There is 1:1 mapping only between individual boards appended via apeendBoard and their schematics.
  • We treat the panel as a machine-generated file. It shall not be manually edited.
  • Therefore, it makes sense to bake in all the component attributes from the schematics to every component in the panel.
  • We should build the fabrication files based on these baked-in variables. We should not perform any mapping between components in the panel and schematic after the panel is created, as it can break easily.

However, the technicality I experience is the selection of a suitable format for baking.

  • There were footprint attributes in KiCAD 6 and 7. However, they were removed as KiCAD unified properties handling between schematics and board. Thus, we can no longer use them.
  • We could serialize all attributes from the schematic and add them to hidden text to the footprint. This is 100% portable and bulletproof, but it can yield a cluttered view of the panel in the Pcbnew if the user displays hidden texts (unfortunately, starting with KiCAD 7, text can no longer have zero height).
  • Another option is storing the baked annotations in the project file (JSON since KiCAD 7). KiCAD seems to be fined with adding unknown sections. We couldn't implement this sooner as we supported KiCAD 6. Also, the downside is that we cannot implement this in the GUI as there is no API to access the project file (and once the user closes the board, it gets overwritten).
  • We could store the baked-in attributes in a separate file. There is, again, a problem with GUI as we have no idea where the user will save the panel.
  • Lastly, we could abuse some board property to save them. However.
    • textual variables seem like a good option, but there is no API for them. When there is no API, it doesn't work with GUI.
    • we could add a hidden text item and position it outside the drawing sheet. However, this feels like a huge hack.

I would like to hear your feedback on my solution proposal. Does it fit your use-case? Do you have ideas about improvements? Please, let me know.

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.

None yet

2 participants