External Access to Rhino 7

I’m trying to access Rhino 7 using VBA in Office 365 Excel. I found this link but cannot seem to get the macros to access Rhino: https://developer.rhino3d.com/api/rhinoscript/introduction/external_access.htm

Any help with this would be greatly appreciated. workflow would be this:

Python macro from Rhino opens Excel workbook.

User would fill out a form in Excel to update values to be pushed to Rhino macro.

I would like a button in Excel that would run a Python macro residing in Rhino to transfer values from a sheet and perform some tasks in Rhino.

Macro would run in Rhino and Rhino would close Excel.

I have code for everything except the code to instigate the Python macro in Excel.

Eric

I’ve had some success on my own using the following code in Excel:

' Try creating a Rhino Application object
Option Explicit

Sub GetRhino()

Dim Rhino As Object
Dim objRhinoScript As RhinoScript

On Error Resume Next

'Set Rhino to Running Rhino
Set Rhino = CreateObject("Rhino.Interface.7") 'Set Rhino = CreateObject("Rhino.Application")
If VBA.IsNull("False") Then Exit Sub
Rhino.Visible = True

'Try getting RhinoScript object
Set objRhinoScript = Rhino.GetScriptObject


objRhinoScript.Command "_Line"

If Err.Number <> 0 Then

  VBA.MsgBox "Failed to create Rhino object."

  Exit Sub

End If

VBA.MsgBox "Rhino object created."

End Sub
1 Like