What happened to Manage Assemblies

HEY! The C# script component of Grasshopper does not have Manage Assemblies anymore in Rhino8. Wha Happened?? I used that a lot with my class libs in Grasshopper in Rhino7. Is there a different way? Will it come back? I hope.

Hi Joe -

@eirannejad would probably be able to tell you.

In Rhino 8, you can still use the legacy Rhino 7 Grasshopper components by double-clicking on the canvas and typing #
image

-wim

When you open the script editor in Rhino, you see this:

// NOTE:
// - Reference to RhinoCommmod.dll is added by default
// - Use // r "<assembly name>" to reference other assemblies
//       e.g. // r "System.Text.Json"
//       e.g. // r "path/to/your/Library.dll"
// - Use // r nuget "<package name>==<package version>" to install and reference nuget packages.
//   >= and > are also accepted instead of ==
//       e.g. // r nuget "RestSharp==106.12.0"
//       e.g. // r nuget "RestSharp>=106.10.1"
// - Use #r "nuget: <package name>, <package version>" to install and reference nuget packages.
//       e.g. #r "nuget: RestSharp, 106.11.7"

using System;
using Rhino;

Console.WriteLine("Testing CS");

Below is an excerpt from a Kangaroo custom goal by @DanielPiker

// r "C:\\Program Files\\Rhino 8\\Plug-ins\\Grasshopper\\Components\\KangarooSolver.dll"

// Grasshopper Script Instance
using System;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;

using Rhino;
using Rhino.Geometry;

using Grasshopper;
using Grasshopper.Kernel;
using Grasshopper.Kernel.Data;
using Grasshopper.Kernel.Types;
using System.Linq;
using KangarooSolver;

direction_no_reverse_goal.gh (27.4 KB)

2 Likes

I donā€™t see that in the C# script editor in GH. I see


It gives me no clue.
What youā€™ve shown doesnā€™t seem to work for me in the C# editor in Grasshopper in Rhino8. I have a simple class library My4barClass.dll that Iā€™d like to use and Iā€™ve placed it in the same folder as the GH file. What should I type in the using directive? Iā€™m missing something.

1 Like

I had to ask tooā€¦

2 Likes

Note to @eirannejad

  • Document this and make it more discoverable

What is needed is better explanation. Even thought Iā€™ve written some fairly complicated code, Iā€™m not a computer nerd. So what needs to be said is something likeā€¦

To add an assembly start a line which looks like a comment but has the letter r after it like
// r
Then after the ā€œrā€ add the directory in which your assembly appears. The directory name should be enclosed with quotes and any backslashes escaped with another backslash. Although this appears to be a comment, it actually directs the C# script component to recognize or maybe load that assembly.

I finally got mine to work after some time. Now having trouble getting the debugger to work. Will start another topic on that.

Slowly completing documentation on the new scripting tools. These two pages are in good shape and discuss packaging and assembly referencing in C# components:

https://developer.rhino3d.com/guides/scripting/scripting-gh-python/
https://developer.rhino3d.com/guides/scripting/scripting-gh-csharp/

4 Likes

Thank you, thank you. Weā€™ve needed this for a long time.

1 Like

Hi, sorry to barge in, but maybe itā€™s still related to the post topic (otherwise feel free to organize it however you see fit).

Glad there is the possibility to use NuGet packages, but I have some issues with the current .dll management:

. in Rhino 7 there was the possibility to browse and look for the .dll library to reference; name typing (with or without a relative/absolute path) should be an option, not a replacement. Any chance to bring back browsing as well (maybe with dragā€™nā€™drop functionality)?

. after referencing the external library, autocomplete still does not expose the library members (while in Rhino 7 that worked)

I am attaching a simple library I made that contains a single static Noise class, with 2 methods: Generate (with 3 overrides) and CulrNoiseVector.
Rhino 7:


Rhino 8:

Noises.zip (3.6 KB)

Yeah thatā€™s a good idea. I made a ticket for that:

RH-81910 Install Package dialog to allow selecting dll from an open dialog

I do have tickets to improve the autocompletion

1 Like