Add usable PCB_GROUP::GetItems() swig wrapper

(cherry picked from commit 9b58f50c68)
This commit is contained in:
qu1ck 2023-04-16 12:08:10 -07:00 committed by Jon Evans
parent 640f279abe
commit d1d0d61b4f
1 changed files with 22 additions and 1 deletions

View File

@ -1,6 +1,27 @@
%include pcb_group.h
%{
#include <pcb_group.h>
%}
%include pcb_group.h
%extend PCB_GROUP
{
std::deque<BOARD_ITEM*> GetItemsDeque()
{
std::deque<BOARD_ITEM*> result;
const std::unordered_set<BOARD_ITEM*> items = $self->GetItems();
for(BOARD_ITEM* item: items)
result.push_back(item);
return result;
}
%pythoncode
%{
def GetItems(self):
return [item.Cast() for item in self.GetItemsDeque()]
%}
}