Getting Numpy inside Rhino


Just read this answer:

And decided to share my recent findings.

I decided to create a new thread as I think it deserves it, also that thread is pretty old.

Recently while I was experimenting mixing languages I read an article regarding ‘pythonnet’ and their new developments that allow to start CPython interpreter from a dotnet application.

There is a nuget package called: Python.Runtime.NETStandard.3.7.1

With it, you are able to run locally installed CPython with whatever modules you have installed there and pass inputs and outputs from IronPython to CPython and vice versa.

In my example I made a comparison using RTree and numpy’s algorithm to finding points within a sphere. (9.5 KB)

Of course the performance compared with RTree is bad, but I give it credit for giving the indecies of the points in order. :wink:

I believe this will allow lots of new algorithms and new approaches for old problems.

Enjoy :slight_smile:

IMPORTANT: You MUST use CPython3.7.x+ otherwise Rhino will crash. :stuck_out_tongue_winking_eye: