theacodes / kicanvas

The KiCAD web viewer
https://kicanvas.org
Other
601 stars 29 forks source link

[HOW] Hierarchical schematics #77

Open set-soft opened 7 months ago

set-soft commented 7 months ago

Describe the bug Ok, I have various problems and I'm not sure which ones are bugs and which ones are wrong use. Sorry for the mess.

The first thing is a question when you have an schematic with multiple sheets: should I add a kicanvas-source for each sheet? It looks odd to me, but I could understand a few reasons. It would be nice if specifying the top-level was enough.

Now, assuming this is the right way to do thing (specify one kicanvas-source for each source file).

I think doing a double click on a sub-sheet box should open the sub-sheet. I tried a simple case and it doesn't work: example_1.zip

Then I figured out that a double-click goes to the PCB ... which isn't really useful, here is the example: example_2.zip

I also found issues handling complex hierarchies, natural for a program in alpha stage, but that I think should be addressed.

The first issue is related to the fact that I have to list each source file explicitly. This generates problems when the same sheet is recycled, here is an example: example_3.zip

Here we have sub-sheet.kicad_sch used twice, but when trying to browse it you'll see only one instance. This is natural because you are not really navigating the hierarchy. And here comes why I think we should just use one kicanvas-source for the top-level (and use double-click to open the sub-sheet). Note: look the hierarchical sheets, the boxes and the text has some strange offset.

And I also found problems when two schematics has the same file name, but with different path, here is the example: example_4.zip

In this case the top level uses 1/1.kicad_sch, which uses 1/1/1.kicad_sch, but only one of them is visible in KiCanvas.

Also noticed that even when the docs encourage to use the project file this isn't used to load the rest. It would be nice if KiCanvas could try to load the schematic and PCB when you use a project as source.

Again, sorry for all of this together, some stuff are clear bugs, others are ideas, and I also have doubts.

theacodes commented 7 months ago

Thanks, @set-soft! This is fantastically detailed. I definitely think embedding needs more testing with projects instead of individual files. I'll take a look at this once I'm able to spend some more time on the project!