3 "toolbar" methods obsolete

These rhinoscript methods are all in the V6 autocomplete library, however they throw out an error message when run:

The “IsToolBarVisible” method is obsolete.Command
The “IsToolbarDocked” method is obsolete.Command
The “ShowToolBar” method is obsolete.Command

regards,

Yep, they are obsolete. They were left in RhinoScript so you could find and fix.

– Dale

Maybe that explains not being able to get the toolbars list as well?
Seems like these methods were created before the major V5 toolbars overhaul and never caught up with current toolbars implementation?
I just posted about trying to get all available toolbars list in a separate thread.

–jarek

Yep. And there really is an good way to “catch up”, as the organization of toolbars, groups, etc., is quite different than in older Rhino’s. Your best option is to use RhinoCommon and Python. The ToolbarCollection class has all the information. You can get the one and only version of this using RhinoApp.ToolbarFiles.

– Dale

Thanks @dale , I will try with RhinoCommon then.

Hi @dale, would you have any sample of how to get a list the toolbar names via RhinoCommon?
I can get the collection but not sure how to get it into an array of strings of toolbar names.

thank you,

–jarek

How about this?

import Rhino

for rui in Rhino.RhinoApp.ToolbarFiles:
    print rui.Path
    for i in range(0, rui.ToolbarCount - 1):
        tb = rui.GetToolbar(i)
        print rui.Name + '.' + tb.Name

– Dale

2 Likes

Thanks @Dale. Any ideas why some of the toolbars would not be listed? It lists the path correctly but does not list the toolbar names… Are there different versions or rui file, or some special way to deal with the legacy toolbars in case that is the issue?

–jarek

Are these toolbars or toolbar groups? You can enumerate those too.

– Dale

The missing items are both Group and Toolbars.
I tried:

    import Rhino
    for rui in Rhino.RhinoApp.ToolbarFiles:
        print rui.Path
           
        for i in range(0, rui.GroupCount - 1):
            gr = rui.GetGroup(i)
            print gr.Name

but still don’t get many of them listed; I need a list that has them all, like the Middle Mouse button popup list nicely showing all of them to pick from.

I’d need to make this work if we can figure out why this doesnt work either :slight_smile: :slight_smile:

–jarek

Can you upload your toolbar for us to evaluate?

@JohnM - can you look into this?

hi @dale,

Here are 4 toolbars - from these, only Paneling Tools lists the toolbar names correctly with your script.
The other 3 just list the path, but no names. Some more toolbars here like default one work OK, btw, I am sending a sample problematic 3 + a working one…
JB_toolbars.zip (229.5 KB)

thank you for looking into this.

–jarek

Hi @dale - any luck with seeing what these toolbars don’t get listed?
I tried more but can’t figure it out.

This was a bug in the script sample, the range should be range(0, rui.ToolbarCount) instead of range(0, rui.ToolbarCount - 1). I used the following script to test:

import Rhino

print "Toolbars"
print "================================================================================"
for rui in Rhino.RhinoApp.ToolbarFiles:
    print rui.Path
    for i in range(0, rui.ToolbarCount):
        tb = rui.GetToolbar(i)
        print i, "->", rui.Name + '.' + tb.Name

print "Toolbar groups"
print "================================================================================"
for rui in Rhino.RhinoApp.ToolbarFiles:
        print rui.Path
           
        for i in range(0, rui.GroupCount):
            gr = rui.GetGroup(i)
            print i, "->", gr.Name

The above scripts reports the following with the four RUI files you provided:

Toolbars
================================================================================
\\Mac\Home\Desktop\RUI\KeyShot7RhinoPlugin.rui
0 -> KeyShot7RhinoPlugin.KeyShot 7
\\Mac\Home\Desktop\RUI\Sparrow.rui
0 -> Sparrow.Sparrow
\\Mac\Home\Desktop\RUI\V5_ObjectDisplayModes_tb.rui
0 -> V5_ObjectDisplayModes_tb.ObjectDisplayModes
\\Mac\Home\Desktop\RUI\PanelingTools.rui
0 -> PanelingTools.Create Grid
1 -> PanelingTools.General Utility
2 -> PanelingTools.Grid Utility
3 -> PanelingTools.Manage Patterns
4 -> PanelingTools.Panel
5 -> PanelingTools.Panel from Grid
6 -> PanelingTools.PanelingTools
7 -> PanelingTools.Panels Utility
8 -> PanelingTools.Scripting Samples
Toolbar groups
================================================================================
\\Mac\Home\Desktop\RUI\KeyShot7RhinoPlugin.rui
0 -> KeyShot 7
\\Mac\Home\Desktop\RUI\Sparrow.rui
0 -> Sparrow
\\Mac\Home\Desktop\RUI\V5_ObjectDisplayModes_tb.rui
0 -> ObjectDisplayModes
\\Mac\Home\Desktop\RUI\PanelingTools.rui
0 -> Create Grid
1 -> General Utility
2 -> Grid Utility
3 -> Manage Patterns
4 -> Panel
5 -> Panel from Grid
6 -> Panels Utility
7 -> Scripting Samples

@JohnM - this works as expected! It was just the “-1” in the code that caused the confusion.
I appreciate your help with getting to the bottom of it!

–jarek

A post was merged into an existing topic: Make toolbar visible