Grasshopper

algorithmic modeling for Rhino

How can I run a specific grashopper file from the rhino command line? Is it possible to run it from another external program (.exe) programmed in .net (that´s what I´m trying)? (Rhino it´s easy, but GH?)
My program automatically opens a rhino file and I´ll also need to open a certain grasshopper file.

Thanks in advance!!!

Views: 5093

Replies to This Discussion

This isn't possible at present. Grasshopper cannot be scripted from the command line. I'll put this on the list of things to add. I'll also add RhinoScriptability.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
Thank you very much. It will be really really handy in order to have a total connection with GH

best regards!
I added very simple command scripting to the next release. It allows you to show/hide/toggle the Grasshopper window, to enable/disable/toggle the Grasshopper solver and to open/close a Grasshopper file. Just use the hyphen in front of the Grasshopper command to access these options.

Somehow I suspect this will not be adequate, but I'd rather put the complicated controls into a RhinoScript library than a command-line interface.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
Interesting advances!
I also just added a rudimentary RhinoScript interface. So now you can do stuff like:


Option Explicit

Call Main()
Sub Main()
     Dim GH
     Set GH = Rhino.GetPlugInObject("Grasshopper")

    Call GH.DisableBanner()
     Call GH.ShowEditor()

     Call Rhino.Print("Loaded:" & GH.IsEditorLoaded())
     Call Rhino.Print("Visible:" & GH.IsEditorVisible())
     Call Rhino.Print("Enabled:" & GH.IsSolverEnabled())

     Call GH.OpenDocument("C:\testfile.ghx")
     Call GH.SaveDocumentAs("C:\backup [" & Hour(Now()) & Minute(Now()) & "].ghx")
End Sub



There is a lot I can expose like this, so it might be interesting to see where it goes.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
This is good, would it be possible to load a file and bake it's result using this?

J.

Hi David,

It looks really promising, thank you!

I wonder if you, guys, would be so nice to help me with the thing I am working on right now? Maybe it's a trival qestion, but I don't now how to do it yet.

I would like to open (through the windows cmd) Rhino->Grasshopper->specific file, let it run once and close everything down. So far, I can open Rhino but am experiencing problems with opening a specific GH file.

Could you please explain me how to do it?

Thanks in advance,

Ewa

It is very easy .You could try FileSystemWatcher class.
//___________________________________________________

void watcher_FileCreated(object sender, FileSystemEventArgs e)
{
file += 1;
RedefineSolution();
}
FileSystemWatcher watcher;
public int file = 0;
bool sign = true;

public void RedefineSolution(){
owner.ExpireSolution(true);
}
public Script_Instance(){
watcher = new FileSystemWatcher();
if(sign == true){
watcher.Filter = "*C.txt";
watcher.Changed += new FileSystemEventHandler(watcher_FileCreated);
watcher.Path = "F:";
watcher.EnableRaisingEvents = true;
sign = false;}
}

Hi panhao, i'm working on this subject,

Can you tell me what language you use ?

 

The question is to write a script to outdoor GH but interacting with.

Hi all!

I realize this thread is very old, but is it possible to do this now? Is there more functionality, like changing sliders and toggles? Any current advice or resources on the subject would be appreciated... thanks!

Hi all!

I realize this thread is very old, but is it possible to do this now? Is there more functionality, like changing sliders and toggles? Any current advice or resources on the subject would be appreciated... thanks!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service