This sample shows how to run Rhino from Electron.
This sample extends Sample 1, 2, and 3 by using Electron for UI. Geometry rendered with three.js.
The sample has been tested on Windows 10, Rhino 7 WIP, and Node.js 8.11.12 (though should work on more recent versions of Node.js)
There are three projects in this sample:
InsideElectron- Compiles to a .net framework class library with two classes and several methods. This class contains the code to start Rhino and Grasshopper, as well as a customTaskScheduler.TestInsideElectron- A small project to test the TaskScheduler class to control Rhino.InsideElectronApp- The Electron app that provides a GUI and launches Rhino and Grasshopper from JavaScript.
Rhino 7 WIP(Required install)Node.js (8.11.2 or newer)(Required install)edge.js (^11.3.1)(Referenced via npm)Electron.js(Referenced via npm)Json.NET(Referenced via the NuGet package)rhino3dm.js(Referenced via URL)three.js(Referenced via URL)
This assumes you've already installed Rhino 7 WIP and Node.js for Windows, and have cloned the Rhino.Inside repository.
- Open the
InsideElectron.slnin Visual Studio and build the solution. This builds the .dll which is referenced in the Electron app. Note: You might need to Clean dna Rebuild the InsideElectron.csproj to get NuGet to restore the Json.Net package. - Open a console from the
InsideElectronAppdirectory. - Run
npm installto install any dependencies. - Run
npm startto run the sample. You should see the Electron window appear, followed by the Grasshopper editor. - In the Grasshopper editor, add a Mesh > Primitive > MeshSphere component to the Grasshopper Canvas. You should see someting like this:
As you continue to develop the definition, the rendered geometry will update to reflect what you have defined in the Grasshopper canvas:
