Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

C# Component Add Menu Item

$
0
0

Hello,

I’ve been trying to add a simple bool to the menu on a Grasshopper C# component in Rhino 8. It appears that I need to add a Nuget package? How would I do that?

What do I need to add to get the code up and running?

The code, courtesy of James Ramsden:

        protected override void AppendAdditionalComponentMenuItems(System.Windows.Forms.ToolStripDropDown menu)
        {
            base.AppendAdditionalComponentMenuItems(menu);
            Menu_AppendItem(menu, "Flip myBool", Menu_DoClick);
        }

        private void Menu_DoClick(object sender, EventArgs e)
        {
            myBool = !myBool;
        }
        public bool myBool = false; 

Any help or advice would be very very welcome!

Ash

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles