Insert at input parameter similar Sort, Merge

Hello to all
Is there an example (*.cs file or *.sln) in this field toinsert input parameter indefinitely in the plug-in component?(similar SortList Component)I did not find anythingb in grasshopper3d and mcneel forums
@Mahdiyar

VariableParameter

using Grasshopper.Kernel;
using Grasshopper.Kernel.Parameters;
using System;

namespace UselessPlugin
{
    public class UselessComponent : GH_Component, IGH_VariableParameterComponent
    {
        public UselessComponent() : base("Useless", "Useless", "Useless", "Useless", "Useless") {}
        protected override void RegisterInputParams(GH_InputParamManager pManager)
        {
            pManager.AddGenericParameter("A", "A", "A", GH_ParamAccess.item);
            pManager[0].MutableNickName = false;
            pManager[0].Optional = true;
        }
        protected override void RegisterOutputParams(GH_OutputParamManager pManager)
        {
            pManager.AddGenericParameter("A", "A", "A", GH_ParamAccess.item);
        }
        protected override void SolveInstance(IGH_DataAccess da){}
        protected override System.Drawing.Bitmap Icon => null;
        public override Guid ComponentGuid => new Guid("9F91A1A6-F2B4-41E4-AB58-E8DF74BCB438");
        public bool CanInsertParameter(GH_ParameterSide side, int index) => side != GH_ParameterSide.Output && index != 0;
        public bool CanRemoveParameter(GH_ParameterSide side, int index) => side != GH_ParameterSide.Output && index != 0;
        public IGH_Param CreateParameter(GH_ParameterSide side, int index)
        {
            var name = GH_ComponentParamServer.InventUniqueNickname("ABCDEFGHIJKLMNOPQRSTUVWXYZ", Params.Input);
            Params.RegisterOutputParam(new Param_GenericObject {Name = name, NickName = name, Description = name, Access = GH_ParamAccess.item}, index);
            return new Param_GenericObject {Name = name, NickName = name, Description = name, MutableNickName = false, Optional = true, Access = GH_ParamAccess.item };
        }
        public bool DestroyParameter(GH_ParameterSide side, int index)
        {
            Params.UnregisterOutputParameter(Params.Output[index]);
            return true;
        }
        public void VariableParameterMaintenance() {}
    }
}
1 Like

How do I need to write using Python? It keeps reminding me that my pManager does not have the AddGenericParameter method

Here they are:

GH_Component.GH_InputParamManager.AddGenericParameter

GH_Component.GH_OutputParamManager.AddGenericParameter

– Dale

image
I tried, but why can’t I call the methods inside GhPython?