Search code examples
c#visual-studio-codegrasshopper

Grasshopper C# VisualStudio how to add or to display a "component-bottom" info


Thank you in advance for all tips that you will share with me about this topic.

I was wondering how to add a Grasshopper component bottom info like this one below:

example as ref for component-bottom info

I am asking about the code to add in C# by VisualStudio when your are attempting to develop your GHA file. In python is fairly easy to do this. But in C# VS?

Understand what code and know where I need to add it to my VisualStudio project while developing a GHA component.

Here is an example that works in Grasshopper but not in VisualStudio: https://discourse.mcneel.com/t/message-under-component-visual-studio-c/50050

Here is another example, but I can't understand how to write correctly it in VisualStudio: https://www.grasshopper3d.com/forum/topics/gh-component-message-property-implementation


Solution

  • You can simply use this.Message = "your message"; inside any of your component class's boiler-plate methods e.g. inside the constructor, RegisterInputParams, orSolveInstance.

    Example Placement

    ...
    namespace GH_Demo
    {
        public class GH_DemoComponent : GH_Component
        {
            public GH_DemoComponent()
              : base("GH_Demo", "demo",
                "Just showing message placement")
            {
                this.Message = "Pre-Run Message";
            }
           ...
    
           ...
            protected override void SolveInstance(IGH_DataAccess DA)
            {
                ...
                this.Message = "Post-Run Message";
            }
    ...