kiplot icon indicating copy to clipboard operation
kiplot copied to clipboard

Treat some DRC Errors as Warnings

Open leoheck opened this issue 5 years ago • 14 comments
trafficstars

@set-soft

You have implemented a new way to filter out DRC issues with an external file in your fork of the kicad-automation-scripts following the discussion started on this issue https://github.com/INTI-CMNB/kicad_ci_test/issues/5#issue-627738147

This approach looks promising since the designer would have control being able to decide if the DRC errors sound. For instance, when the designer is implementing something not expected by the DRC checker.

This is just a reminder, to add this functionality in your fork of the kiplot if possible.

leoheck avatar Jun 06 '20 03:06 leoheck

An example using pcbnew_do instead of the kiplot since it does not implement it yet. Since these errors were filtered out because they were intentional, the DRC Step is passing.

Screenshot from 2020-06-06 18-57-28

leoheck avatar Jun 06 '20 22:06 leoheck

Is almost ready in this branch: https://github.com/INTI-CMNB/kiplot/tree/drc_errors Will merge tomorrow.

set-soft avatar Jun 09 '20 17:06 set-soft

Wow! I am going to test it right now.

-- Leandro Heck

On Tue, Jun 9, 2020 at 2:25 PM Salvador E. Tropea [email protected] wrote:

Is almost ready in this branch: https://github.com/INTI-CMNB/kiplot/tree/drc_errors Will merge tomorrow.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/johnbeard/kiplot/issues/18#issuecomment-641461209, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJX7YAHNC6ICKHH4CQPDDLRVZWADANCNFSM4NVP6RBA .

leoheck avatar Jun 09 '20 18:06 leoheck

I am not sure how to use it with kiplot. kiplot --help and README.md do not have any extra info about it. I will call this a bug.

image

Do you mind explaining this? I believe that I can also add something in the *.kiplot.yaml You don't need to do it here, just update there (for other users too), and let me know. So I can get the info from there validating that I understood how to do it.

leoheck avatar Jun 09 '20 18:06 leoheck

Found the example, I am going to test it.

image

leoheck avatar Jun 09 '20 20:06 leoheck

Let me check.

  • filter is a user-defined string.
  • number What is this? the Error type?
  • regexp Is the error to filter

For instance, I have these 2 errors.

** Found 2 DRC errors **
ErrType(45): Courtyards overlap
    @(144.361 mm, 101.752 mm): Footprint C16 on F.Cu
    @(144.825 mm, 101.244 mm): Footprint C19 on F.Cu
ErrType(45): Courtyards overlap
    @(159.885 mm, 97.663 mm): Footprint R4 on F.Cu
    @(160.393 mm, 97.191 mm): Footprint C21 on F.Cu

How do I create a filter to filter out jut the 1st one?

I believe a second regexp (you are calling regex but regexp looks more common) is missing there. Or is it a list? As in:

regexp : [ 'Regexp_1', 'Regexp_2' ] ?

leoheck avatar Jun 09 '20 20:06 leoheck

  • filter is a user-defined string. Yes, and is just a comment for documentation purposes.
  • number What is this? the Error type?. Yes is the error type.
  • regex Is the error to filter. Yes

The regex term gives 16.1M hits on Google, regexp 5.8M. So I'll keep regex.

And nope, only one regular expression. Regular expressions are really powerful, you don't need more than one. Perhaps we need to adjust the flags in the code, didn't try complex matches, but one should be enough.

I think your case should be covered by:

  filters:
    - filter: 'Ignore C16/C19 overlap'
      number: 45
      regex: 'Footprint C16'
    - filter: 'Ignore R4/C21 overlap'
      number: 45
      regex: 'Footprint R4'

set-soft avatar Jun 10 '20 13:06 set-soft

Thank you, this feature is going to be really useful.

I am thinking here that the way the error is being described does not look complete yet.

For instance, the error I want to filter out is composed of 2 overlapping items

# 1st error (this one I want to filter out)
ErrType(45): Courtyards overlap
    @(144.361 mm, 101.752 mm): Footprint C16 on F.Cu
    @(144.825 mm, 101.244 mm): Footprint C19 on F.Cu

I can also have a second error like thie one:

# 2nd error (this one have to fail, since was not intentional)
ErrType(45): Courtyards overlap <=== same as in 1st error
    @(144.361 mm, 101.752 mm): Footprint C16 on F.Cu  <=== same as in 1st error
    @(144.825 mm, 101.244 mm): Footprint C201 on F.Cu <== Not the Same!

