How can I implement this in my code?

1 Like

2022-07-05_12-32-56

namespace GeometryPlane
{
    public class GeometryPlaneComponent : GH_Component
    {
        public GeometryPlaneComponent() : base("GeometryPlane", "GeoPln", "Description", "Category", "Subcategory")
        {
            Message = GetValue("Normal", true) ? "Normal" : "Flip";
        }
        protected override void RegisterInputParams(GH_InputParamManager pManager)
        {
            pManager.AddGeometryParameter("G", "G", "G", GH_ParamAccess.item);
        }
        protected override void RegisterOutputParams(GH_OutputParamManager pManager)
        {
            pManager.AddPlaneParameter("P", "P", "P", GH_ParamAccess.item);
        }
        protected override void SolveInstance(IGH_DataAccess da)
        {
        }
        protected override System.Drawing.Bitmap Icon => null;
        public override Guid ComponentGuid => new Guid("604C459E-1264-4ECB-8747-66AA25C31516");
        protected override void AppendAdditionalComponentMenuItems(ToolStripDropDown menu)
        {
            Menu_AppendItem(menu, "Normal", Menu_NormalClicked, true, GetValue("Normal", true));
            Menu_AppendItem(menu, "Flip", Menu_FlipClicked, true, !GetValue("Normal", true));
        }
        private void Menu_NormalClicked(object sender, EventArgs e)
        {
            SetValue("Normal", true);
            ExpireSolution(true);
        }
        private void Menu_FlipClicked(object sender, EventArgs e)
        {
            SetValue("Normal", false);
            ExpireSolution(true);
        }
        protected override void ValuesChanged() =>
            Message = GetValue("Normal", true) ? "Normal" : "Flip";
    }
}

GeometryPlane.zip (25.4 KB)

4 Likes

Mahdiyar , I really extremely thank;
Is this written in C#? So I want to ask again is there a similar way to do that in Python? Thank you again

This is working
Thank you Mahdiyar from the bottom of my heart

This is part of the code

But I still have a question. How does this automatic input function work?



I didn’t actually click on the Add button, but it added an input of its own