Grasshopper

algorithmic modeling for Rhino

Is it possible to automate a GH definition by calling a GH definition from a C# or python program?

I may not be asking the question in the right way.

The goal is to have a program (C#, python, vb?) to run on a server (back end).

A user would input/upload a file; a GH def is called with a a file path (image), and GH outputs the new geometry.

I am not sure if what I am asking makes sense... I may not be using the correct terminology.

Thanks!

Views: 2330

Replies to This Discussion

Hi Gui,

yes, this is possible. It is relatively easy to control Grasshopper (opening files, running solutions, harvesting data) from within Grasshopper. Basically you create a GHA project which doesn't add any new components but which does sit inside Grasshopper and can respond to outside calls. How you solve this (writing/reading files, WCF, servers, Google App Engine, ...) is up to you and probably depends on what sort of things you can do from the other end of this system.

If you have specific questions about how to load files, trigger solutions and harvest data, I can help with those.

--

David Rutten

david@mcneel.com

Tirol, Austria

Hi David,

I'm a developer working on a project with Gui. Essentially what we aim to determine is if there is a way to:

invoke rhino and grasshopper from the command line such that:

-parameters can be passed to a grasshopper script (then perhaps additional params read from database)

-a model can be generated from those params

-an output file (stl) can be created and saved to disk

-all without the GUI instantiated?

We want to run this from a webserver and have it scale.

Do you know if anyone is doing this and how are they tackling this specific issue?

The GUI will probably have to be loaded, Grasshopper was never designed to run in the background and too many things can go wrong if you try to use it without the window. However it can all be automated.

 

You can start Rhino with a script using the /runscript argument as per this page.

If that script then loads Grasshopper and you have a GHA that is loaded into Grasshopper, you can then start getting information, opening files, running solutions, harvesting data and sending it somewhere else.

I'd imagine you'd create a GHA which knows where to look for input data, reads that data, opens a specific GH file, set slider or parameter values, runs a solution, bakes geometry in certain parameters, then run the Rhino _Export command with STL format.

It's a reasonable amount of work that depends on several parts all being where they are supposed to be, but in theory it's doable.

The biggest problem I think is how to get the data from wherever it is now into Grasshopper. Are you going to use a file on a disc? WCF? Download the data from a url?

I'm not sure exactly what you mean by "have it scale".

--

David Rutten

david@mcneel.com

David,

Can you give me any direction on the question of scalability for use on the backend of a webserver? Any info would be very helpful.

Cheers,

Justin

Any updates on this ? I'm trying to do something similar. Help would be appreciated. 

Thanks

Hi David,

I am happy to know that there is a solution, could you please help us with some sample code for the same, really appreciable, i am also looking for this.

Thanks in Advance

Sai

Hi Sai,

I have the similar idea like u. I want to create a loop: calling .gh definition and ouputting the information to txt which I have already set in the .gh file.

Thanks,

Lucas

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service