GH_RhinoScriptInterface

[ComVisible(true)] public class GH_RhinoScriptInterface
Plugin Interface object that is exposed via the RhinoScript layer.

Methods

AssignDataToParameter

#
public bool AssignDataToParameter(string parameterID, object data)
Find a parameter and assign some persistent data.
parameterID (string)Instance ID of parameter or parameter name.
data (object)Data to assign.
True on success, false on failure.

BakeDataInObject

#
public object BakeDataInObject(string objectID)
Find an object and bake all geometry inside of it.
objectID (string)Object InstanceID or name.
An array of Rhino object IDs, or null on failure.

CloseAllDocuments

#
public bool CloseAllDocuments()
Close all Grasshopper documents.
True on success, false on failure.
Call GrasshopperExampleScript()
Sub GrasshopperExampleScript()
  Dim GH 
  Set GH = Rhino.GetPlugInObject("Grasshopper")
  Call GH.CloseAllDocuments()
  Set GH = Nothing
End Sub

CloseDocument

#
public bool CloseDocument()
Close the currently active Grasshopper document. If there is not active document, nothing will happen.
True on success, false on failure.
Call GrasshopperExampleScript()
Sub GrasshopperExampleScript()
  Dim GH 
  Set GH = Rhino.GetPlugInObject("Grasshopper")
  Call GH.CloseDocument()
  Set GH = Nothing
End Sub

DisableBanner

#
public void DisableBanner()
Disables the display of the Grasshopper banner during Component loading. The banner is typically only shown once during a Grasshopper session, namely when the Editor is first loaded.
Call GrasshopperExampleScript()
Sub GrasshopperExampleScript()
  Dim GH 
  Set GH = Rhino.GetPlugInObject("Grasshopper")
  Call GH.DisableBanner()
  Call GH.ShowEditor()
  Set GH = Nothing
End Sub

DisableSolver

#
public void DisableSolver()
Disables the Grasshopper Solver. If the Solver is disabled, expired components and parameter will not be recomputed, though any existing solution will remain intact.
Call GrasshopperExampleScript()
Sub GrasshopperExampleScript()
  Dim GH 
  Set GH = Rhino.GetPlugInObject("Grasshopper")
  Call GH.DisableSolver()
  Set GH = Nothing
End Sub

EnableBanner

#
public void EnableBanner()
Enables the display of the Grasshopper banner during Component loading. The banner is typically only shown once during a Grasshopper session, namely when the Editor is first loaded.
Call GrasshopperExampleScript()
Sub GrasshopperExampleScript()
  Dim GH 
  Set GH = Rhino.GetPlugInObject("Grasshopper")
  Call GH.EnableBanner()
  Call GH.ShowEditor()
  Set GH = Nothing
End Sub

EnableSolver

#
public void EnableSolver()
Enables the Grasshopper Solver. If the Solver is enabled, expired components and parameter will be recomputed.
Call GrasshopperExampleScript()
Sub GrasshopperExampleScript()
  Dim GH 
  Set GH = Rhino.GetPlugInObject("Grasshopper")
  Call GH.EnableSolver()
  Set GH = Nothing
End Sub

HideEditor

#
public void HideEditor()
Hide the main Grasshopper Editor. If the editor hasn't been loaded or if the Editor is already hidden, nothing will happen.
Call GrasshopperExampleScript()
Sub GrasshopperExampleScript()
  Dim GH 
  Set GH = Rhino.GetPlugInObject("Grasshopper")
  Call GH.HideEditor()
  Set GH = Nothing
End Sub

IsEditorLoaded

#
public bool IsEditorLoaded()
Returns the loaded state of the Grasshopper Main window.
True if the Main Grasshopper Window has been loaded.
Call GrasshopperExampleScript()
Sub GrasshopperExampleScript()
  Dim GH 
  Set GH = Rhino.GetPlugInObject("Grasshopper")
  Call Rhino.Print("Grasshopper Editor Loaded: " & GH.IsEditorLoaded())
  Set GH = Nothing
End Sub

IsEditorVisible

#
public bool IsEditorVisible()
Returns the visible state of the Grasshopper Main window.
True if the Main Grasshopper Window has been loaded and is visible.
Call GrasshopperExampleScript()
Sub GrasshopperExampleScript()
  Dim GH 
  Set GH = Rhino.GetPlugInObject("Grasshopper")
  Call Rhino.Print("Grasshopper Editor Visible: " & GH.IsEditorVisible())
  Set GH = Nothing
End Sub

IsSolverEnabled

