MitjaNemec / Kicad_action_plugins

Kicad action plugins
413 stars 62 forks source link

Suggestions for replicate_layout instructions #31

Closed Scottapotamas closed 5 years ago

Scottapotamas commented 5 years ago

Description of issue

I was trying to duplicate a block of components/tracks/vias 5+ times and had a bit of trouble getting the plugin to work initially. I duplicated the hierarchical block in the top level sheet like so (stripped down for tests):

screen shot 2019-01-21 at 4 36 05 pm

(They have unique timestamps, not sure if this is relevant or not). The tree looks similar to the example gif in the repo.

image

After selecting the main footprint in PCBnew and running the plugin, I get the following error when it attempts to find the levels:

Traceback (most recent call last):

  File "/Applications/KiCad/kicad.app/Contents/SharedSupport/scripting/replicate_layout/action_replicate_layout.py", line 334, in Run
    replicator.calculate_spacing(sheet_levels[-1])

IndexError: list index out of range

Resolution

It took a while to figure out that I needed to:

  1. Annotate for the new parts in the duplicated sheet
  2. Import these parts into the existing pcb before the tool would work successfully.

Suggestion

I'm not a python/scripting person, but improving error handling to be a little more verbose in this particular error case would help a lot.

Alternatively, I could PR some more specific instructions into the readme (or separate guide document) if you want, its a great tool and I'd like to save someone the frustration I had!

Thanks!


System: Mac OSX 10.14, KiCAD 5.0.2, plugins are from current master branch 0e88015bbb03df5f143c2d71c94ac89da79fd5c3.

MitjaNemec commented 5 years ago

I am not really certain regarding the cause of the bug that you hit. It might be due to schematics not being in sync with layout or it might be something else. I've seen the bug before and I have a project where I can trigger it, so I'll address it.

Furthermore, I agree that improved error handling with nicer messages would be better, but I can only add this as the bug reports come in.

As for the more specific instructions, please submit the PR. All contributions are welcome.

Scottapotamas commented 5 years ago

I'm pretty sure now that it was due to a mismatch between the schematic and pcb, I wasn't aware the tool needed the footprints to be present, and in sync with the schematic. Once I updated the PCB with the newer parts, the error went away.

It sounds like you can already reproduce it, but I can provide you with a snapshot of the project which is able to replicate the issue if it helps.

I'll make a PR in the next day or so. Thanks once again, saved me hours of work today!

MitjaNemec commented 5 years ago

If it is not a problem for you to attach a project to public repository, then I would appreciate it. It might not help me, but at least I'll have the option when I'll start addressing the issue.