kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #40871
Re: PATCH: fix crash in netlist updater
On further digging I believe reason for that is that we no longer use the
extended iterator that is in dlist.i
There is some logic there to auto cast objects to proper class by calling
Cast(). I tried this in scripting console and
it works:
c = d[0].Cast()
c
<pcbnew.DRAWSEGMENT; proxy of <Swig Object of type 'DRAWSEGMENT *' at
0x7fa121ffca80> >
c.GetShape()
0
It would be good to add same wrapper for deque. I can look into it a bit
later if nobody beats me to it.
On Sat, Jun 1, 2019 at 9:55 PM Andrew Lutsenko <anlutsenko@xxxxxxxxx> wrote:
> On a related note, python api to get drawings (and probably everything
> else that is now in deque) is broken.
> board.GetDrawings() returns
> <pcbnew.DRAWINGS; proxy of <Swig Object of type 'std::deque< BOARD_ITEM *
> > *' at 0x7fa121ffc930> >
> and it's items don't have some methods for some reason
>
> b = pcbnew.GetBoard()
> d = b.GetDrawings()
> d[0].GetClass()
> 'DRAWSEGMENT'
> d[0].GetShape()
> Traceback (most recent call last):
> File "<input>", line 1, in <module>
> File "/usr/local/lib/python3.6/dist-packages/pcbnew.py", line 8393, in
> <lambda>
> __getattr__ = lambda self, name: _swig_getattr(self, BOARD_ITEM, name)
> File "/usr/local/lib/python3.6/dist-packages/pcbnew.py", line 83, in
> _swig_getattr
> raise AttributeError("'%s' object has no attribute '%s'" %
> (class_type.__name__, name))
> AttributeError: 'BOARD_ITEM' object has no attribute 'GetShape'
>
>
>
> On Sat, Jun 1, 2019 at 9:49 PM Seth Hillbrand <seth@xxxxxxxxxxxxx> wrote:
>
>>
>> Thanks Andrew! Good catch.
>>
>> -Seth
>>
>> On 2019-06-01 21:40, Andrew Lutsenko wrote:
>> > Hi Seth,
>> >
>> > I tried to pull netlist into completely empty board today and got a
>> > crash that I tracked down to
>> > this commit
>> >
>> https://github.com/KiCad/kicad-source-mirror/commit/d1877d7c1b531dee2f4e35304a1d6b33a34c5fff
>> >
>> > Simple fix for this particular problem is in attached patch but I
>> > didn't go through all the changes in that commit. It seems in a few
>> > places there are unchecked Modules().front() calls. Maybe they should
>> > be changed to GetFirstModule().
>> >
>> > Regards,
>> > Andrew
>>
>
Follow ups
References