diff --git a/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp b/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp index 8224cf8ced..3bd59f8b31 100644 --- a/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp +++ b/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp @@ -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 GetCurrentSelection() return items; } +void FocusOnItem( BOARD_ITEM* aItem, PCB_LAYER_ID aLayer ) +{ + if( s_PcbEditFrame ) + { + s_PcbEditFrame->FocusOnItem( aItem, aLayer ); + } +} + bool IsActionRunning() { diff --git a/pcbnew/python/scripting/pcbnew_scripting_helpers.h b/pcbnew/python/scripting/pcbnew_scripting_helpers.h index 68ea5a0aea..e993140dc5 100644 --- a/pcbnew/python/scripting/pcbnew_scripting_helpers.h +++ b/pcbnew/python/scripting/pcbnew_scripting_helpers.h @@ -27,12 +27,14 @@ #include #include +#include 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. access from python @@ -179,6 +181,14 @@ int GetUserUnits(); */ std::deque 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? */