Grasshopper

algorithmic modeling for Rhino

I'm trying to open a specific grasshopper file using the rhinopython editor. It seems to be possible using rhinoscript, from this old discussion: http://www.grasshopper3d.com/forum/topics/run-a-grashopper-file-fro....

Alternatively, I tried to use the rhinoscriptsyntax.Command() method to open the file, like so:

import rhinoscriptsyntax as rs

rs.Command("-Grasshopper")
rs.Command("D")
rs.Command("O")
rs.Command("C:\Saeran\Academic year\THESIS\framework\framework_prototyping_4.gh")

But it's giving me an "Unknown Command" error. 

Is it possible to do this using the python editor? I'm trying to batch open multiple files, so I can reduce my daily workflow. 

Saeran

Saeran

Views: 1948

Replies to This Discussion

Can you access Grasshopper.Plugin.GH_RhinoScriptInterface?

You can call those methods directly, circumventing RhinoScript and Rhino commands.

--

David Rutten

david@mcneel.com

Hi Saeran,

in addition to what David says, as it stands, your method is also work fine for this task. Just check that you give all information in one call, like so:

import rhinoscriptsyntax as rs

command = "-_Grasshopper _E _S _D _O \"{0}\" _Enter"
location = "C:\\path\\to\\my\\file.gh"
everything = command.format(location)

rs.Command(everything)

I hope this helps,

Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

Thank you David and Giulio,

I think the Grasshopper.Plugin.GH_RhinoScriptInterface method is a bit beyond me at this point, but I was able to get it working perfectly using the corrected script Giulio provided.


This'll save me 5 minutes per day :)

S

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service