RhinoScript's Grasshopper Methods List?


#1

Hi, I have just learned that Grasshopper can be controlled via RhinoScript using:
Dim GH
Set GH = Rhino.GetPlugInObject(“Grasshopper”)
and then ‘GH.Methods’

Is there a list of all the methods exposed to RhinoScript available?
I was only able to find bits and pieces of it on Grasshopper3D forum.

Jarek


How to create a button in Rhino that launches a specific Human UI/GH script
(Steve Baer) #2

Using the following python script

import Rhino

gh = Rhino.RhinoApp.GetPlugInObject("Grasshopper")
for func in dir(gh):
    if not func.startswith('_'): print func

I get the output of
AssignDataToParameter
BakeDataInObject
CloseAllDocuments
CloseDocument
DisableBanner
DisableSolver
EnableBanner
EnableSolver
HideEditor
IsEditorLoaded
IsEditorVisible
IsSolverEnabled
LoadEditor
MemberwiseClone
OpenDocument
ReferenceEquals
RunSolver
SaveDocument
SaveDocumentAs
SetSliderRangeAndValue
SetSliderValue
ShowEditor

I don’t know what the parameters are, but that is the quick list :smile:


Escaping spaces in command line file paths
Run grasshopper from python/Rhinocommon
#3

Hi Steve, that is a great start. Thanks!
Now, for the parameters / help - I’d be very interested in knowing more about these methods or some usage examples (if they exist).


(Steve Baer) #4

I’m sure @DavidRutten has a documented list somewhere; I’m just being a goofball and showing off how to do stuff like this in python :wink:

I tweaked the python script to

import Rhino
import System

gh = Rhino.RhinoApp.GetPlugInObject("Grasshopper")
t = gh.GetType()
methods = System.Type.GetMethods(t)
for method in methods:
    print method

And now get
Boolean IsEditorLoaded()
Boolean IsEditorVisible()
Void LoadEditor()
Void ShowEditor()
Void HideEditor()
Void EnableBanner()
Void DisableBanner()
Boolean IsSolverEnabled()
Void EnableSolver()
Void DisableSolver()
Void RunSolver(Boolean)
Boolean OpenDocument(System.String)
Boolean CloseDocument()
Boolean CloseAllDocuments()
Boolean SaveDocument()
Boolean SaveDocumentAs(System.String)
Boolean AssignDataToParameter(System.String, System.Object)
Boolean SetSliderValue(System.String, Double)
Boolean SetSliderRangeAndValue(System.String, Double, Double, Double)
System.Object BakeDataInObject(System.String)


#5

Steve, thanks again. I know Python is much more powerful than RS and thanks for the constant reminders :wink:
I will ask @DavidRutten on GH forum for the full list/some sort of documentation of this.