We created a software which can remotely control Rhino from an external software in order to perform a couple of automated tasks. Everything works fine on a local machine. But, when deployed onto a server (Windows Server 2012), Rhino starts as a background task with no User Interface. This creates a lot of troubles in the script since some functions are not available. Rhino is started by calling :
//COM Interface to Initialize Rhino
try
{
string rhinoId = “Rhino5x64.Application”;
System.Type type = System.Type.GetTypeFromProgID(rhinoId);
rhino = System.Activator.CreateInstance(type);
}
Any idea how can I force the system to start an UI?
@Xavier_Ayme, if you do not get an exception from your code, and the variable rhino contains something, please try the advice @jordy1989 gave but open Rhino before. Rhino5x64.Interface worked for me, but only if Rhino is already open.
Two questions:
If you open Rhino 5 manually, do you see the UI on Windows Server 2012 ?
If you then use Rhino5x64.Interface do you get an exception ?
Btw. i once got the same behavior you described in Win7 and solved it by using this code:
# works with Rhino5x64 when open
clsid = System.Guid('4AD5D33E-7576-4C71-BEDC-E174E5DEF0DA')
xType = System.Type.GetTypeFromCLSID(clsid)
objRhino = System.Activator.CreateInstance(xType)
No we don’t get any exception, it works fine but in the background. If we open Rhino manually it works perfectly fine and the UI shows up. We will try instantiating from the GUID and I will come back to you.
If you manage to get the Interface, how do you start Rhino programmatically without using the activator?
If it is not started (i am searching for the process names) then i just call the exe file and wait a few seconds. Then i use my example code above to access it but it only works when Rhino 5 is already open. I’ve reported a few related problems i solved here.
@clement Ok got it. Actually we don’t manage to retrieve the COM object through the Interface when Rhino is already started, we only see a running COM instance in the background but the core program never returns.
EDIT : it works fine on Windows Server 2016 but NOT on 2012. Is there anyone in the (awesome) McNeel developpers team who knows whether Rhino5 is supposed to be compatible w/ WS 2012?
There isn’t any reason why Rhino 5 wouldn’t work on Windows Server 2012, which is based on the Windows 8 platform. Just make sure the server is up-to-date with all Windows service patches and security updates.
Ok, here are our last findings on this issue, : problem is not related to the OS itself (Windows Server 2012) but to the fact that our client program is hosted inside IIS (Internet Information Services). IIS therefore considers that Rhino should be used as a service and doesn’t need a UI.
So, actually, the problem was not coming from the COM protocol, but from the caller itself.