Quantcast
Channel: Rhino Developer - McNeel Forum
Viewing all articles
Browse latest Browse all 8664

Fail to get IRhinoApplication from COM Object in Rhino 6

$
0
0

@archinate1 wrote:

Hello,
I have a tool that I am migrating from Rhino 5x64 to Rhino 6. My Rhino 5x64 tool uses IRhinoApplication as follows:

Type type = Type.GetTypeFromProgID(“Rhino5x64.Application”);
dynamic rhino = Activator.CreateInstance(type);
IRhino5x64Application RhinoApp = rhino as IRhino5x64Application;

This is the code I am using for Rhino 6 COM is:

Type type = Type.GetTypeFromProgID(“Rhino.Application.6”);
dynamic rhino = Activator.CreateInstance(type);
IRhinoApplication RhinoApp = rhino as IRhinoApplication;

Activator.CreateInstance returns a COM object. However, casting the “rhino” as IRhinoApplication (Rhino 6) returns null.

If I try to do a something like:

IRhinoApplication RhinoApp = rhino;

Then I get:

{“Unable to cast COM object of type ‘System.__ComObject’ to interface type ‘Rhino.IRhinoApplication’. This operation failed because the QueryInterface call on the COM component for the interface with IID ‘{9837542C-DC30-4EBE-BA30-B6EBDF471508}’ failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).”}

What is the recommended set up for Rhino 6?

Any help is appreciated!
-Nate

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 8664

Trending Articles