Grasshopper

algorithmic modeling for Rhino

GH Components not loading when starting GH from Rhinoplugin

Hi there, 

I'm trying to automate the starting up of grasshopper from a rhino plugin (C#). 

This is the C# line: 

Rhino.RhinoApp.RunScript("_Grasshopper", true);

The result is that grasshopper starts fine but the standard components are not loaded. 

(see screenshot attached)

- if i start grasshopper normally in rhino it works fine

- i tried different options with the grasshopper .dll files (moving them in the bin) or externally referenced, doesn't make a difference. 

- if i look in GrasshopperDeveloperSettings when i start it like this i also see the path to the default components folder on my windows system with all .gha files is not there. 

(\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\grasshopper\Components\..)

What am i missing? 

Elco

Views: 1010

Attachments:

Replies to This Discussion

So you're saying typing in "_Grasshopper" in the command line manually gives a different result than sending "_Grasshopper" to the command line via RunScript?

I'm not sure there's a difference from Grasshopper's point of view. Both those approaches end up running the exact same command, as indeed they have to because there only is a single command to run.

Is your code doing other stuff immediately after that call to RunScript?

Correct that's exactly what i'm experiencing. 

The rhino plugin code is just this code: 

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
     Rhino.RhinoApp.RunScript("Grasshopper", true);

     return Result.Success;
}

And this results in the screenshot uploaded earlier. 

If i run "GrasshopperDeveloperSettings" next in the command line i see the path to the general components is not there. (even when i click the little button "Valid Folders")

(\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\grasshopper\Components\..)

If i go there i see that's were all the .gha files are. But for some reason they are not loading. 

Is your command allowed to run other commands? Ie. did you set the command style to ScriptRunner? I'm not sure how that could result in such a failed load, but it's something we can check.

Furthermore I don't think _Grasshopper is a transparent command, so it doesn't like being run from within other commands. Again, I'm surprised it half works, I'd expect it to either fail completely or work completely...

Does it work if you put _Grasshopper into your Rhino startup command list?

Hi David and Tom, 

Thanks for all the replies. 

@David, yes i'm using the scriptRunner type of plugin. Other scripted basic rhino commands work fine from the plugin. 

I tested different variants now; 

- Putting _Grasshopper or Grasshopper as a startup command in rhino works (also solves the issue for me now, didn't know this existed.) 

- Putting it in a seperate thread makes no difference for me. Still doesn't load components. 

- Also tested another 5 second sleep after the WriteLine(2) line from Tom. So i'm sure grasshopper has all the time in the other thread. But then grasshopper doesn't start for 5 seconds. 

- Also tried running Rhino as administrator; no difference.

Perhaps it's something to do with if the thread/command that fires grasshopper has access to the directory with basic .GHA components. Since this path dissappears from GrasshopperDeveloperSettings. But my knowlegde of windows rights management lacks a bit here. 

Yes i used the Keystrokes trick. 

Anyhow at least the topic is documented now with some solution directions in case anybody else googles it ;)

Had the same problem, and no solution as well. In my case the canvas itself went crazy after opening any definition. What I wanted to do is to open a definition in grasshopper using RunScript... tried various ways with no success.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service