Adding BOARD_ITEMS from python do not appear in view
Description
When using the python.pcbnew interface, adding (or removing) BOARD_ITEMS from the PCB do not appear in the view after a Refresh()
call.
But these new BOARD_ITEMS do appear in the view after a Save/Close/Re-opened.
I'm not sure if this is a bug in KiCad. Or rather in the order of operation in the python script.
Steps to reproduce
from pcbnew import *
pcb = GetBoard()
t = TRACK(pcb)
pcb.Add(t)
t.SetWidth(FromMM(0.25))
t.SetStart(wxPoint(FromMM(15), FromMM(15)))
t.SetEnd(wxPoint(FromMM(20), FromMM(20)))
t.SetFlags(IS_NEW)
Refresh()
- Open Python Scripting Console
- Copy Example above, and 'Paste And Run' the example with
CTRL+SHIFT+V
- Observe no track drawn
- Modify the board, to toggle the save option, Save board
- Re-open and observe track from (15,15) to (20,20)
KiCad Version
Application: Pcbnew
Version: 5.99.0-unknown-fc7f1d1d86~106~ubuntu20.10.1, release build
Libraries:
wxWidgets 3.0.5
libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.9 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.3.0) libssh/0.9.3/openssl/zlib nghttp2/1.41.0 librtmp/2.3
Platform: Linux 5.8.0-33-generic x86_64, 64 bit, Little endian, wxGTK, ubuntu, x11
Build Info:
Date: Jan 11 2021 10:18:01
wxWidgets: 3.0.5 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.24
Boost: 1.71.0
OCC: 7.4.0
Curl: 7.68.0
ngspice: 32
Compiler: GCC 10.2.0 with C++ ABI 1014
Build settings:
KICAD_SCRIPTING=ON
KICAD_SCRIPTING_MODULES=ON
KICAD_SCRIPTING_PYTHON3=ON
KICAD_SCRIPTING_WXPYTHON=ON
KICAD_SCRIPTING_WXPYTHON_PHOENIX=ON
KICAD_SCRIPTING_ACTION_MENU=ON
KICAD_USE_OCC=ON
KICAD_SPICE=ON