add python api FocusOnItem

This commit is contained in:
SYSUeric66 2023-09-19 09:54:49 +08:00 committed by Seth Hillbrand
parent b5eee9dd7e
commit 9d4e0ba439
2 changed files with 18 additions and 1 deletions

View File

@ -84,7 +84,6 @@ void ScriptingOnDestructPcbEditFrame( PCB_EDIT_FRAME* aPcbEditFrame )
s_PcbEditFrame = nullptr;
}
BOARD* LoadBoard( wxString& aFileName )
{
if( aFileName.EndsWith( KiCadPcbFileExtension ) )
@ -457,6 +456,14 @@ std::deque<BOARD_ITEM*> GetCurrentSelection()
return items;
}
void FocusOnItem( BOARD_ITEM* aItem, PCB_LAYER_ID aLayer )
{
if( s_PcbEditFrame )
{
s_PcbEditFrame->FocusOnItem( aItem, aLayer );
}
}
bool IsActionRunning()
{

View File

@ -27,12 +27,14 @@
#include <deque>
#include <io_mgr.h>
#include <layer_ids.h>
class PCB_EDIT_FRAME;
class BOARD;
class SETTINGS_MANAGER;
class BOARD_ITEM;
enum class EDA_UNITS;
enum PCB_LAYER_ID;
/* we could be including all these methods as static in a class, but
* we want plain pcbnew.<method_name> access from python
@ -179,6 +181,14 @@ int GetUserUnits();
*/
std::deque<BOARD_ITEM*> GetCurrentSelection();
/**
* Focus the view on the target item.
*
* @param aItem is the target board item.
* @param aLayer is the layer ID of the target item.
*/
void FocusOnItem( BOARD_ITEM* aItem, PCB_LAYER_ID aLayer = UNDEFINED_LAYER );
/**
* Are we currently in an action plugin?
*/