HotLoader
(by camnewnham)
Write CSharp components on-the-fly.
Downloads:
116
Support Email

HotLoader extends Grasshopper's scripting tools by allowing you to write, debug, load C# plugins that are hot-loaded at runtime. It is an advanced tool for prototyping, creating, and debugging components using your native development tools.

 

What

HotComponent works by creating a C# project, similar to what you'd create if you were writing a normal component in a custom Grasshopper plugin. When you edit and compile the code, the component is hot-loaded into your Grasshopper definition just like pressing play on the C# script editor.

1. Place a HotComponent into a Grasshopper document.
2. The .csproj will open in your native editor.
3. Edit the code and rebuild the project.
4. Swap back to Grasshopper and use your new component. Edit and rebuild as required.
5. Optionally, attach your debugger to Rhino to hit breakpoints in your code.

The full source code for the custom component and the compiled binaries (including references) are embedded in the component, and hence saved with the Grasshopper definition.


Why

1. The native Grasshopper script editor is inconvenient to use for tasks with any complexity. The new editor in Rhino 8 is a marked improvement, but still has some of the following limitations.
2. Distributing scripts that use external references requires users to also have the same references, and locate them. This also includes NuGet packages.
3. Lifecycle methods are limited in script components, i.e. managing event subscriptions and object disposal.
4. Precompiled C# plugins can run faster than script components (as you can use the true parameter types without casting)
5. Customization if script components is limited (icons, custom drawing, right click menus, etc.).
6. Writing Grasshopper plugins has some overhead in setting up the project and distributing the plugin.

Some of these challenges are solved (with tradeoffs) by tools such as Script Parasite or the new script editor in Rhino 8, or even just the project templates.

HotComponent became feasible with the introduction of the Yak (the Package Manager) - as until now it would have been inconvenient to share HotComponents because the user would have to pre-install a plugin to load them. Now, the user simply needs to accept the prompt to install HotLoader and the definition will open as normal.

 

Contributing

If you'd like to implement something, please fork and create a pull request, or create an issue to discuss.

  • License Type:
License Cost:
Downloads
For instructions on installing Grasshopper Add-Ons, please see FAQ for details.
Title
Description
Platform
 
HotLoader 0.0.6-pre
2023-Nov-17
Write CSharp components on-the-fly.
Rhino 6 Mac
Rhino 6 Win
Rhino 7 Mac
Rhino 7 Win
Rhino 8 Mac
Rhino 8 Win
Reviews