DRC does not report copper zone fill collision with track

Bug #1760097 reported by Miljan Pakovic
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
High
Unassigned

Bug Description

Application: kicad
Version: (5.0.0-rc2-dev-321-g78161b592), release build
Libraries:
    wxWidgets 3.0.3
    libcurl/7.54.1 OpenSSL/1.0.2l zlib/1.2.11 libssh2/1.8.0 nghttp2/1.23.1 librtmp/2.3
Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
    wxWidgets: 3.0.3 (wchar_t,wx containers,compatible with 2.8)
    Boost: 1.60.0
    Curl: 7.54.1
    Compiler: GCC 7.1.0 with C++ ABI 1011

Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=OFF
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_WXPYTHON=ON
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_SPICE=ON
Take a case of existing board with some fill zone on some copper layer. Reroute some track so that it will be in collision with existing copper zone. Do the DRC check with DRC settings: Refill All Zones Before Performing DRC disabled. DRC will not report collision.

Tags: drc pcbnew
tags: added: pcbnew
tags: added: drc
Changed in kicad:
milestone: none → 5.0.0-rc2
Revision history for this message
Jon Evans (craftyjon) wrote :

This is kind of just how the DRC works (for now), don't think it would be easy to fix for V5.
"Test zones" step of DRC doesn't actually check for collisions between tracks and zones, only checks for zone-to-zone collisions and that zones get valid netcodes.
So, the only way to get a DRC-passing board is to enable that checkbox to refill zones before running DRC.

Revision history for this message
Nick Østergaard (nickoe) wrote :

@Jon, as I understand the reporter, this option was already enabled.

I have attached a demo board where a track crosses the fill from another net. I would have expected the DRC to complain here when the refill checkbox is not checked.

Revision history for this message
jean-pierre charras (jp-charras) wrote :

I am thinking there is a misunderstood here:

Zones are expected to be refilled when running a DRC.

The refill checkbox is only here to avoid modifying a board when running DRC when you know filled zones are OK.

I am myself really not very thrilled by this confusing option (To be honest, I am thinking this option is the bug).

(For me: try to detect a collision between zone and a track has not really a meaning: just refill the zones fixes the issue).

Other EDA tools I known just refill zones after a change, and no not detect a track to zone collision, because this case do not exist (unless bug in refill zo,e algo, but this is an other topic).
However the price to pay is high: calculation time can very annoying when routing a complex board.

Revision history for this message
Nick Østergaard (nickoe) wrote :

@jp, but why does the DRC not detect the short in the board I attached?

Revision history for this message
jean-pierre charras (jp-charras) wrote :

DRC does not detect collision between tracks and zones because there is no code for that...

Instead of, DRC expects zones to be *refilled* before running collision detection between tracks and pads.,
Therefore, after refilling, there is no collision and no need to detect them.

Revision history for this message
Jeff Young (jeyjey) wrote :

I believe the primary issue regarding automatic refill before DRC is whether or not running DRC should modify your board.

(Personally, I think fixing this type of issue is more important than a board-const-DRC. I'm pretty sure Wayne feels the opposite.)

Revision history for this message
Nick Østergaard (nickoe) wrote :

If the DRC won't decect it, wouln't it be better to have the refilling enabled by default?

Revision history for this message
Jon Evans (craftyjon) wrote :

Like JP says, in many other EDA tools, zone fills are updated in real-time when anything changes that would affect them. So, moving items around, changing the clearance settings, etc.

IMHO, if you do something that invalidates the zone fill, that should invalidate your zone such that the board needs to be flagged as modified anyway. So maybe the actual bug is that re-filling zones should not flag the board as modified. The actual modifications are the things that would cause the re-fill to have a different result: moving items around, changing the zone or clearance settings, etc. Just the act of recalculating the fill doesn't mean the board is modified.

Revision history for this message
Wayne Stambaugh (stambaughw) wrote : Re: [Bug 1760097] Re: DRC does not report copper zone fill collision with track

On 3/31/2018 7:51 AM, Jeff Young wrote:
> I believe the primary issue regarding automatic refill before DRC is
> whether or not running DRC should modify your board.

This is an issue in production environments. There needs to be some
indication that the board layout has been changed or is going to be
changed. Boards that have zones that fill quickly, the zone file
progress dialog was not displayed or dismissed so quickly that you could
miss it so there was no indication that your board had been changed by
the DRC.

>
> (Personally, I think fixing this type of issue is more important than a
> board-const-DRC. I'm pretty sure Wayne feels the opposite.)
>

I do and it needs to be obvious that the drc is going to make changes to
your board when it is run. I'm fine with changing the default setting
to refill zone but I'm not fine with silently refilling the board
without the users knowledge. I the check box in the DRC dialog makes it
obvious that the board is going to refilled when the drc is run.

Revision history for this message
Tomasz Wlostowski (twlostow) wrote :

@Jon: I don't know any tool except Mentor that would update zones in the realtime (and still, it works reliably on a relatively simple boards).

@JP: Many tools on the contrary always check for zone-to-track collisions. Refilling the zones is not the way to ensure there are no clearance violations. If the user mistakenly changed something that results in a zone/track/via short circuit, (s)he should be made aware of it. Automatic refill on DRC hides this information from the user, which IMHO is bad. Besides, "Check" means a check, not a modification.

Tom

Revision history for this message
Seth Hillbrand (sethh) wrote :

What about a DRC warning if zones are not refilled after the board is modified? Let's the user know that there _might_ be a problem but doesn't force them to take action if they know it's not an issue.

Revision history for this message
Jeff Young (jeyjey) wrote :

@Seth, we're tracking the warning idea here: https://bugs.launchpad.net/kicad/+bug/1712579.

We'll have to change the file format for it, though, so that we store timestamps for last-mod and last-fill. So probably not a 5.0 option....

Revision history for this message
Jeff Young (jeyjey) wrote :

BTW, +1 to Tom's assertion that DRC should check for this regardless of whether we fill / don't fill the zone.

Brexit means Brexit. Err... I mean check means check. :)

Changed in kicad:
importance: Undecided → High
Revision history for this message
Jeff Young (jeyjey) wrote :

Changed importance to High until we figure out what (if anything) we're doing here.

Revision history for this message
Nick Østergaard (nickoe) wrote :

The main problem I see here is that DRC does not report copper zone fill collision with track. Which means that one can pass DRC and have a board which has nets shorted to the zone which are not intended to be. The reason being what JP mentions in #5. It seems dangerous. Hence I think refilling the zone by default is safer for the normal user.

IIRC DRC once upon a time did refill unconditionally before running the check because of this. So I think it would be ok to just make it default refill before the actual DRC. If the user then did uncheck the option to refill in the dialog, and expect the board to be protected from track to zone fill shorts, that would be considered a user error.

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

I agree. My concern is can this be done reliably without pushing back
the v5 release.

On 4/4/2018 7:26 AM, Jeff Young wrote:
> BTW, +1 to Tom's assertion that DRC should check for this regardless of
> whether we fill / don't fill the zone.
>
> Brexit means Brexit. Err... I mean check means check. :)
>
> ** Changed in: kicad
> Importance: Undecided => High
>

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

