pcbnew: function GetConnectedItemsAtAnchor not callable
Description
The function GetConnectedItemsAtAnchor is not to be used from python without errors. It throws an error message when called.
def GetConnectedItemsAtAnchor(self, aItem: "BOARD_CONNECTED_ITEM", aAnchor: "VECTOR2I", aTypes: "KICAD_T const []", aMaxError: "int const &"=0) -> "std::vector< BOARD_CONNECTED_ITEM *,std::allocator< BOARD_CONNECTED_ITEM * > > const":
import pcbnew
class ActionKiCadPlugin(pcbnew.ActionPlugin):
def defaults(self):
self.name = "name"
self.category = "category"
self.description = "description"
self.show_toolbar_button = True
def Run(self):
board = pcbnew.GetBoard()
connect = board.GetConnectivity()
point = pcbnew.VECTOR2I(1, 2) # generate test wire
t = pcbnew.PCB_TRACK(board)
t.SetStart(point)
t.SetEnd(point)
t.SetWidth(1000000*10)
t.SetNetCode(0)
t.SetLayer(0)
board.Add(t)
pcbnew.Refresh()
aTypes = [pcbnew.PCB_TRACE_T, pcbnew.PCB_ARC_T]
x = connect.GetConnectedItemsAtAnchor(
aItem=t, aAnchor=t.GetStart(), aTypes=aTypes, aMaxError=t.GetWidth()) # error in this line
print(x)
Error Message:
Traceback (most recent call last):
File "/home/user/.var/app/org.kicad.KiCad/data/kicad/7.0/3rdparty/plugins/Example-KiCad-Plugin-main/Plugin_action.py", line 26, in Run
x = connect.GetConnectedItemsAtAnchor(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/lib/python3.11/site-packages/pcbnew.py", line 10503, in GetConnectedItemsAtAnchor
return _pcbnew.CONNECTIVITY_DATA_GetConnectedItemsAtAnchor(self, aItem, aAnchor, aTypes, aMaxError)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: in method 'CONNECTIVITY_DATA_GetConnectedItemsAtAnchor', argument 4 of type 'std::initializer_list< KICAD_T > const &'
Additional information:
Wrong number or type of arguments for overloaded function 'CONNECTIVITY_DATA_GetConnectedItemsAtAnchor'.
Possible C/C++ prototypes are:
CONNECTIVITY_DATA::GetConnectedItemsAtAnchor(BOARD_CONNECTED_ITEM const *,VECTOR2I const &,std::initializer_list< KICAD_T > const &,int const &) const
CONNECTIVITY_DATA::GetConnectedItemsAtAnchor(BOARD_CONNECTED_ITEM const *,VECTOR2I const &,std::initializer_list< KICAD_T > const &) const
Steps to reproduce
- Run the code of the small plugin example
KiCad Version
Application: KiCad PCB Editor x86_64 on x86_64 Version: 7.0.7, release build Libraries: wxWidgets 3.2.2 FreeType 2.13.2 HarfBuzz 8.1.1 FontConfig 2.14.2 libcurl/8.2.1-DEV OpenSSL/3.1.2 zlib/1.3 nghttp2/1.55.1 Platform: Linux 5.15.0-83-generic x86_64, 64 bit, Little endian, wxGTK, cinnamon, x11 Build Info: Date: Sep 9 2023 13:30:43 wxWidgets: 3.2.2 (wchar_t,wx containers) GTK+ 3.24 Boost: 1.83.0 OCC: 7.7.2 Curl: 8.2.1-DEV ngspice: 41 Compiler: GCC 13.2.0 with C++ ABI 1018 Build settings: KICAD_SPICE=ON
Edited by KiCad Bot