Close Toolbars by code

Hello,

I used to close all toolbars at certain times in Rhino 7 like this:

for (int i = RhinoApp.ToolbarFiles.Count - 1; i >= 0; i--)
{
        RhinoApp.ToolbarFiles[i].Close(false);
}

But in Rhino 8 it seems that this code doesn’t work, is there any alternative to close open toolbars?

Thanks in advance
Will

1 Like

Hi,

I would like to bump this message. I have the same issue with the Standard Toolbars toolbar:

How to close this in c#?

Hi, this is listed as
RH-76105 Cannot close Rhino’s default toolbar collection

RH-76105 is fixed in Rhino 8 Service Release 1

1 Like

Thank you very much.

Regards
Will

Hi @brian ,

I’m trying to do it from RhinoCommon, but it doesn’t work. Is there any workaround?

var tbFiles = RhinoApp.ToolbarFiles;
for (int n = tbFiles.Count - 1; n >= 0; n--)
{
    tbFiles[n].Close(false);
}

I’m using SR1 Release Candidate 3.

image

Thanks,

Rafa

Hi @rafadelmolino,

The Rhino UI System is quite different than that of Rhino 7. It is not RUI file-based. Thus, there are not “toolbar” files to close.

I’m working on some updated developer information that I hope to be able to share on the next few days.

Thanks,

– Dale

Hey @dale, any update on this? It would be really handy for me :slight_smile:

Hey @csykes,

We’re working hard to add the additional Rhino UI classes, properties, and methods to RhinoCommon required by developers.

https://mcneel.myjetbrains.com/youtrack/issue/RH-78479

– Dale

4 Likes

Awesome, thanks Dale! :slight_smile:

@stevebaer @dale @Gijs @brian I see that this item get’s pushed each sprint, is there any way we could get some priority on this issue? Without the API to interact with the UI, any plugins producing a non-Rhino like UI are essentially broken requiring users to manually hide/close UI on a new install.

Perhaps you can make a smaller work item, that is just giving us the ability to close panels, rather than fix the whole disconnected UI API for Rhino 8. That would at least let us move forward without too much work on your part (hopefully).

Thanks guys!

Jason

according to John Morse this should be the way to do it:

This is what I believe you need to do for your skin:

  1. Start Rhino on your developer box
  2. Configure the UI the way you want it to appear
  3. Run the WindowLayout command or go to the “Windows/Window Layouts/Manage Window Layouts…” menu option
  4. Click on the + in the top left corner of the dialog and then click “Yes” to save the current layout
  5. Give the layout a name like “My Product Default”
  6. Right click on the new window layout
  7. Export the window layout to the folder containing your skin DLL and use the same name
  8. Close Rhino
  9. Delete your %APPDATA%\McNeel\Rhinoceros\8.0\settings directory (This will simulate starting for the first time)
  10. Restart your skinned Rhino

You should now see your custom layout applied as the default UI layout and if you display the “Windows/Windows Layouts” menu you should see your custom layout as the default layout. The built in Rhino layouts have been removed and replaced with yours. You can add additional RHW files to your DLL directory and they will appear as system layouts. Adding these RHW files to your installer and extracting them to the same directory as your skin DLL will provide this user experience for your users.

I hope this helps, otherwise let me know.

1 Like

I’ll give that another try. The last time I attempted a default layout, I didn’t have any luck. Do you know the minimum Rhino SR for this functionality to work in?

That comment was from 3 months ago, so any SR should be good. I have no means to test this myself right now.

1 Like

@Gijs @JohnM I’ve confirmed this is not working, this is the same behavior I observed when I first tried the layouts feature a few months back.

I followed the steps to create a layout, I’ve applied the layout to verify it works. Then I’ve exported the layout and included it in our build process, so that it ends up in the same folder as our plugin, named as specified.

If I clear the settings folder: %APPDATA%\McNeel\Rhinoceros\8.0\settings

And then build our plugin, you can see here the *.rhw file is present.

image

We start Rhino with our own custom scheme, and the layout is still the Rhino Default. It does not appear to find the related Window Layout. Is this related to our Scheme?

If I manually run the WindowLayout command, and then Import the rhw file, then restore the window layout it does apply the layout correctly.

I’m running Rhino 8 SR4 currently, but I’ve tested this all the way back to SR 0.

hi @jstevenson, thanks for testing this, I am sorry to hear it is not working. I made this a high priority bug to get fixed:
RH-80372 Can’t load a customized Window Layout correctly

1 Like

I just retested this, after re-reading your message, and trying a different name for the rhw file.

I had been naming the rhw file the same as our PLUGIN, but it seems it needs to be named the same as the SKIN dll file. I’ve confirmed this appears to work in that scenario.

Thank you!

Jason

1 Like

thanks @jstevenson for letting me know, I’ll update the YT

1 Like