From 9b58f50c680abcdc1630b518c3861386fe3c51ee Mon Sep 17 00:00:00 2001 From: qu1ck Date: Sun, 16 Apr 2023 12:08:10 -0700 Subject: [PATCH] Add usable PCB_GROUP::GetItems() swig wrapper --- pcbnew/python/swig/pcb_group.i | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/pcbnew/python/swig/pcb_group.i b/pcbnew/python/swig/pcb_group.i index 3067a62045..66e62a633d 100644 --- a/pcbnew/python/swig/pcb_group.i +++ b/pcbnew/python/swig/pcb_group.i @@ -1,6 +1,27 @@ -%include pcb_group.h %{ #include %} +%include pcb_group.h + +%extend PCB_GROUP +{ + std::deque GetItemsDeque() + { + std::deque result; + + const std::unordered_set 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()] + %} +}