Possible to have a rhino button minimize the grasshopper window?

Hi all,

I am currently developing a Human UI script that launches from a custom toolbar button in Rhino. Human UI seems like a great tool to simplify things for those who do not use Grasshopper in my office.

My goal is to have only the Human UI interface appear, but not the grasshopper screen, when the custom toolbar button is pressed. Is it possible to have grasshopper launch, then minimize from a rhino button?

Thanks for the help all!

This: Grasshopper Window Minimize/Maximize Behavior -- request improvements seems almost like the same request.
Give it a look.

This is a similar sounding request but not really the same.

There are a couple ways to achieve what the OP is asking. One is to have a component inside the script that minimizes the GH window when executed (and because it is only executed once, will only perform this action at launch). This is achieved with this code (can be adapted for a C# component):

protected override void SolveInstance(IGH_DataAccess DA)
        if (!componentAuth) return;

        bool active = false;
        bool minimize = true;

        DA.GetData(0, ref minimize);
        DA.GetData(1, ref active);

        if (active)
            if (minimize)
                Grasshopper.Instances.DocumentEditor.WindowState = FormWindowState.Minimized;
            } else
                Grasshopper.Instances.DocumentEditor.WindowState = FormWindowState.Normal;

Another is to use your button to launch Grasshopper with custom options as in the documentation:


Finally, you could go nuclear and use a solution like the one shown by Riccardo in the referenced post. :slight_smile:


1 Like

What i did in the other thread was a complete mess!
This .Instances.DocumentEditor.WindowState … nice to know it! Thanks!
I’ve updated the other thread.

1 Like