Com Interface


#1

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”);


(Dale Fugier) #2

Hi @pospis,

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

– Dale


#3

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?


(Dale Fugier) #4

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


#5

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


(Dale Fugier) #6

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


#7

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


#8

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)


(Dale Fugier) #9

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


#10

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


#11

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


(Dale Fugier) #12

Hi @pospis,

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

Thanks,

– Dale


#13

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)


#14

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


(Dale Fugier) #15

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


#16

Hello Dale,

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

Regards,

Michael


(Dale Fugier) #17

Hi @pospis,

I’ve reported this as a bug.

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

Thanks,

– Dale