This seems like the best short term solution for v5. We can implement a
full check during v6 development.

On 4/4/2018 8:06 AM, Nick Østergaard wrote:
> The main problem I see here is that DRC does not report copper zone fill
> collision with track. Which means that one can pass DRC and have a board
> which has nets shorted to the zone which are not intended to be. The
> reason being what JP mentions in #5. It seems dangerous. Hence I think
> refilling the zone by default is safer for the normal user.
>
> IIRC DRC once upon a time did refill unconditionally before running the
> check because of this. So I think it would be ok to just make it default
> refill before the actual DRC. If the user then did uncheck the option to
> refill in the dialog, and expect the board to be protected from track to
> zone fill shorts, that would be considered a user error.
>

Revision history for this message
Jeff Young (jeyjey) wrote :

I just knocked up a version of ZONE_FILLER::Fill() which rebuilds all the poly lists (but doesn't set them into the zones), and then checks their MD5 hashes against the existing MD5 hashes.

We could get rid of the checkbox and call this routine; if the hash-compares fail then we could ask the user if they wanted to re-fill or not.

Worst case it would re-fill every zone twice. So I guess there's also the option of keeping the checkbox and only calling the new routine when it's unchecked.

(Of course the option of deciding this is too risky for 5.0 is also on the table.)

Revision history for this message
Jeff Young (jeyjey) wrote :

I've now got a slightly more elegant version which fetches the new poly lists, compares them with the old (via their MD5 hashes), asks the user if they're out-of-date, and then continues with the fill or cancels depending on the answer.

Revision history for this message
Jeff Young (jeyjey) wrote :

So this is my proposed 5.0 solution:

1) Keep the Fill Zones before DRC checkbox.
2) Keep its current default (unchecked).
3) When unchecked, re-calculate zone polygons and compare with existing polygons. If different, ask the user if they want to re-fill.

I've attached a patch which implements this for review.

I'm not intimately familiar with the zone fill code, so I'd appreciate other opinions on the amount of risk this involves.

Revision history for this message
Jeff Young (jeyjey) wrote :

@Devs, any thoughts on this?

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

@Jeff, your patch seems like a reasonable short term solution. I do
agree with Tom that the DRC should check zone to trace clearances. I
propose that we use your solution for v5 and implement the DRC checks
during v6 development. Once the new DRC check is stable, we can always
cherry-pick it for a v5 point release. We will have to discuss the v5
point release because as of right now, we don't really have anything in
place to handle point releases.

On 04/06/2018 03:42 PM, Jeff Young wrote:
> @Devs, any thoughts on this?
>

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

Jeff, I think your idea is reasonable. I have also tested your patch, but I always get the message saying that the zones are not up-to-date. No matter if I had refilled them before the DRC or during the DRC and restarted the test after.

Revision history for this message
Jeff Young (jeyjey) wrote :

@Orson, there seems to be a multi-stable state with the zone polygons. It does that for some zones and not others. That's why I changed the message to "may", but it's not entirely satisfactory.

Does anyone know why zone fills (or at least the polygon MD5 hashes) aren't always deterministic?

Revision history for this message
Jeff Young (jeyjey) wrote :

PS: I'm going to go ahead and merge so we can get some more air time on it. We can back it out later if necessary.

Revision history for this message
jean-pierre charras (jp-charras) wrote :

I also always get the message saying that the zones are not up-to-date even for only one zone.
(W7 32 bits)

Revision history for this message
Jeff Young (jeyjey) wrote :

@JP, does your single-zone case have a curved edge (ie: from an intersection with a curved board edge)? If not, could you post it?

Revision history for this message
jean-pierre charras (jp-charras) wrote :

This is a very basic zone, using only lines for board outlines.

Revision history for this message
Jeff Young (jeyjey) wrote :

Thanks, JP. Turns out there's no multi-stable state or indeterminism. I just had my check in the wrong place.

Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

Fixed in revision 05dae9627581777eabe10e0a1a318903cd8a01b5
https://git.launchpad.net/kicad/patch/?id=05dae9627581777eabe10e0a1a318903cd8a01b5

Changed in kicad:
status: New → Fix Committed
Changed in kicad:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.