C# script for Rhino

Hi there,

I am just wondering that Grasshopper has a good extension for C# scripts and Rhino has only for Rhino script and Python. C# script would be great to use inside Rhino to avoid restarting the software all the time. It might have some technical barrier.

Also, another question that by using C# for Rhino plugins it has a good ability to design user interface and event handling. I am just wondering if these classes are still available in Grasshopper?

Can anyone competent person answer it? I am just curious.

1 Like

Hello,

I don‘t know if I‘m competent enough to answer these questions…
In my oppinion C# isn‘t a good scripting language. However its a good language to write plugins, because its somewhere in between a high performance language but still an easy-to-develop-with language. So there is not a technical barrier, but more a conceptional one.

Usually C# is compiled not interpreted, its compilation process is much more simplyfied in comparision to C/C++, it has a good compiler which does a lot of optimisation for you, it has reflection, hugh abstraction (interfaces, generics etc), memory management and its still under huge development and it has wide spread user base.

A perfect scripting language is Python, and to be honest with you would prefer it over C# for that purpose. In Grasshopper I just prefer C# because I‘m really confident in the language and in Rhinocommon, which is a C# library. Its more are problem that there is no Python version of it, but instead a limited wrapper around it (rhinoscriptsyntax). It would have been a better solution to create a python clone of Rhinocommon. Then they could have choosen CPython not that IronPython crap. But there are probably other good reasons for this decision.

Anyways to come back to your second question: You can do almost anything in scripting languages. However eventhandling is a problem due to the way how scripting works, which makes it impossible to truly develop guis.
However, Python and Qt is very good solution of scripting Guis, so its nothing impossible.

In my oppinion the best you can do is learning Python or C and become good at it.Why C? Because once you truly understand C you can learn any language as fast changing your pants in the morning. Python is very easy to learn. Just give it a chance. I do „speak“ both. So instead of waiting for a potential C# script editor in Rhino, its probaly more practical to learn Python. Its not a big deal. Took me two weeks to switch from C# in a way that I was able to write productive code, the rest is googling on how things are done, which is no problem in times of Stack Overflow and YouTube.

2 Likes

Thanks, it was very useful.