Embedding Rhino viewports in standalone C++ MFC app

Hello everyone,

hope doing everything correct, since this is my first post in this forum, otherwise please tell me…

I searched among the existing topics but I was not able to found an answer to my question, so I’ll explain you my idea and needing.

I have a C++ MFC based app developed in windows with its own user interface. It performs several tasks on .STL files and, until now, it does not need any 3d graphic interaction with the user (I mean the user just gives the path of the .STL file and the app performs its own calculation with no graphic output). Now I need to implement a new functionality in the app: for this functionality the user must select manually a few vertices of the STL file and some other geometric elements. Therefore I was wondering if Rhino could do this…

I already implemented the Rhino Automation thanks to the example provided with the SDK, so now my standalone app is able to “call” rhino with automation; so, finally, the question is: is it possible to embed the Rhino graphic area (the viewports) in my standalone application (the Rhino viewport should be a window of my app) so that the user can interact with an imported .STL file?

Hope you can help me and hope to become an active member of the forum to help some other one!

Why not making a rhino plugin?
If you are referencing rhino why not use it to develop your application ?

Thanks for you answer

Hello, sure, it coule be a nice and fast solution in a lot of situations.

I created some Rhino plugins and I think these are a powerful tool. In my experiments, I also created a skin for Rhino. However, in this case it would be difficult to create a plugin, because the app in which I would like to embed the Rhino viewports has its own complex graphical user interface (with a ribbon). Moreover, I would like to have a unique app in which performing all the operations I need, and pouring all the code in a new plugin could be a too long (and maybe tricky) process, and at the end I would not obtain the same graphical appearance. Hope I’ve been clear enough, otherwise let me know

Hi @g_v_c,

There may be a way of doing this with Rhino.Inside. But I wouldn’t be able to tell you how…

– Dale

We have a sample showing how this can be done with Rhino.Inside in .NET.

If that is the type of functionality you are looking for, we can probably help

Hello Steve, hello Dale,

first of all thank you for your answers.

Yes, I think that Rhino.Inside is exactly the thing I need. I’ve looked through the samples and it seems to be what I need. Didn’t know about Rhino.Inside, thank you.

The only problem (on my side, of course) is that I’m expert only in C++. Would it be possible to use Rhino.Inside in a C++ (and MFC) based app?


You seem to be doing perfectly :slight_smile: Welcome to the forum and keep up the good work !

Yes, that is the problem. Technically I know this is is possible, but I don’t know when we will have the time to research the topic and create a sample.

Probably the first thing to do is compile and test the C# sample that I posted a link to. Does this sample even do what you were hoping to get out of an embedded Rhino viewport? If there is functionality you need beyond what that sample provides, it would be good to know what that is.

Ok, thanks Steve.

I just succeeded in building the sample you posted the link to (see attached image).

This app does more or less what I need. But I also would need the possibility for the user to interact with the imported geometry (for example selecting some nodes of a mesh or a curve or surface of a brep with a mouse click); later the code inside my application will process such selections (sometimes using Rhino methods, as I do in plugins) to obtain some results. I would also like to be able to import common CAD format as Rhino does and not only .3dm files.

Any chance to obtain such features (maybe in C++ :slight_smile: )?

I do think this is all technically possible, but probably too far out in the future to be useful for you. Importing common CAD formats would be an easy addition; interacting with geometry and running some commands sounds like a much bigger project.

Ok Steve, I see.

Then maybe I’ll go for a Rhino skin + plugin configuration for now!

Thank you for your answers!

Regarding the skin I’d have a question: how can I totally hide the Rhino icon when I launch the skin? I mean, when I double click on the shortcut that launch Rhino with the scheme pointing to my skin it happens that for a while the Rhino icon appears on the taskbar and only later my on custom icon replaces it. How can I avoid that?

I believe what you describe is controlled by Windows and out of our control.

– Dale

We might be able to solve this by adjusting Rhino.Inside to load as a full blown application, just with a different start-up exe. We would need to experiment.