Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't do anything: NotImplementedError: Wrong number or type of arguments for overloaded function 'new_VECTOR2I'. #24

Open
readmodifywrite opened this issue May 31, 2023 · 5 comments

Comments

@readmodifywrite
Copy link

Pressing the OK button results in nothing. No messages, no vias, nothing.

If I open the Python console and then hit OK, I'll get some errors in another window:

Traceback (most recent call last):
File "/home/jeremy/.local/share/kicad/6.0/scripting/plugins/viastitching-master/viastitching_dialog.py", line 456, in onProcessAction
self.FillupArea()
File "/home/jeremy/.local/share/kicad/6.0/scripting/plugins/viastitching-master/viastitching_dialog.py", line 363, in FillupArea
p = pcbnew.VECTOR2I(xp, yp)
File "/usr/lib/python3/dist-packages/pcbnew.py", line 5286, in init
this = _pcbnew.new_VECTOR2I(*args)
NotImplementedError: Wrong number or type of arguments for overloaded function 'new_VECTOR2I'.
Possible C/C++ prototypes are:
VECTOR2< int >::VECTOR2()
VECTOR2< int >::VECTOR2(wxPoint const &)
VECTOR2< int >::VECTOR2(wxSize const &)
VECTOR2< int >::VECTOR2(int,int)
VECTOR2< int >::VECTOR2(VECTOR2< int > const &)

Traceback (most recent call last):
File "/home/jeremy/.local/share/kicad/6.0/scripting/plugins/viastitching-master/viastitching_dialog.py", line 456, in onProcessAction
self.FillupArea()
File "/home/jeremy/.local/share/kicad/6.0/scripting/plugins/viastitching-master/viastitching_dialog.py", line 363, in FillupArea
p = pcbnew.VECTOR2I(xp, yp)
File "/usr/lib/python3/dist-packages/pcbnew.py", line 5286, in init
this = _pcbnew.new_VECTOR2I(*args)
NotImplementedError: Wrong number or type of arguments for overloaded function 'new_VECTOR2I'.
Possible C/C++ prototypes are:
VECTOR2< int >::VECTOR2()
VECTOR2< int >::VECTOR2(wxPoint const &)
VECTOR2< int >::VECTOR2(wxSize const &)
VECTOR2< int >::VECTOR2(int,int)
VECTOR2< int >::VECTOR2(VECTOR2< int > const &)

Traceback (most recent call last):
File "/home/jeremy/.local/share/kicad/6.0/scripting/plugins/viastitching-master/viastitching_dialog.py", line 456, in onProcessAction
self.FillupArea()
File "/home/jeremy/.local/share/kicad/6.0/scripting/plugins/viastitching-master/viastitching_dialog.py", line 363, in FillupArea
p = pcbnew.VECTOR2I(xp, yp)
File "/usr/lib/python3/dist-packages/pcbnew.py", line 5286, in init
this = _pcbnew.new_VECTOR2I(*args)
NotImplementedError: Wrong number or type of arguments for overloaded function 'new_VECTOR2I'.
Possible C/C++ prototypes are:
VECTOR2< int >::VECTOR2()
VECTOR2< int >::VECTOR2(wxPoint const &)
VECTOR2< int >::VECTOR2(wxSize const &)
VECTOR2< int >::VECTOR2(int,int)
VECTOR2< int >::VECTOR2(VECTOR2< int > const &)

@weirdgyn
Copy link
Owner

weirdgyn commented Jun 1, 2023 via email

@splitice
Copy link

splitice commented Jul 2, 2023

Ive got a similar issue:

Traceback (most recent call last):
  File "C:\Users/splitice/Documents/KiCad/6.0/scripting\plugins\viastitching\viastitching_dialog.py", line 456, in onProcessAction
    self.FillupArea()
  File "C:\Users/splitice/Documents/KiCad/6.0/scripting\plugins\viastitching\viastitching_dialog.py", line 368, in FillupArea
    if self.area.HitTestFilledArea(layer, p, 0):
  File "C:\Program Files\KiCad\6.0\bin\Lib\site-packages\pcbnew.py", line 12507, in HitTestFilledArea
    return _pcbnew.ZONE_HitTestFilledArea(self, aLayer, aRefPos, aAccuracy)
TypeError: Wrong number or type of arguments for overloaded function 'ZONE_HitTestFilledArea'.
  Possible C/C++ prototypes are:
    ZONE::HitTestFilledArea(PCB_LAYER_ID,wxPoint const &,int) const
    ZONE::HitTestFilledArea(PCB_LAYER_ID,wxPoint const &) const

@mpieper
Copy link

mpieper commented Jul 22, 2023

Okay several things.

  1. It appears KiCad 6.0 does not have a vector2I input to HitTestFilledArea (I could only find the documentation online, which I assume is for 7.0, and the docs say it should work, but the code's error warnings speak for themselves). Forcing it to a wxPoint gets past that (are there ways to check for what instance of Kicad you're running? e.g. version<7.0 -> use wxPoint) (if hasattr(pcbnew, 'VECTOR2I'): -> ~dialog.py:368)
  2. Your code checks for intersections with ZONES and FP_ZONES, whereas for my use case that's exactly what I want to use it for (e.g. filling a copper zone). Commenting that out fixed it, but I don't know why you were checking for intersections there in the first place. (def CheckOverlap(self, via): ->~dialog.py:300).
  3. There's a bug (?) in randomize, where your divisions might not be integers (which are required for wxPoint instantiation). Casting after the calc fixes that. (if self.randomize: -> ~dialog.py:360)
  4. Nice work and thank you for writing this in the first place.

Note: The line numbers are off by... I don't know. Some non-zero amount. I had to add a bunch of wx.MessageBoxes to see what was going on (How do they not have a debugger running this stuff? And here I was thinking embedded dev environments were hostile...)

@matthuszagh
Copy link

matthuszagh commented Jul 30, 2023

Seeing the same issue on kicad 7.0.2 when I use "randomize". If I deselect randomize, the error goes away but no vias are placed.

@ehammer33
Copy link

ehammer33 commented Sep 25, 2023

Just reiterating what @mpieper figured out:

replace 259 with: the_distance = norm(pcbnew.VECTOR2I(p2) - pcbnew.VECTOR2I(p1))
replace 356 with: xp = x + random.uniform(-1, 1) * int(step_x / 5)
replace 357 with: yp = y + random.uniform(-1, 1) * int(step_y / 5)

comment-out lines 317-319.

comment-out lines 362-364.
Then just have:
if(hasattr(pcbnew, 'wxPoint')):
p = pcbnew.wxPoint(xp, yp)

replace line 368 with: if self.area.HitTestFilledArea(layer, pcbnew.VECTOR2I(p), 0):
replace line 370 with: via.SetPosition(pcbnew.VECTOR2I(p))
viastitching_dialog.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants