Rhino 8 Feature: RhinoCode (CPython, CSharp)

@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.

Confirmed that RH-66399 (editor crashing on external file edit) was resolved

1 Like

excited for this new python version!
When i install numpy by pip i meet a basic problem (sorry i am not a computer expert). Even i add ‘…rhinocode\python3.9-1.11’ and ‘…rhinocode\python3.9-1.11\scripts’ into my PATH, it still returns pip and python are not there, so that i can’t install numpy. It seems it always recognize my pip from another folder belongs to anaconda.
I don’t know how to successfully install python3,pip,numpy into rhino script based on existing python from conda. Any simple solutions?

6 posts were split to a new topic: Updating Rhino 8 WIP

Release Notes (8.0.21348.8306)

  • Published RhinoCode CLI
  • Published RhinoCode for Visual Studio Code RH-66659
  • Major improvements on the inner-workings of the code editor. The is only one file now storing all code editor settings and states ~/.rhinocode/editor.json
  • Fixed RH-66388
  • Fixed RH-66394
  • Fixed RH-66399
  • Fixed RH-66461
3 Likes

Hello @eirannejad

In VSCode, the Run in Rhino WIP command produces nothing, just like “RhinoCode.exe list” command line
image

I am on Windows

Also I don’t understand the path "\\\\.\\pipe\\", it doesn’t seem to be a valid Windows path.

jmv

Do you plan any debugging tools, internal to RhinoCode or via an external editor ?


I am not a developer, I am a modeler, those before digital (it’s closer to the carpenter).
But today everything is digital, so I learned to adapt Rhino to my needs and I have a more successful version of my previous experimentation.
I’m happy, it works with Rhino7 and Rhino8.

My code is embedded in a library that I cannot share.
When I see your code and mine it doesn’t seem like we have the same approach,
but if it helps I can extract a small version of this plugin ?

What you take care of, I won’t have to do it anymore. :slight_smile:

1 Like

Of course

Ehsan is getting the foundation in place right now for just getting everything up and running

2 Likes

Do you have an instance of rhino running?