Rhino 8 Grasshopper Script Editor - Design Feedback

It is because they run a python subprocess in the current directory of the script. Rhino is running python in Embedded mode so python is loaded like a library to the Rhino.exe process. Therefore os.getcwd() reports the path that Rhino.exe was started on.

Here is an example of running a python script that prints os.getcwd() from two different directories. Notice that printed results are different:

Here is another example from Blender (with embedded python):

This also means getting the current working directory is consistent across languages in the script editor. Both these scripts return the same path:

// #! csharp
using System;
Console.WriteLine(Environment.CurrentDirectory);
#! python3
import os
print(os.getcwd())

Here is my rationale for breaking this behaviour:

It only affects a subset of scripts that run in the main editor and from those only a subset that tries to determine the script path from os.getcwd(). It’s a static state on python runtime and I don’t want to change it since it really should return the process cwd (I know it feels like it is a matter of opinion), and that also will cause problems down the line with parallel python scripts as they can’t all have different values coming from os.getcwd(). Previous Rhino did not rely on so many external python libs. With pip available now I want things in python to act as expected from the vantage point of external python libraries as well. It’s more pythoninc to use __file__ instead of os.getcwd(). A maybe-positive side effect is now finding path of Rhino executable is easy.

I hope this makes sense.

5 Likes

Thank you for your detailed explanation. I understand that you want to have a clean behavior between languages.
What is the difference between IronPython using the old Editor and IronPython within the new ScriptEditor?
Is it a subprocess in the old Editor and embedded, if I start it in the new ScriptEditor?

@daniel.kowollik Nope. They all run the same way. At some point in the past someone intentionally set the cwd to the script location before script execution. For the reasons I mentioed above it wasn’t much of a big deal back then.

RH-78080 is fixed in Rhino 8 Service Release 15

1 Like

The font variations do not all appear to be fixed (edit: @eirannejad and @brian). For instance, here’s going from Consolas to Cascadia Code to Cascadia Code SemiLight side-by-side with GhPython, where the new editor appears to fall back to Consolas with the latter variation. One can tell by the zeros, where Cascadia (now being used here on Discourse too it seems) looks like eyes 00 :



System Info

Rhino 8 SR15 2024-12-17 (Rhino 8, 8.15.24352.13001, Git hash:master @ 08fbca3b330b4f971e71c8b38776f3c82f232b9f)
License type: Commercial, build 2024-12-17
License details: Cloud Zoo

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

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

Hybrid graphics configuration.
Primary display: Intel(R) Iris(R) Xe Graphics (Intel) Memory: 128MB, Driver date: 5-12-2024 (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: 6-26-2023 (M-D-Y). OpenGL Ver: 4.6.0 NVIDIA 536.45
> Integrated accelerated graphics device (shares primary device ports)
- Video pass-through to 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: 4x
Mip Map Filtering: Linear
Anisotropic Filtering Mode: High

Vendor Name: NVIDIA Corporation
Render version: 4.6
Shading Language: 4.60 NVIDIA
Driver Date: 6-26-2023
Driver Version: 31.0.15.3645
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

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

Also, we’re finally about to start rolling out Rhino 8 across our offices. In that context it would be great to hear if there are any plans to address some of the other outstanding issues raised up here:

For now we’ve only been using the new script editor for testing and pretty much just for CPython. It would be great to start using it in production for IronPython and C# scripting as well.

Hi @brian/@eirannejad, just a note that this issue persists in 8.16.25034.21001. See this post above.

1 Like

Thanks, I reopened the issue for Ehsan.

1 Like

Hi @eirannejad,
I just updated to Version 8 SR17
(8.17.25056.13001). If I open a side window such as Explorer or Search & Replace, the scroll bar in the text editor disappears. I have to close Rhino and reopen it to get the scroll bar back.

The vertical or horizontal scroll bar? Windows on macOS? :thinking:

Pushed a fix for this in 8.18 however it is a bit incomplete. The problem is Monaco, the editor control that we use in the new ScriptEditor does not have a font style setting. So on windows @Alain and I decided to use the common css weights and apply that to the css styling of the control to get to this work on Windows. This covers bolding (weight) of the text but not Italicizing.

On macOS, Monaco uses the WebKit engine and is much better so it just works and does not have this limitation.


2 Likes

Cheers Ehsan, looking forward to the update. And hot dang, that’s another point for going Mac :exploding_head:

1 Like

I am using Rhino 8 on Windows. Both scroll bars disappear. They even disappear, if I resize the main window of the Script Editor.

@daniel.kowollik Hmm I can not replicate this. They fade-out when mouse is not over the editor but that’s expected.

@Alain Any clues to what might cause hiding the scrollbars when the editor size changes?

I am still using Windows 10. It happens with system dark and light theme and it happens in Grasshopper and in Rhino.

I can’t reproduce this on a Windows 10 computer. Do you have a screencast? Just in case it could reveal a subtle clue?

Hi @brian, think you might have accidentally edited my post there. I just tested the issue in Rhino 8.18.25070.14001 and I’m afraid it has still not been fixed (see e.g. Cascadia Code SemiLight):


Edit: Looks like the attempted fix might have broken things further. Setting the font is now highly unpredictable and can seemingly “get stuck” (@eirannejad):

Hi @Alain,
I hope this helps. The scrollbar dissappears whatever I change on the window size of the code window, for example terminal window, search window or the entire size of the editor.

Hej Anders -

I’ve reverted that and reopened RH-78080 ScriptEditor: Font variations does not work in new script editor
-wim

1 Like

Looking into this again. As I mentioned above, the Italics and Obliques etc do not work on Windows. That’s a limitation of monaco styling.