Rhino 8 How to use input code in Grasshopper script component

I don’t know if it’s a bug or if I don’t know how to use the component but the component can’t read the “Input” input:


According to the error text, it is necessary to set the override language on the parameter

You can also set it to automatic and then add the following line at the beginning of your code:

//#! csharp
#! python


Thank you @Mahdiyar !
You know all the tricks of this new component!! :slight_smile:

Setting the language with either method effectively suppresses error messages. But unfortunately the component does not seem to be executed and it does not create any results:

I also experienced this last week - a C# component suddenly stopped working while I was coding in it. Just dead. The component didn’t respond even after closing and restarting Rhino.

There’s too much magic going on in the component during development, it lags and it become unstable. Less magic would be better I think.


1 Like

@kitjmv Currently you can NOT use a ScriptInstance implementation as an input code mostly due to the fact that ScriptInstance can implement BeforeSolve and AfterSolve methods but the script itself is only accessible when the main component is trying to solve.

You should be able to use a normal C# script like this as input:

// #! csharp
using System;

a = Math.Abs((double)x) + Math.Abs((double)y);

There was a bug in processing // #! csharp directive that I’m fixing for the next build. Thank you!

RH-78488 Script fails to determine language from lang id specifier line