Need some guinea pigs for a rule-based DRC <<PROTOTYPE>>

@JeffYoung: Thanks, that seems to solve it. I will test in detail soon.

Feature Request: How about some error messages, if a rule parameter/variable cannot be understood.
"E.G. Could not find Layer “TOP1"”. That would make debugging easier.

First test impression: I would like to see the pad clearance only for padclearance, not for inner layers. E.g. here.
grafik

There is nothing on GND2, however it shows the pad clearance. I find that confusing.

Maybe also some warning at the DRC if there is some rule (apparently well written) but never used at the layout.

1 Like

@JeffYoung: I tried with the pad clearance and the pad clearance still shows up. Maybe you could work on that?

Then I tried to modify the pad rule
grafik

If you want to copy it:

(version 1)
(selector (match_type “pad”) (rule “padclearance”))
(rule “padclearance” (constraint clearance (min 0.1mm)))
(selector (match_layer “TOP1”) (rule “default”))
(rule “default” (constraint clearance (min 0.1mm)))
(selector (match_layer “GND2”) (rule “two”))
(rule “two” (constraint clearance (min 1.0mm)))

Why does rule two define the pad clearance? I do not understand.
@JeffYoung: You should have my boardfiles, so it should be easy to diagnose.

EDIT after playing around: It seems to me, that it’s a match_type issue.

@JeffYoung: Are there any news? Ping =)

I got sucked in to Eeschema netclasses and undo. I hope to get back to this shortly…

2 Likes

@overthere, I just merged an update which brings in the new expression syntax. Your rules would look something like:

(version 1)
(rule "default"
    (constraint clearance (min 0.1mm))
    (condition "A.onLayer('TOP1')")
)
(rule "two"
    (constraint clearance (min 5.0mm))
    (condition "A.onLayer('GND2')")
)
(rule "padclearance"
    (constraint clearance (min 0.1mm))
    (condition "A.type == 'pad'")
)

I’m not sure when the nightlies are built, so if they’ve already started it won’t make it in tonight’s.

He he… and you’ll need to use the standard layer name instead of ‘GND2’ for now because the new code doesn’t handle user layer names either…

[It was easier to fix than I thought so it’s in now too.]

I’m looking at this example and the Syntax Help. Except for these examples I don’t have an idea where the properties or functions in the expressions come from. I would like to see some reference to a place where I can find them, unless they can be put into the Syntax Help.

@JeffYoung:

  • If i use the padclearance and fill with b, Kicad crashes.
  • If i use a wrong user-netname, kicad crashes.
  • If i reopen the project in pcbnow, kicad crashes as a subsequent error. If you save with a wrong rule (that cannot be read, there should be a warning wether i want to save the project).

Tested version:

Application: KiCad

Version: (5.99.0-2364-g42a2f1346), release build

Libraries:
wxWidgets 3.0.4
libcurl/7.66.0 OpenSSL/1.1.1d (Schannel) zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.1.1) nghttp2/1.39.2

Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW

Build Info:
Date: Jul 21 2020 23:00:28
wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8)
Boost: 1.71.0
OCE: 6.9.1
Curl: 7.66.0
ngspice: 31
Compiler: GCC 9.2.0 with C++ ABI 1013

Build settings:
KICAD_SCRIPTING=ON
KICAD_SCRIPTING_MODULES=ON
KICAD_SCRIPTING_PYTHON3=OFF
KICAD_SCRIPTING_WXPYTHON=ON
KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
KICAD_SCRIPTING_ACTION_MENU=ON
BUILD_GITHUB_PLUGIN=ON
KICAD_USE_OCE=ON
KICAD_SPICE=ON

I used now another PCB version, and I get random results for the filling.

First:


Second:

Third…
grafik

