MitjaNemec / SaveRestoreLayout

GNU General Public License v2.0
22 stars 5 forks source link

'BOARD_ITEM' object has no attribute 'SetNetCode' (Since upgrading to KiCad 7.0 #14

Closed GerhardMalan closed 8 months ago

GerhardMalan commented 1 year ago

Hi Mitja,

Thanks for writing this plug-in which I have used extensively in the past. It has saved me a lot of time! Since upgrading to KiCAD 7.0 a few weeks ago it has failed every time I attempted to use it.

I'm using it on a project that was upgraded to KiCAD 7 from 6.

Here is the log file:

05-13 04:48:52 com_github_MitjaNemec_SaveRestoreLayout.action_save_restore_layout 172:Plugin executed on: 'win32' 05-13 04:48:52 com_github_MitjaNemec_SaveRestoreLayout.action_save_restore_layout 173:Plugin executed with python version: '3.9.16 (main, Apr 9 2023, 05:22:13) [MSC v.1934 64 bit (AMD64)]' 05-13 04:48:52 com_github_MitjaNemec_SaveRestoreLayout.action_save_restore_layout 174:KiCad build version: 7.0.2 05-13 04:48:52 com_github_MitjaNemec_SaveRestoreLayout.action_save_restore_layout 175:Plugin version: 2.0.7

05-13 04:48:52 com_github_MitjaNemec_SaveRestoreLayout.action_save_restore_layout 176:Frame repr: <wx._core.Frame object at 0x0000025204DCF0D0> 05-13 04:48:52 com_github_MitjaNemec_SaveRestoreLayout.action_save_restore_layout 194:Anchor footprint reference is 'U502' 05-13 04:48:53 com_github_MitjaNemec_SaveRestoreLayout.action_save_restore_layout 274:Restore layout chosen 05-13 04:48:58 com_github_MitjaNemec_SaveRestoreLayout.action_save_restore_layout 75:Initialization start 05-13 04:48:58 com_github_MitjaNemec_SaveRestoreLayout.action_save_restore_layout 77:Initialization done Group name: 05-13 04:48:59 com_github_MitjaNemec_SaveRestoreLayout.save_restore_layout 675:Getting board info 05-13 04:48:59 com_github_MitjaNemec_SaveRestoreLayout.save_restore_layout 678:Get project schematics and layout data 05-13 04:48:59 com_github_MitjaNemec_SaveRestoreLayout.save_restore_layout 132:getting a list of all footprints on board 05-13 04:48:59 com_github_MitjaNemec_SaveRestoreLayout.save_restore_layout 684:Loading saved design 05-13 04:48:59 com_github_MitjaNemec_SaveRestoreLayout.save_restore_layout 706:Source level is:['ADC_1.kicad_sch'] 05-13 04:48:59 com_github_MitjaNemec_SaveRestoreLayout.save_restore_layout 711:Destination footprint is:'U502' 05-13 04:48:59 com_github_MitjaNemec_SaveRestoreLayout.save_restore_layout 712:Destination levels available are:['ADC_1.kicad_sch'] 05-13 04:48:59 com_github_MitjaNemec_SaveRestoreLayout.save_restore_layout 723:Destination level is:['ADC_1.kicad_sch'] 05-13 04:48:59 com_github_MitjaNemec_SaveRestoreLayout.save_restore_layout 728:All sch files required are: ['ADC_1.kicad_sch'] 05-13 04:48:59 com_github_MitjaNemec_SaveRestoreLayout.save_restore_layout 730:Getting current schematics hash 05-13 04:48:59 com_github_MitjaNemec_SaveRestoreLayout.save_restore_layout 741:Source hash is:'94b43d6c31e25cdc2e676eb90591fc96' 05-13 04:48:59 com_github_MitjaNemec_SaveRestoreLayout.save_restore_layout 742:Destination hash is: '94b43d6c31e25cdc2e676eb90591fc96' 05-13 04:48:59 com_github_MitjaNemec_SaveRestoreLayout.save_restore_layout 759:Get layout data from saved board 05-13 04:48:59 com_github_MitjaNemec_SaveRestoreLayout.save_restore_layout 132:getting a list of all footprints on board 05-13 04:48:59 com_github_MitjaNemec_SaveRestoreLayout.save_restore_layout 907:Replicating footprints 05-13 04:48:59 com_github_MitjaNemec_SaveRestoreLayout.save_restore_layout 1068:Replicating tracks 05-13 04:48:59 com_github_MitjaNemec_SaveRestoreLayout.action_save_restore_layout 323:Fatal error when restoring layout Traceback (most recent call last): File "[Path to my DOCUMENTS directory]\KiCad\7.0\3rdparty\plugins\com_github_MitjaNemec_SaveRestoreLayout\action_save_restore_layout.py", line 312, in Run restore_layout.restore_layout(layout_file) File "[Path to my DOCUMENTS directory]\KiCad\7.0\3rdparty\plugins\com_github_MitjaNemec_SaveRestoreLayout\save_restore_layout.py", line 792, in restore_layout self.replicate_tracks(src_anchor_fp, saved_board.GetTracks(), self.dst_anchor_fp, net_pairs, self.layout_group) File "[Path to my DOCUMENTS directory]\KiCad\7.0\3rdparty\plugins\com_github_MitjaNemec_SaveRestoreLayout\save_restore_layout.py", line 1100, in replicate_tracks new_track.SetNetCode(to_net_code, True) AttributeError: 'BOARD_ITEM' object has no attribute 'SetNetCode'

GerhardMalan commented 1 year ago

I should add that the plug-in does do the footprint layout before hitting the error, so that is already a big bonus!

MitjaNemec commented 1 year ago

First of all, thanks for reporting this.

As it turns out this is due to a bug in KiCad. It got introduce just before the 7.0.2 release with 8e579ec8 and got fixed just after the 7.0.2 was tagged in 7843e6a7.

Anyhow, the fix for this is in 2.0.8 release, which is available for installation from file and should be available in PCM in a couple of days.

GerhardMalan commented 9 months ago

Thanks so much!