GH_RhinoScriptInterface

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

Methods

AssignDataToParameter

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

BakeDataInObject

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

CloseAllDocuments

#
Close all Grasshopper documents.
public bool CloseAllDocuments()
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

#
Close the currently active Grasshopper document. If there is not active document, nothing will happen.
public bool CloseDocument()
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

#
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.
public void DisableBanner()
Call GrasshopperExampleScript()
Sub GrasshopperExampleScript()
  Dim GH 
  Set GH = Rhino.GetPlugInObject("Grasshopper")
  Call GH.DisableBanner()
  Call GH.ShowEditor()
  Set GH = Nothing
End Sub

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.
public void DisableSolver()
Call GrasshopperExampleScript()
Sub GrasshopperExampleScript()
  Dim GH 
  Set GH = Rhino.GetPlugInObject("Grasshopper")
  Call GH.DisableSolver()
  Set GH = Nothing
End Sub

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.
public void EnableBanner()
Call GrasshopperExampleScript()
Sub GrasshopperExampleScript()
  Dim GH 
  Set GH = Rhino.GetPlugInObject("Grasshopper")
  Call GH.EnableBanner()
  Call GH.ShowEditor()
  Set GH = Nothing
End Sub

EnableSolver

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

HideEditor

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

IsEditorLoaded

#
Returns the loaded state of the Grasshopper Main window.
public bool IsEditorLoaded()
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

#
Returns the visible state of the Grasshopper Main window.
public bool IsEditorVisible()
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

#
Returns the state of the Grasshopper Solver.
public bool IsSolverEnabled()
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

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

LoadedPluginGuids

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

LoadedPluginNames

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

OpenDocument

#
Open a Grasshopper document. The editor will be loaded if necessary, but it will not be automatically shown.
public bool OpenDocument(
filename
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(
ghDoc,
command,
rhinoDoc,
mode
)
obsoletePlease use RunInCommandContext

RunHeadless

#
public void RunHeadless()

RunInCommandContext

#
public Result RunInCommandContext(
ghDoc,
command,
rhinoDoc,
mode
)

RunSolver

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

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.
public bool SaveDocument()
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

#
Save the currently active Grasshopper document in a specific location. If there is no active document, nothing will happen.
public bool SaveDocumentAs(
filename
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

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

SetSliderValue

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

ShowEditor

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