Creating Rhino/GH Plugins in Script Editor

I finally got the initial round of documentation done for the Script Editor “Projects” that had previously made a video about here:

Checkout these docs pages and let me know if you see any bugs or want more features. Test the most recent Rhino 8.11 SRC please:

I am continuing finishing up the rest of the doc pages for the new Script Editor

9 Likes

This is just what we were looking for! Looks great and excited to dive into it more.

One question for now: is there a way to edit and customize the toolbar? For instance, adding separators or rearranging icons.

Thanks for such great work!

I have just one question. I see how we can make versions of scripting components and mark old ones as Legacy, but I couldn’t figure out how to do that with components made out of Grasshopper definitions.

You can rename the new grasshopper file (e.g. MyGHSourceFile_v2.ghx) and add a new component in the project, pointing to this file. Mark the older one as Legacy.

Hi all,

I am running V8.11. I have several .rhp’s that I made using .gh files from 8.10 or earlier. They stopped working, so I opened ScriptEditor and it said I needed to update the underlying .gh files to the ‘current’ version for them to work. So my questions:

  • Will we need to open/save every .gh file in every .rhp to roll forward with new Service Releases?? Why are they not backwards compatible?
  • More importantly: How can we accommodate users on different SR’s? If one user is on V8.10 and another is on V8.11, how do we share common .rhp’s?

@declan Open the gh files in 8.11, save, and rebuild your plugins. They should would with 8.10 and >= 8.11 from then on. There was a few changes that needed to be made so rhinocode command can build projects outside of Rhino. This required a bit more info in the gh files and hence the “resaving” of the gh files.

Let me know if this is causing a lot of problems

OK - we can handle it as a one-time fix. So now the only issue is the icon editor which seems to have several issues now (bad timing since we need to suddenly recompile all the plugins).

Regardless, thank you for your hard work!

1 Like

If you have any other issues not mentioned there I’d really love to hear about them so I can get them fixed ASAP. (Ideally in new threads or the linked thread)

Hi @eirannejad,

is this new process of building .gha plugins “limited” to Grasshopper definitions that include a Scripting component? Or is it possible to convert standard Grasshopper definitions (which don’t include Scripting components) into plugins?

In the second example you show in the video, I can see at least one Python scripting component in the midst of several standard components, and I notice your built plugin component produces several outputs, which seem not to be all linked to the Python component.

Hopefully I am not missing any newly released documentation, but it would be nice if you could provide a simple example file to understand how to handle Contextual Inputs and Outputs. It also seems that a special formatting protocol is needed to handle outputs (I can see something similar to how Hops is managed, with components grouped and named RH_OUT).

Thanks a lot,
Marco

PS. I am attaching a simple example project folder which does not run when loading in Grasshopper. I also include the error log in case you can reproduce. I just uploaded Rhino to version 8 SR12 (8.12.24282.7001, 2024-10-08)

test.zip (77.8 KB)

Hello @marcopalma.posta

Welcome back!

Take a look at this documentation page. Look under Add Components. That section describes how Grasshopper components or definitions can be exported in the .gha plugin

Let me know if this does not makes sense and I can improve and provide more info here.

Hi,

thanks, I had to downgrade and hold on to Rhino 7 for some time :slight_smile:

Thanks for you link, I saw it, and I used it to test your workflow, which is straightforward and nice, but an error triggers when I load the compiled plugin in Grasshopper. I attached the .rhproj in the previous comment, in case you have 5 minutes to give it a try.

Here’s the error:

Error loading Grasshopper component | System.ArgumentException: The path is not of a legal form.
at System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.InternalGetDirectoryName(String path)
at RhinoCodePlatform.Projects.Rhino3DProject.GetAssemblyReferences(Type pluginType)
at RhinoCodePlatform.Rhino3D.Projects.Rhino3DProjectServer.PrepareScript(Rhino3DProject project, IGrasshopper1Script script, GH_Component component)
at RhinoCodePlatform.Rhino3D.Projects.Rhino3DProjectServer.TryDeserializeGHScript(InvokeContext context)

Thanks,
Marco

@eirannejad

SRC13 no longer loads plugins published from ScriptEditor that worked fine in SR12. Here is the error message:

Rhino.Runtime.Code.Execution.ExecuteException: The given key 'command' was not present in the dictionary.
 ---> System.Collections.Generic.KeyNotFoundException: The given key 'command' was not present in the dictionary.
   at System.Collections.Concurrent.ConcurrentDictionary`2.ThrowKeyNotFoundException(TKey key)
   at System.Collections.Concurrent.ConcurrentDictionary`2.get_Item(TKey key)
   at Rhino.Runtime.Code.Execution.ParamValueSet.Get[TValue](String name)
   at RhinoCodePlatform.Rhino3D.Languages.GH1.Grasshopper1Code.RunAsCommand(RunContext context, GH_Document ghDoc)
   at RhinoCodePlatform.Rhino3D.Languages.GH1.Grasshopper1Code.Execute(RunContext context)
   at Rhino.Runtime.Code.Code.Run(RunContext context)
   --- End of inner exception stack trace ---
System.Collections.Generic.KeyNotFoundException: The given key 'command' was not present in the dictionary.
   at System.Collections.Concurrent.ConcurrentDictionary`2.ThrowKeyNotFoundException(TKey key)
   at System.Collections.Concurrent.ConcurrentDictionary`2.get_Item(TKey key)
   at Rhino.Runtime.Code.Execution.ParamValueSet.Get[TValue](String name)
   at RhinoCodePlatform.Rhino3D.Languages.GH1.Grasshopper1Code.RunAsCommand(RunContext context, GH_Document ghDoc)
   at RhinoCodePlatform.Rhino3D.Languages.GH1.Grasshopper1Code.Execute(RunContext context)
   at Rhino.Runtime.Code.Code.Run(RunContext context)
Error occured running command "8d05c805-9474-41c1-b9e5-4de93f9aa50c" | Rhino.Runtime.Code.Execution.ExecuteException: The given key 'command' was not present in the dictionary.
 ---> System.Collections.Generic.KeyNotFoundException: The given key 'command' was not present in the dictionary.
   at System.Collections.Concurrent.ConcurrentDictionary`2.ThrowKeyNotFoundException(TKey key)
   at System.Collections.Concurrent.ConcurrentDictionary`2.get_Item(TKey key)
   at Rhino.Runtime.Code.Execution.ParamValueSet.Get[TValue](String name)
   at RhinoCodePlatform.Rhino3D.Languages.GH1.Grasshopper1Code.RunAsCommand(RunContext context, GH_Document ghDoc)
   at RhinoCodePlatform.Rhino3D.Languages.GH1.Grasshopper1Code.Execute(RunContext context)
   at Rhino.Runtime.Code.Code.Run(RunContext context)
   --- End of inner exception stack trace ---
   at Rhino.Runtime.Code.Code.Run(RunContext context)
   at RhinoCodePlatform.Rhino3D.Projects.Rhino3DProjectServer.TryRun(InvokeContext context)

@marcopalma.posta I installed the test.zip plugin you shared above using its yak package and it loaded in my 8.13 SRC rhino.

Where are you installing the .gha file? What is the full file path? The error stack above is complaining about an invalid path.

@declan Would it be possible to share the plugin? You can DM me the yak package.

There was a breaking change sometime in July so if the plugin is generated before that it would cause this specific problem.