Running a Grasshopper file as a service

Hi, I am currently exploring the possibility of creating a Python script that runs a Grasshopper file as a service.

In my investigation, I have reviewed various Rhino.Inside resources and found examples demonstrating how to execute simple Grasshopper files, such as performing basic arithmetic operations and outputting the results. These examples typically involve loading the Grasshopper definitions and executing them sequentially within a loop. However, I am interested in a different approach where the Grasshopper file is loaded and executed similarly to how it is done manually when we open and execute grasshopper in Rhino’s UI. Ideally the python script would be structured like:

import packages → load the → execute the loaded

I am wondering on whether the solution I am attempting to implement using Rhino.Inside in Python is feasible. If it is, I would appreciate guidance on what steps may be necessary to successfully implement this logic. Alternatively, if this approach is not viable, I would like to explore alternative solutions.

Additionally, I am aware that there were limitations in the past regarding the use of Grasshopper Python components with Rhino.Inside (as discussed here: Run/Solve a Grasshopper file without starting Rhino CPython Rhino.Inside - #10 by nathanletwory). I am curious to know if these limitations have been addressed, and if it is now possible to use Grasshopper Python components with Rhino.Inside.

Thanks in advance

There is a discussion about Rhino inside Python

But if it is a Service, then Hops or Compute can be used to solve grasshopper definitions as a service:

  1. Hops Component solve Grasshopper remotely
  2. Compute a HTTP Rhino Grasshopper endpoint
1 Like

Hi Scott, thanks for the quick response, indeed there is a topic about the subject, I’ll make sure to address further questions regarding rhino.inside in that topic.

Also thanks for providing different solutions for running grasshopper as a service, I’ll now be shifting my focus on those two options. Does that mean that rhino.inside doesn’t have the ability to run as a service? Also, Do any of the mentioned solutions offer something similar in order to implement the previous logic?

Depends what you mean as a service. Both of these projects happen to be able to used as pre-packaged services.

Compute for instance is Rhino.Inside running inside an HTTP service (Nancy Fx).

Hops by default calls out to a Rhino.Inside service running locally on the computer. And that local service is available on any computer that has Rhino.

Both these projects are open source so they can serve as samples to see how it is done.

Rhino.inside does needs to be wrapped in something to act as a service. That could be Python as you originally planned.

1 Like