Disable toolbars plugin on skin start

I need disable the Toolbars plugin on start rhino with custon skin, maybe close
on startup?

    protected override void OnBeginLoadPlugIn(string PluginName)
    {

        if (PluginName == "Toolbars") 
        {
            "disable toolbar"
     
        }

        
    }

Is possible?’

Have you tried this?

Pablo

Thank you,

Yes I try, and work, but:

This comand is on “OnInitialized” event on my plugin, so, every time rhino open
if my skin is running then the command run and the Toolbar is hide, but,
before hide the rhino it shows for a second.

And since, in my plugin I will only use custom tools, I will never use the “toolbars” plugin, could I completely disable just when my skin runs?

Thanks

You should try then in OnUnloadPlugIn() or the C# equivalent.
In my case I run it in an Idle watcher event after starting Rhino and I never see the toolbar appearing. I do see other controls being hidden but the toolbar is usually fine.

Pablo

In my case the “OnIdle” event dont work on startup, I don know why.

Thanks

By Idle I mean a Rhino Idle watcher, it runs all the time. Do you refer to this? Do you have some code showing the issue?

Pablo

I using the event handler based on “SampleCsEventHandler”.

Thanks

I think the problem is that, the comand is on my plugin, and maybe we take some time
to be load on startup, may be enough to let the toolbar show for a second.

I need this comand earlier, or disable the toolbars plugin when my skin runs.

Thanks

I think the solution is this command on Skin, but this is a scriptsyntax , and
I need RhinoComom.

rs.EnablePlugIn(“299f02bc35384343aca5d66aaaeb789b”, False)

I try on API but without lucky, any tip?

Thanks

I have no clue… @dale?

Pablo

I found a very tricky way by changing the plugin name temporarily during the skin start:

    protected override void OnMainFrameWindowCreated()
    {


        //change name
        string exePath = Application.StartupPath;
        string OriginalFile = (Directory.GetParent(exePath).FullName) + "\\Plug-ins\\Toolbars\\Toolbars.rhp";
        string FileToReplace = (Directory.GetParent(exePath).FullName) + "\\Plug-ins\\Toolbars\\Toolbars.rhpp";
        File.Move(OriginalFile,FileToReplace);

    }
    
    protected override void OnEndLoadAtStartPlugIns()
    {
        //replace Name
        string exePath = Application.StartupPath;
        string OriginalFile = (Directory.GetParent(exePath).FullName) + @"\Plug-ins\Toolbars\Toolbars.rhpp";
        string FileToReplace = (Directory.GetParent(exePath).FullName) + @"\Plug-ins\Toolbars\Toolbars.rhp";
        File.Move(OriginalFile, FileToReplace);

    }

This makes the plugin not exist when rhino starts, which in turn does not load, but i think it is just a very tricky solution, i think it is not a good practice?

best practices are welcome.

I’d like to discourage disabling or renaming the Toolbars plug-in as it does stuff other than toolbars. If you won’t want any toolbars to appear, just clear the collections.

– Dale

HI @dale

There is something that I have on mind that can happen…

How I can clear the collectios just for my skin? And I can do that on my skin or as to be on plugin?

How about using no collection?

https://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_UI_ToolbarFileCollection.htm

I don’t know if a skin can do this, certainly a plug-in can.

– Dale

Hello @dale

this was my first approach:

     Skin SkinName = Skin.ActiveSkin;
        if (SkinName.ToString() == "MySkin.MyHippoSkin")
        {
                foreach (var f in Rhino.RhinoApp.ToolbarFiles)
                     f.Close(false);

        }

This is on my plugin “RhinoApp.Initialized” event, because this command dont work on Skin.

But is show the toolbar for a seconde before hide, is not a good look interface for my skin, is there any place I can put it that runs a little before?

Hi @MatrixRatrix,

You will want to move this code into a Rhino plug-in that you distribute along with your skin.

– Dale