From 7843e6a70904e9960114a0dc6cfff816b27c116f Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 15 Apr 2023 16:20:42 +0200 Subject: [PATCH] Python: re-add "def Duplicate(self)" with the correct call to C++ Duplicate(). From master branch. --- pcbnew/python/swig/board_item.i | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pcbnew/python/swig/board_item.i b/pcbnew/python/swig/board_item.i index a588df422f..30a30889b5 100644 --- a/pcbnew/python/swig/board_item.i +++ b/pcbnew/python/swig/board_item.i @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2012 Miguel Angel Ajo - * 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)