Rhino WIP: Grasshopper 2 Script Components

First working draft of Grasshopper 2 Script Components are in Rhino WIP. This is the first iteration of these components and there is still a long road to feature parity with Grasshopper 1. But they are there and they are mostly usable. I thought it would be a good idea to announce and collect feedback as early as possible, as we further develop these components.

Here are the highlights on what is available and what is in progress:

  • Python3, IronPython 2, and C# components are available (marked as hidden until ready)
  • Data + Metadata are both accessible using Grasshopper 2 IPear data type
  • Executing and debugging in multi-threaded mode is supported.
  • Language initialization is handled similar to Grasshopper 1 script components
  • Work In Progress
    • Implementation of Script_Instance for grasshopper 2
    • Type hints although data access is simpler that GH1
    • Generic script component that can run any language
    • Parameters to input and output script that the component executes
    • Parameters to input library that the component uses with the script
    • Parameter and component Tooltip/Human-readable Names for publishing
    • Copy/Pasting parameters
    • Add support for Grasshopper 2 to script editor projects
    • Maybe helper libraries like ghpythonlib

Double-click on the GH2 canvas and type # python or #C# to access these components

Double-clicking the component should open the editor just like GH1

Data / Metadata Access

In GH2 script components, grabbing the data is as easy as GH1. Just connect the inputs and the script will receive the data depending on the access kind (Item, List, Tree)

To access the metadata that is accompanying a data item, you can right-click on an input parameter and mark it as “Picks Pears”. This means the data that is passes to the component is now an instance of Grasshopper IPear. You can access the item (IPear.Item) and metadata (IPear.Meta) using this data structure

Note that when access kind is set to Tree, the Picks Pears option is disabled since an instance of Grasshopper ITree is being passed to the script that provides access to the metadata as well

Parallel Execution

By default, Grasshopper 2 creates independent tasks for Iterations of a component and runs them in parallel. You can choose the Threading Model of a script component on the context menu. However debugging a component that is running and computing iterations out-of-order is not very intuitive. So you can choose this independently for debug mode, and it is set to One (one by one on any available thread) by default

Debugging works very similar to GH2 with the exception of parallel debugging that is specific to GH2

Python Marshalling

Just like GH1 you can choose whether to marshal input data to python types or not

Language Init

Language initialization should work normally like GH1


I would love to hear your feedbacks!

10 Likes

Thanks for the work, but I guess access to these features is still for internal builds? Yesterday’s Rhino 9 WIP does not find Python or C# Script Component in Grasshopper 2 (I used the search you showed, preceded by #). My GH2 plugin is also updated to the latest via Package Manager.

Uninstall the GH2 that you have from Package manager. Rhino WIP ships with Grasshopper 2 already. I suspect your Rhino is still loading the one from package manager

This is awesome, congrats @eirannejad. Very exciting news indeed :partying_face:

From a very quick go, I don’t really have too much feedback yet, other than the visual design appears to be largely identical to the Rhino 8 versions. Where in your videos above, the Mac version looks more minimal and pleasing (to me), than the Windows version:

With the top menu bar obliviously being a given, but I think the thicker borders and top left icon are also key culprits, as discussed way back in 2023 here:

If at all possible, I’d still prefer a slightly leaner/minimal overall design/structure, ala this old mock-up:

Edit: Also, reusing the design of the GhPython component icon for the new CPython component might be a bit confusing (i.e. as GhPython was/is IronPython). Maybe a modified CPython logo would be more appropriate.

Edit II: Think I didn’t have enough coffee, I can see now that the WIP/GH2 CPython logo is more like a combination of the old two, I dig it:

Can ghpython in grasshopper 2 support compile and export file *.ghpy just like GH1, can run on GH2
Or can you make *.ghpy can run on GH2 ?
It will help individuals create many small and secure applications.

Or less substantial, these small tweak would go a long way:

From:

To:

Where I’ve:

  1. Made the left/middle borders thin and desaturated (like on Mac).
  2. Removed the top left Rhino WIP icon (like on Mac).
  3. Made the two top right collapse buttons lighter.
  4. Made the three icons at the top bar of the terminal lighter.
  5. Made the terminal background grey (like GhPython).
  6. Desaturated and unified the contrast on borders.

Edit: Still though, something like this would be nice (where the middle bar buttons drop to the bottom):

Edit II: At the very least, how about this (i.e. like Mac version plus grey terminal bar background):

Only just got the IronPython icon, brilliant:

Very Grasshopper/Rutten-y..

3 Likes

@Shank

We have adopted a new method of publishing script components in Grasshopper as plugins, and it applies to all the supported scripting languages not just IronPython. It does not obfuscate your code however.

