Rhino 8 C# Script component multiple problems

Hello,

I’m not sure where to start with this one. Bought a Rhino 8 licence on day one, super excited to try out the new features. On opening a Rhino 7 .gh file with c# components killed Rhino 8, not even a crash screen. The only work around I have is to pause the solver when opening the files and then once they are open, then run the solver. Pretty tedious.

Contacted support and the only thing they could suggest was turning off the V-Ray plug-in. Not helpful.

The new Script editor is better than the old one. However, since I used to use Script Parasite and directly edit scripts in Visual Studio, it’s a real step backwards. (as Script Parasite no longer works, which is annoying).

Tried writing some code in the editor:

  private void RunScript(IEnumerable<double> x, out object a)
  {
    // Write your logic here

    double[] vals = new double[x.Count];
    for (int i = 0; i< x.Count; i++){
            vals[i] = x * x;
    }
    a = vals;
  }

That didn’t work.

I’m not a professional coder, just a designer that uses code.

Then I tried to look for some documentation around the new Script Editor. Nothing.

Looked on the forums, lots of discussion around Python, not much around C#.

Starting to regret the upgrade.

Ash

ya never day 1 upgrade if you are extensively relying on user made plugins.
They are humans and need free time to do free work :slight_smile:

As for the code, it looks like you’re trying to multiply a list with a list.
Maybe you wanna do this?

vals[i] = x[i] * x[i];

Plus is the input type set to float in grasshopper?

Thanks @antoinemaes

I do appreciate you getting back to me so quickly, and with a smiley face!

The main human with the code is myself. A lot of it. And it worked very well in Rhino 7, but now doesn’t. That’s the real issue here.

Plus, now trying to go about fixing it is unnecessarily painful.

As for my silly example, unfortuntately, the compiler never got to the insides of the for loop because:

‘IEnumerable’ does not contain a definition for ‘Count’

Seriously, I’m not using C# to square some numbers. It was merely a few lines that I threw in to experiment on my first try. I posted it here to show my disappointment and frustration.

However, you are right, I missed [i].

I have a GH file that crashes Rhino 8 too (with v7 C# components in it). The windows just close, no option to send a crash report. Works fine Rhino 7. I hope they fix it soon.

1 Like