how does delete the component by script?
in this example all the components that name in panel
will be Enable Disable by c# or python script
also how delete them?
Note that you should not do that inside your current foreach on GrasshopperDocument.ActiveObjects(). Instead collect the list of objects you want to delete, then outside the loop remove them.
Thanks @Mahdiyar
Just one more question about this post, maybe we can replace all the x components in the same position with the y component? For example, wherever the tool was called panel, replace it with valueList or numbers slder …?all panel replace by numberslider
Please actually read the error messages and try to understand them instead of trying to guess your way through typing code.
nickNameReplace - you came up with this name. It does not exist in the Grasshopper API on IGH_DocumentObject. You can’t come up with names and expect them to work. You want to check whether obj.NickName is equal to nickNameReplace.
Your code layout is horrible. Take time to write it properly: good indentation, good bracketing, etc.
For error 3 in your screenshot: read the documentation on AddObject and now try to understand why the error happens. Then think about how to fix it (hint: foreach)
It is possible to add components and to wire them up. Here some old code I wrote to salvage shaders setup. Here some links into that code:
Creating the GH component instances
Creating attributes for each instance (with a random location) and add the instance to the GH document
Finally wire up all components
Code is in F#, but it shows that it is possible. For this particular usage I had AutoGraph plug-in to do the layout after creating the initial reverse engineered version of the shader graph.
I am not entirely sure what you meant to ask, but it is possible to create a plug-in with which you can create parts of a definition automatically, or even complete ones. The code I showed is in F#, you probably want to grasp it enough to learn how to do it in C#.