It is the same ErrType 45, Courtyards overlap And it also references the C16 but they differ because of the second element.

For instance, if we could add a list of regexp it would be more descriptive and complete. And this should be evaluated as an AND operation meaning that all the items on that list have to match to have the ERROR filtered.

  filters:
    - filter: 'Ignore C16/C19 overlap'
      number: 45
      regex: ['Footprint C16', 'Footprint C19'] 

Does it make sense or I am missing something?

Also, I believe it would be nice to improve the names of the tags since yaml is there for that, to be descriptive. filter -> filter_msg number -> error_number ---> Even better error_type since DRC shows # ErrType(45):


Totally off-topic

The regex term gives 16.1M hits on Google, regexp 5.8M. So I'll keep regex.

Google Fight! haha, the first one is a substring of the second. haha

This was just a simple tip. Democracy is not always the right choice. I am learning this with the president of my country.

Reg is one of the abbreviations of the word regular Expr|Exp are abbreviations of the word expression image

leoheck avatar Jun 10 '20 14:06 leoheck

The current output is this:

- Running the DRC

Maybe it is good to show to the user the filter message to remember the filters being applied as in:

- Running the DRC
Ignore C16/C19 overlap
Ignore R4/C21 overlap

leoheck avatar Jun 11 '20 04:06 leoheck

Thank you, this feature is going to be really useful.

:-)

I am thinking here that the way the error is being described does not look complete yet.

For instance, the error I want to filter out is composed of 2 overlapping items

# 1st error (this one I want to filter out)
ErrType(45): Courtyards overlap
    @(144.361 mm, 101.752 mm): Footprint C16 on F.Cu
    @(144.825 mm, 101.244 mm): Footprint C19 on F.Cu

I can also have a second error like thie one:

# 2nd error (this one have to fail, since was not intentional)
ErrType(45): Courtyards overlap <=== same as in 1st error
    @(144.361 mm, 101.752 mm): Footprint C16 on F.Cu  <=== same as in 1st error
    @(144.825 mm, 101.244 mm): Footprint C201 on F.Cu <== Not the Same!

It is the same ErrType 45, Courtyards overlap And it also references the C16 but they differ because of the second element.

Try the following regex:

(?s)C16(.*)C19

Regular expressions are really powerful, you can do logic operations too. As an example:

(?s)C16(.*)(C19|C201)

Matches both, but not a violation involving C16 and a component that isn't C19 or C201.

Also, I believe it would be nice to improve the names of the tags since yaml is there for that, to be descriptive. filter -> filter_msg number -> error_number ---> Even better error_type since DRC shows # ErrType(45):

I really preffer less typing.

Totally off-topic

The regex term gives 16.1M hits on Google, regexp 5.8M. So I'll keep regex.

Google Fight! haha, the first one is a substring of the second. haha

This was just a simple tip. Democracy is not always the right choice. I am learning this with the president of my country.

I know our former president is a friend of yours ;-)

Reg is one of the abbreviations of the word regular Expr|Exp are abbreviations of the word expression

I understand, but we are talking about Python regular expressions in this context the term is regex. Here is the documentation:

https://docs.python.org/3/library/re.html

set-soft avatar Jun 11 '20 14:06 set-soft

The current output is this:

- Running the DRC

Maybe it is good to show to the user the filter message to remember the filters being applied as in:

- Running the DRC
Ignore C16/C19 overlap
Ignore R4/C21 overlap

This is more complex than it looks. The messages you mention are suitable for "information" verbosity level of KiPlot. But the tool that knows it is pcbnew_do and for it this implies much more messages.

I'm thinking about adding a warning message

set-soft avatar Jun 11 '20 15:06 set-soft

Cool, thanks. I know a little bit of regexp, so my question was more related to know how you are applying it. Are you applying it in the whole DRC log or you are applying each pattern for each DRC error? This changes the way you build the expression.

leoheck avatar Jun 12 '20 15:06 leoheck

Cool, thanks. I know a little bit of regexp, so my question was more related to know how you are applying it. Are you applying it in the whole DRC log or you are applying each pattern for each DRC error? This changes the way you build the expression.

Each error is processed individually. As one string including the \n character to separate the lines.

set-soft avatar Jun 12 '20 15:06 set-soft

Hi @leoheck! Now the filters are parsed using the "Optionable" class, this class enables aliases. So now your propposed key names are aliases for the original ones.

set-soft avatar Jul 12 '20 14:07 set-soft