In the third (which is basically only the GND2 rule copied, obvious filling errors in the clearance are present:
grafik

I propose that you play a little bit with the PCB file that I send with you. Than you can probabbly reproduce my encountered errors.

We have a test-suite for the DRC engine that we’re building out; the purpose of the guinea pigs is more to find out what people try to do with it (so that we can see if the expressivity is sufficient). To that end I’m fixing bugs that keep people from trying it out, but there’s no expectation at present that it’s anywhere near stable.

The crashers should be fixed; I haven’t had a chance to look at the random zone filling yet…

@overthere, I can’t seem to find your board file. Can you send it again?

(I have a “SRC_Power_Adapter”, but it’s been cut down so much to isolate a bug that I can’t tell if it was the one you sent me or not. I also have a “vhf_uhf_com” and “motherboard” from about the right time-frame, but those don’t look right either.)

Cheers,
Jeff.

So you didn’t try it, huh? :stuck_out_tongue:

(There’s property completion in the editor.)

Aha! That is ingenious. (Or was it you? I’m not sure.)

image

Still I would like to know where they come from and preferably have some documentation - although many of them look self-explanatory.

Well, the whole thing is advanced functionality for power users as far as I can see, so I don’t expect it to be easy for beginners. But in the end it needs good documentation to be useful. It’s like a simple programming language and programming library!

1 Like

This thing is still in heavy flux, people are debating what properties to include, what the syntax should be, etc. There will certainly be documentation after it is more settled :slight_smile:

1 Like

Dear Jeff (@JeffYoung) I installed the new nighly and I’m now testing. These are my thoughts (unordered).

  • I downloaded a new project, so I do not have any legality from previous (errors) saves.
  • I used the following and it leads to a crash.
(version 1)
(rule "default"
    (constraint clearance (min 0.1mm))
    (condition "A.onLayer('TOP1')")
)
  • I just send you the test board again. Should now be easier to fix for you.

Version

Application: KiCad

Version: (5.99.0-2385-g7067e42da), release build

Libraries:
wxWidgets 3.0.4
libcurl/7.66.0 OpenSSL/1.1.1d (Schannel) zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.1.1) nghttp2/1.39.2

Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW

Build Info:
Date: Jul 23 2020 00:49:19
wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8)
Boost: 1.71.0
OCE: 6.9.1
Curl: 7.66.0
ngspice: 31
Compiler: GCC 9.2.0 with C++ ABI 1013

Build settings:
KICAD_SCRIPTING=ON
KICAD_SCRIPTING_MODULES=ON
KICAD_SCRIPTING_PYTHON3=OFF
KICAD_SCRIPTING_WXPYTHON=ON
KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
KICAD_SCRIPTING_ACTION_MENU=ON
BUILD_GITHUB_PLUGIN=ON
KICAD_USE_OCE=ON
KICAD_SPICE=ON

Yes of course, but I want everything right now. :smirk:

Do you invent the property and function names for each case for this rule system, or do they come from somewhere else? Are they in any way documented in the KiCad code?

They’re actually part of the infrastructure for the new Inspector (no, the panel itself is not in yet).

You should be able to find them by searching for

propMgr.AddProperty(
1 Like

The “wandering” zones was a multi-threading issue. They can be diabolical, but this one wasn’t too bad to track down.

Bits up soon…

Discovered a bug. Used the following rules

(version 1)
(rule "default"
    (constraint clearance (min 0.1mm))
    (condition "A.onLayer('TOP1')")
)
(rule "gnd"
    (constraint clearance (min 5.0mm))
    (condition "A.onLayer('GND3')")
)
(rule "pwr"
    (constraint clearance (min 1.0mm))
    (condition "A.onLayer('POWER2')")
)
(rule "padclearance"
    (constraint clearance (min 0.1mm))
    (condition "A.type == 'pad'")
)

And it uses last clearance, so the condition does not seem to have an effect. You can reproduce this with the testboard. (Blue and orange should not have the same distance)

grafik

Version
Application: Pcbnew

Version: (5.99.0-2392-g6529e339a), release build

Libraries:
	wxWidgets 3.0.4
	libcurl/7.66.0 OpenSSL/1.1.1d (Schannel) zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.1.1) nghttp2/1.39.2

Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW

Build Info:
	Date: Jul 23 2020 23:55:29
	wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8)
	Boost: 1.71.0
	OCE: 6.9.1
	Curl: 7.66.0
	ngspice: 31
	Compiler: GCC 9.2.0 with C++ ABI 1013

Build settings:
	KICAD_SCRIPTING=ON
	KICAD_SCRIPTING_MODULES=ON
	KICAD_SCRIPTING_PYTHON3=OFF
	KICAD_SCRIPTING_WXPYTHON=ON
	KICAD_SCRIPTING_WXPYTHON_PHOENIX=OFF
	KICAD_SCRIPTING_ACTION_MENU=ON
	BUILD_GITHUB_PLUGIN=ON
	KICAD_USE_OCE=ON
	KICAD_SPICE=ON