Rhino Compute Server
repository·9.x·Indexed 18 days ago
https://github.com/mcneel/compute.rhino3dA RESTful API interface for RhinoCommon and Grasshopper that enables remote geometric computation and Grasshopper script execution. Built on Rhino 8 for Windows, it includes the compute.geometry core engine, compute.components for Hops integration, and tools for generating client libraries in C#, Python, and JavaScript. Version 0.18.0 introduces strict compatibility with Rhino 9 and support for Model Object serialization in Rhino 9 Grasshopper files.
What's inside compute.rhino3d
- Rhino Compute is a REST API that provides access to RhinoCommon and Grasshopper. It is built on top of Rhino 8 for Windows and can be deployed in any environment where Rhino 8 for Windows is supported. It allows developers to run Rhino-based geometry and Grasshopper computations remotely via web services.
Understand the Rhino Compute project structure
9.xThecompute.rhino3drepository is split into specialized components for geometry processing and communication. The core logic resides incompute.geometry, whilecompute.componentsprovides the Grasshopper (Hops) integration required to communicate with a geometry server from within Grasshopper.Create client libraries with computegen
9.xThe
computegentool is used to generate client libraries for thecompute.rhino3d.comservice. It supports generating libraries for the following target languages:- JavaScript:
compute.rhino3d.js - Python:
compute.rhino3d.py - .NET:
compute.rhino3d.cs
- JavaScript:
Model Object serialization in Rhino.Compute v0.18.0
9.xVersion
0.18.0introduced support for the serialization and deserialization of Model Objects from Grasshopper definitions within Rhino.Compute.Important Compatibility Note: This feature requires specific changes to the serialization code within Grasshopper files. Consequently, this functionality is only compatible with Rhino 9 Grasshopper files.
Internalize referenced definitions in Hops
9.xHops can internalize referenced definitions that are saved on a local file system. Internalizing a definition removes the reference to the external file and instead serializes the definition directly inside the Hops component.
Benefit: Once internalized, you no longer need to share the accompanying referenced file alongside your Hops file.
Use compute.components for Grasshopper Hops integration
9.xThecompute.componentsdirectory contains the Grasshopper component project (Hops). Use this to enable Grasshopper to communicate with a runningcompute.geometryserver, allowing you to run remote geometry computations as standard Grasshopper components.Use Optional inputs in Hops
9.xIn version 0.16.11 and later, you can make certain parameters act as Optional inputs.
To do this, use a Context Get component and set the
AtLeastvalue to0. This tells the system that the parameter is not strictly required for the solve routine.Use compute.geometry as the main geometry server
9.xThecompute.geometrydirectory is the primary project for the geometry server. This is the core engine that performs the actual RhinoCommon and Grasshopper computations requested via the REST API.Use a Hops component in Grasshopper
9.xOnce your Python server is running (e.g., at
http://127.0.0.1:5000/pointat):- Open Rhino and Grasshopper.
- Drop a Hops component onto the canvas.
- Right-click the Hops component and enter the full URL of the component (including the path) into the input field.
- The component will automatically update its inputs, outputs, and icon based on the server's schema.
Configure Hops client timeout
9.xFor long-running calculations, you may need to increase the timeout for the HTTP client used by Hops to communicate with the
rhino.computeserver.This can be configured in the Hops App Settings dialog under Preferences/Solver by entering a value in seconds in the provided textbox.
Default value:
100s.Enable DataTree access in Hops
9.xIn Rhino builds $\ge$ 7.19.22130.15001 and 8.0.22131.04306, DataTrees are supported.
All contextual getter components include a menu item to enable or disable DataTree access. When enabled, this setting overrides the default
AtMostvalue used by Hops for item or list access.Note: This setting has no effect when using the GH Player command.
Generate client libraries with compute.client
9.xThecompute.clientdirectory is used to generate client libraries in C#, Python, and JavaScript. These libraries facilitate communication between your applications and acompute.geometryserver.