Scripting with C#?


i am trying to get into Rhino scripting and reviewing documentation / 1st steps / fooling around with it at the moment.

My situation is that i am somewhat fluent in C# (from Rhino-unrelated things) but have never used Python. So i would rather use C# instead of learing a new language.

I dont want however to use VisualStudio and constantly having to restart Rhino to load/unload assemblies when i make codechanges. Basically i would like something exactly like ‘EditPythonSctipt’ but just with C#. With good workflow for small scripting tasks, using it directly inside Rhino with a repl and debugger.

I have seen that Grasshopper has a C# script component. Does something similar exist for Rhino directly? Or would you recommend just going with Python instead?


I think it depends on how often there really is a need to restart Rhino when making code changes. I think I start Rhino between 20 and 100 times a day while editing c# code and I prefer that over scripting in Python.

Switching to a dynamically typed language from a statically typed one will take some getting used to. Having said that, Python is a nice and flexible language

You can get pretty far just using the C# editor inside Grasshopper as your main script editor. I know that feels like an extra step, but it’s less work than visualstudio. Just wrap the code inside your “RunScript” method in an if statement to trigger the script, and hook it up to a boolean toggle in Grasshopper. Attached is a bare bones example. KB)

andheum: thanks for the file. This looks like a good solution!