Rhino 8 Feature: ScriptEditor (CPython, CSharp)

Looks like it uses the Windows setting for Colors. I had it set to Dark. If I pick Light it is much better

1 Like

Logged as RH-66280 Make it possible to configure the code linting

1 Like

Issue logged as RH-66278 Use Rhino custom paint colors instead of OS specified

3 Likes

Logged as RH-66284 to support conda as an optional package manager if possible

4 Likes

Yes. Already builtin but not exposed yet. Will clean up and incrementally publish these new features

Logged as RH-66285

3 Likes

Super excited about this.

One thing I found was that the autocomplete dialog flashes, but doesn’t allow selection on my end at least. It is so fast that capturing to a lower framerate gif actually cuts out the flash of autocomplete.

xMDqCVL4NY

1 Like

Working on it. Thanks for reporting :smiley: Logged as RH-66303

Release Notes (8.0.X.X)

WIP

1 Like

Steve,

I am having some problems with the Rhino Code Editor:

  1. I cannot get: Edit → Search or Search and Replace to work.
  2. Same for: Save As

Are these functions not yet available?

Regards,
Terry.

Is this will be available for Grasshopper too?

1 Like

Not yet. We’re working on those :smiley:

Yes :smiley:

1 Like
  1. Another item of interest to me: I would like to change the font on the Rhino Code Editor window. The existing font is washed out; there are other fonts which are better like Consolas.

  2. Also on my laptop, the editor window overruns the bottom of the Rhino window so I cannot see the error information put at the bottom of the editor window.

  3. I managed to save a Python 3.9 file but I cannot open it because the editor only looks for files with Python 3 type extension whereas the save created a plain old text extension.

  4. The editor randomly mangles a few lines of code from time to time. I think it may have something to do with its rapid command completion scanning. The completion scanning often times prevents smooth typing with the displayed text lagging many characters behind the typing. There needs to be an option for turning off completion scanning.

Regards,
Terry.

1 Like

Ansys Script editor have a nice feature to record commands and replay them.
If that possible in RhinoCode will be very useful to everyone who don’t know anything in scripting.

21 Likes

This looks like a great way to learn things.

8 Likes

Under the hood it is SpaceClaim, which from time to time someone references as nice example of some functionality (for example solid editing or parallel brep faceting/meshing). This editor in SC also allows for creation of parametric parts.

1 Like

@stevebaer

Can numpy be used with Rhino Code for Python scripts? In my Python 3.9 script I tried:

import numpy

but this fails.

When I first setup Rhino 8 WIP with Python, I was asked it I wanted Python packages installed and I replied yes. Do these packages not include numpy?

Should I try to use Conga or PIP to install numpy now?

Regards,
Terry.

Did you include a line

# r: numpy

before you do

import numpy

?

Creating a new py3 example file has this at the top:

"""
Note:
This project is work-in-progress and still in its infancy

- Reference to RhinoCommmon.dll is added by default

- You can specify your script requirements like:

    # r: <package-specifier> [, <package-specifier>]
    # requirements: <package-specifier> [, <package-specifier>]

    For example this line will ask the runtime to install
    the listed packages before running the script:

    # requirements: pytoml, keras

    You can install specific versions of a package
    using pip-like package specifiers:

    # r: pytoml==0.10.2, keras>=2.6.0
"""
1 Like

@stevebaer ,

I have been working on getting my 2000+ line IronPython with C++ DLL working in Rhino 8 with Rhino Code Python 3.9 code. I only had to make a handful of changes to get it to run and import a pointcloud. But there is one line in Python that that does not work; the line where it tries to get the Rhino object for the pointcloud using its RunTimeSerialNumber = cpc_serial_number.value which is a C-types uint32 variable passed back from the C++ code. This works fine in Rhino 7 IronPython. Below I have added a print of the cpc_serial_number.value to show that it exists.

from scriptcontext import doc
......
...... calls C++ DLL here which returns the RunTimeSerialNumber
...... of the point cloud created in the C++ code.
......
print(cpc_serial_number.value)
pcObj = doc.Objects.Find(cpc_serial_number.value)

Result of running script with above lines:

192687 # This is the RunTimeSerialNumber of the cloud. It looks good.
TypeError : No method matches given arguments for Find: (<class ‘int’>)
File “C:\Users\Terry\AppData\Roaming\McNeel\Rhinoceros\8.0\scripts\ImportCloudWalls”, line 1959, in
ImportXYZRGB_DLL()
File “C:\Users\Terry\AppData\Roaming\McNeel\Rhinoceros\8.0\scripts\ImportCloudWalls”, line 918, in ImportXYZRGB_DLL
pcObj = doc.Objects.Find(cpc_serial_number.value)
at Python.Runtime.Runtime.CheckExceptionOccurred()
at Python.Runtime.PyScope.Execute(PyObject script, PyDict locals)
at Python.Runtime.RhinoCPythonEngine.RunScope(String scopeName, String pythonFile, Boolean tempFile, Boolean useCache)

The error message says Find has the wrong argument type. Has the Find function changed in Python 3.9 vs IronPython 2.7? How can I get this to work?

Regards,
Terry.

We are using PythonNet for interop between CPython and the RhinoCommon .NET library which has some subtle differences from IronPython that we are working on fixing. There are two overloads to the Find function in RhinoCommon and I bet PythonNet is having trouble determining which version of the Find function to use.

There is an equivalent function in RhinoCommon that essentially does the same thing and has been around since Rhino 6.
https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_DocObjects_RhinoObject_FromRuntimeSerialNumber.htm

import Rhino
...
pcObj = Rhino.DocObjects.RhinoObject.FromRuntimeSerialNumber(cpc_serial_number.value)

(edit) we do hope to fix the situation that you are seeing, I’m trying to provide a work around for now.

1 Like