Hello
Using this we can get data from opened Excel file, can we do the same with Grasshopper?
import System
from System.Runtime.InteropServices import Marshal
excel = Marshal.GetActiveObject("Excel.Application")
I tried this but didn’t work:
rhino = Marshal.GetActiveObject("Rhin7.Application")
grasshopper = Marshal.GetActiveObject("Rhin7.Grasshopper.Document")
gankeyu
(Keyu Gan)
2
Marshal.GetActiveObject
works only on COM objects.
It may work for Rhinoceros but definitely not for Grasshopper. Grasshopper is a .NET library and doesn’t expose COM visibility correctly IIRC.
2 Likes
dale
(Dale Fugier)
3
Hi @anon39580149,
If you want to hook into a running Rhino, get a Rhino.Interface
object. Otherwise, get a Rhino.Application
object.
– Dale
1 Like
Hi @dale , thank you
Sadly the same error message
gankeyu
(Keyu Gan)
5
Are you trying to fetch a Rhino instance inside Rhino (say Grasshopper’s Python component)?
No this is just a confirmation , i tried first in an external Ironpython