lastely I`m trying to use python in Grasshopper, I found that Grasshopper.Kernel.Special is not documented in Grasshopper API
Where I can I find its info and all method that listed under this namespece instead? Is there any file like rhinocript document that save all related files in?
Sometimes concrete versions of the generic types need to be declared in the C# way, not the Pythonic way (IronPython can still handle both). But beware, when you step outside the documented API, your code might break in future Rhino versions.
And I notice that Grasshopper.Kernel.Special only have part of input components, Where could I find the rest of components provided by grasshopper? like point, circle, vector or sweep 1/2…?
I would like to use ghpython to generate those components on grasshopper canvas, but now I can only create components in Grasshopper.Kernel.Special, like number slider or knob…
I did find a useful tool to Find the class for any Grasshopper component, but something got wrong when I tried to paste it into C# component and ran. I`m not so familiar with C#, is there anyway to fix it?
I might not describe my mind so clear, what I want is to create the containers of geometry, like in the image, and then use python to assign geometry to these container components, but I didn`t find the class for creating these container components (or proxy components of geometry maybe, not so sure their official name).
Ah sorry Fmyl, I misunderstood, and forgot what the Grasshoppper canvas means…
It is possible to add Grasshopper components in Python code, but I’ve never found any documentation about it. There’re old posts on the forum about it, and on the old grasshopper forum, e.g. discussing automatically building plug-ins. With GhPython components themselves at least, once you have an instance of the right class, some data about it might need to be filled in, and then it can be added as a reference to the intended grasshopper document.
Thanks for explanation James.
I`ve tried to import c# assembly files to python but didn’t work easily, maybe just because my understanding of python is not deep enough.
Now I’m wondering if I should move to c# or stick digging with python, not so sure which is easier way.
Just got C# book on my hand, but it will take a while to learn, i’m so new to coding. In the meantime, I think it is always good to know more ways to achieve the same goal.
This series is in my view very good for learning c# in Grasshopper.
Rhino is .net and .net is microsoft.
Also c# is microsoft.
Python in gh is ironpython (.net for python) and not c python thats the reason why lots of c python librarys dont work with gh …hops can be used to run c python code and interact with gh.
Rhino developer offer a lot of options to interact with other platforms…but mixing c# librarys with python is sometimes very frustrating…because of explicit and non explicit and .net and c.
I started with Python and had no idea of classes and objects and data type declaration.
But you will realise that on your path …python is really great for short tests but c# is in most cases much faster because of the declaration…not every line of code needs to be computed again and again like in python.