Python: re-add "def Duplicate(self)" with the correct call to C++ Duplicate().

From master branch.
This commit is contained in:
jean-pierre charras 2023-04-15 16:20:42 +02:00
parent 4c129ec208
commit 7843e6a709
1 changed files with 11 additions and 1 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Miguel Angel Ajo <miguelangel@nbee.es>
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -184,6 +184,16 @@ static PCB_BITMAP* Cast_to_PCB_BITMAP( BOARD_ITEM* );
else:
raise TypeError("Unsupported drawing class: %s" % ct)
"""
Needed to cast BOARD_ITEM::Duplicate() to the suitable type
"""
def Duplicate(self):
ct = self.GetClass()
if ct=="BOARD":
return None
else:
return Cast_to_BOARD_ITEM( _pcbnew.BOARD_ITEM_Duplicate(self) ).Cast()
def SetPos(self,p):
self.SetPosition(p)
self.SetPos0(p)