jsreynaud / kicad-action-scripts

Some KiCad plugins in Python
GNU General Public License v3.0
250 stars 50 forks source link

Fix/issue 58 #59

Closed CGrassin closed 1 year ago

CGrassin commented 1 year ago

This PR fixes #58 .

Before: Screenshot from 2023-02-28 17-56-36

After: image

The explanation for the clearance functions can be seen here: https://docs.kicad.org/doxygen/classPAD.html It seems that GetLocalClearance does not account for DRC rules.

matthuszagh commented 1 year ago

I'm not sure if this PR is ready for review, but I just tested it on my board. I no longer see clearance violations for non-randomly spaced vias, but I do still see them when randomization is added. Thanks for creating this PR!

CGrassin commented 1 year ago

Thank you so much for testing this PR! I checked, I can reproduce your issue. I wrongly assumed that the randomization was applied before checks, but it is applied after. As a result, it can generate all sorts of DRC violations (pads, board edges, tracks...). Unfortunately, I had a deeper look in the code and it is not as easy as just moving the random offset code, significant changes are required in the clearance testing functions so that it tests against the actual position of a via and not a computed position... I can probably fix it myself but it will be a more involved PR that will take more time to fully test. As a consequence, my opinion is the following:

  1. We should review this PR as-is to fix the regular behavior,
  2. We should create another separate issue (and later PR, hopefully) to track the clearance problems with randomization.

@jsreynaud If you are fine with that, then this PR is ready for review.