Right now, to toggle a toolbar’s visibility, we need to know to which “collection” it belongs:
! _-Toolbar _Toolbar "CollectionName" _Toggle "ToolbarName" _Yes !
It would be really nice to be able to have the option to have the “current” toolbar collection as an option:
! _-Toolbar _Toolbar Collection=Current _Toggle "ToolbarName" _Yes !
or perhaps that it looks in all the available collections and opens the first one it finds with a matching name…
! _-Toolbar _Toolbar _Toggle "ToolbarName" _Yes !
The reason I want this is that if the main collection name changes, the macros based on the original name will fail.
Trying to simulate the second option with the following python/rhinoscriptsyntax currently errors out - there is a bug in toolbar.py (will put details in another post)
OK, figured out the error, need to assign True for the optional third argument in IsToolbar(). My bad.
import rhinoscriptsyntax as rs def ToggleToolbarVisibility(tb_name): for tb_coll in rs.ToolbarCollectionNames(): if rs.IsToolbar(tb_coll,tb_name,True): #<--Fixed by adding third argument if rs.IsToolbarVisible(tb_coll,tb_name): rs.HideToolbar(tb_coll,tb_name) else: rs.ShowToolbar(tb_coll,tb_name) break ToggleToolbarVisibility("ToolbarName")