See

1 Like

Here’s a couple of things that don’t work from a very quick go:

  1. For loops in IronPython:

  1. Output geometry parameters aren’t drawn in IronPython and CPython:


  1. print requires parentheses in IronPython, despite running 2.7.12:


System Info

Rhino 9 SR0 2025-6-24 (Rhino WIP, 9.0.25175.06305, Git hash:master @ 8720752431d790795d498af27e9fd926ccb2a2d7)
License type: Commercial, build 2025-06-24
License details: Cloud Zoo
Expires on: 2025-08-08

Windows 11 (10.0.26100 SR0.0) or greater (Physical RAM: 32GB)
.NET 9.0.6

Computer platform: LAPTOP - Plugged in [79% battery remaining]

Hybrid graphics configuration using OpenGL
Primary display: Intel(R) Iris(R) Xe Graphics (Intel) Memory: 2GB, Driver date: 1-23-2025 (M-D-Y).
> Integrated graphics device with 4 adapter port(s)
- Windows Main Display is laptop’s integrated screen or built-in port
Primary OpenGL: NVIDIA RTX 2000 Ada Generation Laptop GPU (NVidia) Memory: 8GB, Driver date: 3-14-2025 (M-D-Y). OpenGL Ver: 4.6.0 NVIDIA 572.83
> Integrated accelerated graphics device (shares primary device ports)
- Laptop’s primary display device

OpenGL Settings
Safe mode: Off
Use accelerated hardware modes: On
GPU Tessellation is: On
Redraw scene when viewports are exposed: On
Graphics level being used: OpenGL 4.6 (primary GPU’s maximum)

Anti-alias mode: 8x
Mip Map Filtering: Linear
Anisotropic Filtering Mode: High

Vendor Name: NVIDIA Corporation
Render version: 4.6
Shading Language: 4.60 NVIDIA
Driver Date: 3-14-2025
Driver Version: 32.0.15.7283
Maximum Texture size: 32768 x 32768
Z-Buffer depth: 24 bits
Maximum Viewport size: 32768 x 32768
Total Video Memory: 8188 MB

Rhino plugins that do not ship with Rhino
C:\Program Files\Rhino 9 WIP\Plug-ins\UpdatesAndStatistics\UpdatesAndStatistics.rhp “UpdatesAndStatistics” 9.0.25175.6305
C:\Program Files\Rhino 9 WIP\Plug-ins\Grasshopper2\net48\Grasshopper2Plugin.rhp “Grasshopper2” 9.0.25175.6305
C:\Program Files\Rhino 9 WIP\Plug-ins\ConstraintsUI.rhp “Constraints UI” 9.0.25175.6305

Rhino plugins that ship with Rhino
C:\Program Files\Rhino 9 WIP\Plug-ins\Commands.rhp “Commands” 9.0.25175.6305
C:\Program Files\Rhino 9 WIP\Plug-ins\rdk.rhp “Renderer Development Kit”
C:\Program Files\Rhino 9 WIP\Plug-ins\RhinoRenderCycles.rhp “Rhino Render” 9.0.25175.6305
C:\Program Files\Rhino 9 WIP\Plug-ins\rdk_etoui.rhp “RDK_EtoUI” 9.0.25175.6305
C:\Program Files\Rhino 9 WIP\Plug-ins\NamedSnapshots.rhp “Snapshots”
C:\Program Files\Rhino 9 WIP\Plug-ins\MeshCommands.rhp “MeshCommands” 9.0.25175.6305
C:\Program Files\Rhino 9 WIP\Plug-ins\RhinoCycles.rhp “RhinoCycles” 9.0.25175.6305
C:\Program Files\Rhino 9 WIP\Plug-ins\Grasshopper\GrasshopperPlugin.rhp “Grasshopper” 9.0.25175.6305
C:\Program Files\Rhino 9 WIP\Plug-ins\Toolbars\Toolbars.rhp “Toolbars” 9.0.25175.6305
C:\Program Files\Rhino 9 WIP\Plug-ins\3dxrhino.rhp “3Dconnexion 3D Mouse”
C:\Program Files\Rhino 9 WIP\Plug-ins\Displacement.rhp “Displacement”
C:\Program Files\Rhino 9 WIP\Plug-ins\SectionTools.rhp “SectionTools”

1 Like

This only seems to break when the loop starts at line 1:


Huh. Seems like IronPython is acting out! Made YT tickets for these and will look into it

RH-88283 IronPython is missing for loop?!?!
RH-88282 IronPython requires print with paranthesis!?!
RH-88284 Output geometry from scripts is missing preview

2 Likes