Rhino 8 Feature: RhinoCode (CPython, CSharp)

I really tried to code some stuff using RhinoCode but for me it was in to early stage of development to do something with it, so I moved back to Hops workaround to work with CPython.

I love the idea of the CPython in Rhino, but I’m not sure if creating new IDE from scratch for Rhino makes that much sense. As my colleage reacted when I send him a link to this thread, he asked: Why they work on a new IDE rather than make good tools that will allow to use whatever IDE you want. Even though GHPython console is quite good (while C# console is at least for me almost unusable) you will never top the best IDEs (VS, VSCode, Jetbrains, Spyder, Atom etc.) for obvious reasons. Even right now people who I know, they are just using ScriptParasite plugin for C# and use IDE they want. As we know for Python there is also a builtin way to do same thing. I appreciate these examples above from @jgillmanjr when there is this Pycharm being used, because it means that we will be able to do it flawless in the future.

Obviously I don’t have a bigger picture, I don’t know details regarding this technology, therefore I’m missing things for sure. Just wanted to suggest that at the end there is a big chance that many of us will just use it as a bridge with their favourite IDE, while at the same time others will request endless number of features for the editor, to make it look and work just like their favourite editor that already exists.

Best regards :wink:

3 Likes

You will eventually be able to use an external tool like VS Code. We also need to ensure that there is a built-in editor for those who don’t download and use external tools.

[edit] it should also be pointed out that our current EditPythonScript code editors on Windows and Mac are very platform specific. Moving toward the future, we want to be able to write a single cross platform editor that we can make improvements to which show up on both Windows and Mac.

8 Likes

In my case i started coding in rhino and switched after years to VS not the oposite way.
A good IDE in rhino is a great way to learn programming.

4 Likes

Will this feature also be applied to grasshopper code components? :smiley:

Hi @stevebaer, from these two replies I am drawing the conclusion that at some point beyond Rhino 8, Rhino usage of IronPython 2 code will be terminated, meaning we wouldn’t be able to run the IronPython 2 code that currently works on Rhino 5,6,7?

I don’t think that is the proper conclusion to draw. We’ve worked hard to keep legacy RhinoScript running version after version of Rhino. I don’t have any plans to pull IronPython either.

5 Likes

I’m curious as to what the benefits of keeping IronPython around might be. I would imagine the sorts of scripts being used in Rhino wouldn’t be too difficult to port over to Python 3.9.

But I’m obviously happy to be proven wrong.

The idea is to have scripts just work without having to be rewritten…

— Dale

2 Likes

@eirannejad Rhino crashes after: RhinoCode → File → New by Language → Python

System Info:
Rhino 8 SR0 2021-11-23 (Rhino WIP, 8.0.21327.16305, Git hash:master @ 733ed6ca886237a11639d8a8111a650c1c8e0f5f)
License type: Educational, build 2021-11-23
License details: Cloud Zoo
Expires on: 2022-01-07

Windows 10.0.19043 SR0.0 or greater (Physical RAM: 32Gb)

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

Non-hybrid graphics configuration.
Primary display and OpenGL: NVIDIA Quadro RTX 3000 (NVidia) Memory: 6GB, Driver date: 10-26-2021 (M-D-Y). OpenGL Ver: 4.6.0 NVIDIA 472.47
> Integrated accelerated graphics device with 4 adapter port(s)
- Windows Main Display is laptop’s integrated screen or built-in port

Secondary graphics devices.
Intel(R) UHD Graphics (Intel) Memory: 1GB, Driver date: 11-2-2021 (M-D-Y).
> Integrated graphics device with 3 adapter port(s)
- There are no monitors attached to this device. Laptop lid is probably closed

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

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

Vendor Name: NVIDIA Corporation
Render version: 4.6
Shading Language: 4.60 NVIDIA
Driver Date: 10-26-2021
Driver Version: 30.0.14.7247
Maximum Texture size: 32768 x 32768
Z-Buffer depth: 24 bits
Maximum Viewport size: 32768 x 32768
Total Video Memory: 6 GB

Rhino plugins that do not ship with Rhino
C:\Program Files\Rhino 8 WIP\Plug-ins\RhinoCode\RhinoRoslyn.rhp “RhinoRoslyn” 8.0.21327.16305
C:\Program Files\Rhino 8 WIP\Plug-ins\RhinoCode\RhinoCodePlugin.rhp “RhinoCodePlugin” 8.0.21327.16305
C:\Program Files\Rhino 8 WIP\Plug-ins\RhinoCode\RhinoCPython.rhp “RhinoCPython” 8.0.21327.16305
C:\Users\silvano\AppData\Roaming\McNeel\Rhinoceros\packages\8.0\ColorPicker\6.0.0\ColorPicker.rhp “ColorPicker”
C:\Users\silvano\AppData\Roaming\McNeel\Rhinoceros\packages\8.0\ggRhinoIFC\2.1.23.0\ggRhinoIFC.rhp “ggRhinoIFC” 2.1.23.0
C:\Users\silvano\AppData\Roaming\McNeel\Rhinoceros\packages\8.0\rhinopbrmaterial\1.1.4+v6.16\RhinoPbrMaterial.rhp “RhinoPbrMaterial” 1.1.2.0

Rhino plugins that ship with Rhino
C:\Program Files\Rhino 8 WIP\Plug-ins\Commands.rhp “Commands” 8.0.21327.16305
C:\Program Files\Rhino 8 WIP\Plug-ins\WebBrowser.rhp “WebBrowser”
C:\Program Files\Rhino 8 WIP\Plug-ins\rdk.rhp “Renderer Development Kit”
C:\Program Files\Rhino 8 WIP\Plug-ins\RhinoScript.rhp “RhinoScript”
C:\Program Files\Rhino 8 WIP\Plug-ins\IdleProcessor.rhp “IdleProcessor”
C:\Program Files\Rhino 8 WIP\Plug-ins\RhinoRenderCycles.rhp “Rhino Render” 8.0.21327.16305
C:\Program Files\Rhino 8 WIP\Plug-ins\rdk_etoui.rhp “RDK_EtoUI” 8.0.21327.16305
C:\Program Files\Rhino 8 WIP\Plug-ins\rdk_ui.rhp “Renderer Development Kit UI”
C:\Program Files\Rhino 8 WIP\Plug-ins\NamedSnapshots.rhp “Snapshots”
C:\Program Files\Rhino 8 WIP\Plug-ins\RhinoCycles.rhp “RhinoCycles” 8.0.21327.16305
C:\Program Files\Rhino 8 WIP\Plug-ins\Toolbars\Toolbars.rhp “Toolbars” 8.0.21327.16305
C:\Program Files\Rhino 8 WIP\Plug-ins\3dxrhino.rhp “3Dconnexion 3D Mouse”
C:\Program Files\Rhino 8 WIP\Plug-ins\Displacement.rhp “Displacement”

1 Like

Yup. We accidentally broke the editor on Windows in the last update. This is fixed for the next WIP release today.

1 Like

Coming back to the RhinoCode Editor after a couple of weeks, I find this interesting, nice feature:

A miniature view of the code is shown on the far right instead of just a scrolling bar. This seems like an easier way to navigate up and down in the code.

Nicely done.

Regards,
Terry.

3 Likes

Thanks @Terry_Chappell Yeah it’s usually called a minimap and has become quite a popular feature in code editors in recent years

2 Likes

Hi Ehsan,

How can I change my GH Python editor to the Rhino code editor, It still use the original python editor in RhinoWIP 8 and many classes are missing. for example when I type ‘from System import Uri’ I can run it in the Rhino Code edit. But in the original python editor, it will return an error that says cannot import the name Uri. Do you know the reason? is it because it’s using a different version of Python?

Thanks

@user2234 RhinoCode editor is still not available for Grasshopper. We are working on it though. I don’t see any problems with from System import Uri in the original python editor. The original editor is running IronPython which is a different implementation of python and follows the python 2 specification. The new RhinCode editor ships with CPython 3

Hi @eirannejad ,
Will Cpython 3 be available through a separate Grasshopper GHPython component?
I am just confused how the GHPython component which supports IronPython 2 will relate to that future GHPython Cpython 3?

Yes. RhinoCode is going to have its own Grasshopper component. We’ll figure out what to do with the existing ones later

2 Likes

Hello @eirannejad,

I just discovered this thread, if I understood correctly, the RhinoCode editor is an HTML control in which you have integrated Monaco.
So I’m assuming you’re making RPC-like calls between Rhino and RhinoCode.
If so, it might be useful to expose a public API to make these calls.
The goal would be to be able to connect Rhino to external editors.

I understand the usefulness of having an IDE built into Rhino and why some users need it.
An IDE is complex software. There comes a time when you want to work with your own editor.

In terms of debugging it seems to me that the license of the Python server of VSCode will not allow to integrate debugging in the editor.

A few years ago, I experimented with C# scripting when Roslyn was released.
GitHub - corbane/Ghx: Debugging Roslyn script inside Grasshopper. (This is a proof of concept, which should no longer be compatible with VSCode.)
Connecting Rhino to an external editor will also debug CSharp scripts.
There is no need for a language server here, just portable x64 PDBs and source files accessible on the file system.

jmv

6 Likes

New releases of Rhino 8 WIP are announced in Rhino 8 WIP Available Now! - #34 by brian Scroll to the bottom of the latest release.

1 Like

Can you add ironpython 3 to the new component or ironpython 2 as optional language, like in visual studio

@eirannejad

In the event it’s not normal, it needed to reinstall cPython.

Also sending you the log of the install which seemed to be throwing some exceptions with the stub building process.