#
public bool IsSolverEnabled()
Returns the state of the Grasshopper Solver.
True if the Grasshopper Solver is enabled.
Call GrasshopperExampleScript()
Sub GrasshopperExampleScript()
  Dim GH 
  Set GH = Rhino.GetPlugInObject("Grasshopper")
  Call Rhino.Print("Grasshopper Solver Enabled: " & GH.IsSolverEnabled())
  Set GH = Nothing
End Sub

LoadEditor

#
public void LoadEditor()
Load the main Grasshopper Editor. If the editor has already been loaded nothing will happen.
Call GrasshopperExampleScript()
Sub GrasshopperExampleScript()
  Dim GH 
  Set GH = Rhino.GetPlugInObject("Grasshopper")
  Call GH.LoadEditor()
  Set GH = Nothing
End Sub

LoadedPluginGuids

#
public Guid[] LoadedPluginGuids()
Gets an array of the IDs of all loaded plugins.

LoadedPluginNames

#
public string[] LoadedPluginNames()
Gets an array of the names and versions (if known) of all loaded plugins.

OpenDocument

#
public bool OpenDocument(string filename)
Open a Grasshopper document. The editor will be loaded if necessary, but it will not be automatically shown.
filename (string)Path of file to open (must be a *.gh or *.ghx extension).
True on success, false on failure.
Call GrasshopperExampleScript()
Sub GrasshopperExampleScript()
  Dim GH 
  Set GH = Rhino.GetPlugInObject("Grasshopper")
  Call GH.OpenDocument("C:\ExampleFile.ghx")
  Set GH = Nothing
End Sub

RunAsCommand

#
public Result RunAsCommand(GH_Document ghDoc, Command command, RhinoDoc rhinoDoc, RunMode mode)
obsoletePlease use RunInCommandContext
ghDoc (GH_Document)
command (Command)
rhinoDoc (RhinoDoc)
mode (RunMode)

RunHeadless

#
public void RunHeadless()

RunInCommandContext

#
public Result RunInCommandContext(GH_Document ghDoc, Command command, RhinoDoc rhinoDoc, RunMode mode)
ghDoc (GH_Document)
command (Command)
rhinoDoc (RhinoDoc)
mode (RunMode)

RunSolver

#
public void RunSolver(bool expireAllObjects)
Runs the solver once, even if the global solver lock is on.
expireAllObjects (bool)If true, will expire all objects in the current document.

SaveDocument

#
public bool SaveDocument()
Save the currently active Grasshopper document. If the active document has never been saved, a Save... dialog will be shown. If there is no active document, nothing will happen.
True on success, false on failure.
Call GrasshopperExampleScript()
Sub GrasshopperExampleScript()
  Dim GH 
  Set GH = Rhino.GetPlugInObject("Grasshopper")
  Call GH.SaveDocument()
  Set GH = Nothing
End Sub

SaveDocumentAs

#
public bool SaveDocumentAs(string filename)
Save the currently active Grasshopper document in a specific location. If there is no active document, nothing will happen.
filename (string)Path of file to save to (must be a *.gh or *ghx extension).
True on success, false on failure.
Call GrasshopperExampleScript()
Sub GrasshopperExampleScript()
  Dim GH 
  Set GH = Rhino.GetPlugInObject("Grasshopper")
  Call GH.SaveDocumentAs("C:\GrasshopperBackup\[" & Hour(Now()) & "][" & Minute(Now()) & "][" & Second(Now()) & "].ghx")
  Set GH = Nothing
End Sub

SetSliderRangeAndValue

#
public bool SetSliderRangeAndValue(string sliderID, double value, double minimum, double maximum)
Find a slider and assign a new value.
sliderID (string)Slider ID.
value (double)New value. If the value exceeds the limits, it will be clipped.
minimum (double)New slider minimum.
maximum (double)New slider maximum.
True on success, false on failure.

SetSliderValue

#
public bool SetSliderValue(string sliderID, double value)
Find a slider and assign a new value.
sliderID (string)Slider ID.
value (double)New value. If the value exceeds the limits, it will be clipped.
True on success, false on failure.

ShowEditor

#
public void ShowEditor()
Show the main Grasshopper Editor. The editor will be loaded first if needed. If the Editor is already on screen, nothing will happen.
Call GrasshopperExampleScript()
Sub GrasshopperExampleScript()
  Dim GH 
  Set GH = Rhino.GetPlugInObject("Grasshopper")
  Call GH.ShowEditor()
  Set GH = Nothing
End Sub