Fill zone redraws in Python API ignores Net Class Clearance of other signals

Bug #1806506 reported by Dan Sheadel on 2018-12-04
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Critical
Seth Hillbrand

Bug Description

When using the Python API to redraw fill zones, the Net Class Rules for adjacent signals are ignored, and the fill zone is re-drawn using the Polygon Isolation. This results in filling areas that should not have been filled.

When using the UI's fill zone commands, the Net Class Rules are honored. This means that redrawing and plotting generate different output when using the API and the UI.

Notably, some DRC rules are still followed consistently in both, such as Pad Local Isolation (shown on 2 pads in this file).

The API code used for filling zones is:
    filler = ZONE_FILLER(board)
    zones = board.Zones()
    filler.Fill(zones)
(Note, this will only work in Kicad 5, due to changes in zone fill APIs between 4 and 5)

The attached zip contains
- .Kicad PCB file demonstrating the issue
- Gerber files generated by the UI and python script
- A modified plot_gerbers.py script which fills zones before plotting.
- Images to show the difference between the gerbers , with blue representing the over-filled regions of the board.

The differences can also be seen here: https://imgur.com/a/gtmk2Gu

This bug exists in both Kicad 4 and 5,and confirmed on the following Kicad 5 version:

Application: pcbnew
Version: 5.0.1-33cea8e~68~ubuntu18.04.1, release build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.58.0 OpenSSL/1.1.0g zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
Platform: Linux 4.15.0-36-generic x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24
    Boost: 1.65.1
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.58.0
    Compiler: GCC 7.3.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=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

Dan Sheadel (c-d5n-3) wrote :
Seth Hillbrand (sethh) wrote :

Looks like the kicad_pcb file is missing. Can you upload it?

Dan Sheadel (c-d5n-3) wrote :

Oops. Here's the Kicad_pcb file referenced in the original ticket.

Seth Hillbrand (sethh) wrote :

Also, in your script, you do not call the two required functions:

board.BuildListOfNets()
board.SynchronizeNetsAndNetClasses()

If you add these before your call to fill the zones, it should be OK. We'll add those to the python helper as they really need to be set automatically

Seth Hillbrand (sethh) on 2018-12-04
Changed in kicad:
status: New → In Progress
importance: Undecided → Critical
assignee: nobody → Seth Hillbrand (sethh)
milestone: none → 5.1.0
Dan Sheadel (c-d5n-3) wrote :

Thanks so much! This does indeed seem to resolve the issue. It would definitely be appreciated to include this in the default zone helpers in future releases.

KiCad Janitor (kicad-janitor) wrote :

Fixed in revision 2a574c4f6580b048abbf7741623b05e73c9ca475
https://git.launchpad.net/kicad/patch/?id=2a574c4f6580b048abbf7741623b05e73c9ca475

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

Other bug subscribers