Add GetCurrentSelection() python scripting helper

This commit is contained in:
qu1ck 2022-12-28 17:45:02 -08:00 committed by Seth Hillbrand
parent 366c3e7142
commit f153ff8453
2 changed files with 24 additions and 0 deletions

View File

@ -418,6 +418,25 @@ int GetUserUnits()
}
std::deque<BOARD_ITEM*> GetCurrentSelection()
{
std::deque<BOARD_ITEM*> items;
if( s_PcbEditFrame )
{
SELECTION& selection = s_PcbEditFrame->GetCurrentSelection();
std::for_each( selection.begin(), selection.end(),
[&items]( EDA_ITEM* item )
{
items.push_back( static_cast<BOARD_ITEM*>( item ) );
} );
}
return items;
}
bool IsActionRunning()
{
return ACTION_PLUGINS::IsActionRunning();

View File

@ -167,6 +167,11 @@ void UpdateUserInterface();
*/
int GetUserUnits();
/**
* Get the list of selected objects.
*/
std::deque<BOARD_ITEM*> GetCurrentSelection();
/**
* Are we currently in an action plugin?
*/