Com Interface

Hello,
we try to connect our software with an open Rhino 6.4 and it doesn’t succeed.
If we connect to Rhino 6.1 it works.
We use the com-interface with VS C++.
With older versions (Rhino 4 /Rhino 5) we haven’t any problems.

Code:
OleInitialize(NULL);
IRhinoInterfacePtr m_pRhino6Interface_64;
m_pRhino6Interface_64.CreateInstance(_T(“Rhino.Interface”);

Hi @pospis,

You might take a look at the SampleAutomationClient project in our developer samples repository on GitHub.

– Dale

Hello Dale,
our code works with every installed Rhino (Rhino4, Rhino5, Rhino 6.1).
But it doesn’t work with latest Rhino 6.4.
What could be the reason?

Hi @pospis,

I am not sure, as you have not provided a full working sample.

Did the sample code, I referenced, work for you?

– Dale

Hello Dale,

following code works on my developer computer (Win7, VS12, MFC-Project).

Output is “ok”.

If I try to connect on an other computer the result is always “not connected”.

We tried on win7 and win10.

Rhino version is 6.7.18199.22081, 18.07.2018 Evaluation.

We found the necessary Win-Registrty entries on all computer.

Maybe you have an idea?

#import "rhino/rhino6/Rhino.tlb" no_namespace

void CRhino6TestDlg::OnBnClickedButton1()

{

    OleInitialize(NULL);

    IRhinoInterfacePtr pRhino6Interface;

    if (SUCCEEDED(pRhino6Interface.CreateInstance(_T("Rhino.Interface.6")))) {

        MessageBox(_T("ok"));

    }

    else{

        MessageBox(_T("not connected"));

    }

}

Best regards,

Michael

Hi @pospis,

I don’t have Visual Studio 2012 installed. But this sample, written with Visual Studio 2017 work as expected.

TestRhinoCom.zip (63.7 KB)

– Dale

Hello Dale,

thank you for your help.

Unfortunately I haven’t VS2015 installed. So I can’t see your project settings.

So I ask you:

Is it a x64 project?

Where can I find my source code (from my mail) ?

Can you send me a compilated exe file, so I can try out on the computer on which it doesn’t work.

Best regards,

Michael

Hello Dale,

here is my VS12 (2013) project.

Maybe you can check if it’s working.

Problem is, it works on the developer computer but not on any other.

Best regards,

Michael

Rhino6Test.zip (3.38 KB)

Hi @pospis,

I attached the source to a sample project to my prior reply. Even if you cannot use th proejct settings, you can use the source code.

If your appplication works on one system and not another, then repair the Rhino installation on the system that isn’t working. From Control Panel, pick Programs and Features > Rhino 6 > Change. When the Rhino installer dialog appears, click “Repair”.

– Dale

Hello Dale,

we used our source code since Rhino 4. It worked for years. No problems with Rhino 5.

Only with Rhino 6 we have the problem that it will run only on the developer computer.

I don’t think that the source code is the problem. But what is the problem? Maybe the project settings? x64, Unicode, MFC static or shared. I don’t know.

Repairing the Rhino installation didn’t help.

Michael

Hi Dale,

we now installed VS on a computer where the interface to Rhino isn’t running.

While debugging we found following:

The call “QueryInterface…” quits on my developer computer with “S_OK”.

On the second computer it quits with “E_NOINTERFACE”.

What have we to do to provide the interface ?

Best regards,

Michael

Hi @pospis,

Can you post your complete test project - you’ve only provided your solution file.

Thanks,

– Dale

Hello Dale,

you can find my test project in the attachment.

But I think there is no problem with the project.

If I debug this project I get E_NOINTERFACE as result on some computer (I deescribed it in my last mail).

Maybe there is a need to register the tlb file in the win registry?

Some times ago, we had the same problem with ProgeCAD. They told us we have to start ProgeCAD once as admin for register the tlb file. Then it worked.

Best regards,

Michael

Rhino6Test.zip (71.9 KB)

Hello Dale,

I found a solution for our problem:

The com-interface works if we register the rhino.tlb with regtlibv12.exe .

The problem is, it needs admin rights. So it would be difficulty to provide this solution for our customers.

I think there should be a solution during the installation of rhino.

In Rhino 4 and Rhino 5 it was not necessary to to that manually.

What do you think about that?

Best regards,

Michael

Hi @pospis,

I’m pretty sure both Rhino.tlb and RhinoScript.tlb are registered by the Rhino installer. I’ll check the the installer developer to verify.

Also, I’ve written my one type library registration tool, which you are welcome to use.

– Dale

Hello Dale,

we have Rhino (test version) installed on 4 computer. It was not registered on any (Win7 and Win10).

Regards,

Michael

Hi @pospis,

I’ve reported this as a bug.

https://mcneel.myjetbrains.com/youtrack/issue/RH-47742

Thanks,

– Dale

Hi Dale,

I’m the collaegue of Michael. There are still problems in this topic. From the link you posted
https://mcneel.myjetbrains.com/youtrack/issue/RH-47742
we can’t see that the bug is fixed so far. Also the manual registration doesn’t work satisfiying in all cases.
Furthermore after the installation of Rhino7 one of our customer can’t use the interface to Rhino6 anymore.
Would be great to have a solution soon.

Kind Regards,
Olaf

To create a Rhino 6 COM object, use one of the following class IDs:

Rhino.Application.6
Rhino.Interface.6

To create a Rhino 7 COM object, use one of the following class IDs:

Rhino.Application.7
Rhino.Interface.7

To just create a Rhino COM object based on the “current version”, use one of the following class IDs:

Rhino.Application
Rhino.Interface

Hope this helps.
– Dale

Hi Dale,

Thank you very much for your quick response. We do it like you described since Rhino4! The first problems occurs since Rhino6 (see conversation so far). Maybe you could contact your colleage BrianG for further details. As far I understand from the protocol:
https://mcneel.myjetbrains.com/youtrack/issue/RH-47742
the bug fix is shifted from one release to another. But of course I might interpretate it wrong.

Kind regards,
Olaf