Hi everyone!
I’m new to Rhino (but loving what I’m seeing so far!) and am trying to automate some tasks with a console application. I came across the examples within the docs and by @dale, and was having some issues when checking whether a Rhino instance had been created or not.
The C# code segment from the docs is this:
// Try creating an instance of Rhino
dynamic rhino = null;
try
{
//string rhinoId = "Rhino5.Application";
string rhinoId = "Rhino5x64.Application";
System.Type type = System.Type.GetTypeFromProgID(rhinoId);
rhino = System.Activator.CreateInstance(type);
}
catch
{
}
if (null == rhino)
{
Console.WriteLine("Failed to create Rhino application");
return;
}
But it is getting caught on this check and exiting the process early.
if (null == rhino)
{
Console.WriteLine("Failed to create Rhino application");
return;
}
If I remove this check, everything appears to work correctly - i.e. I can run scripts etc. So, I’d like to work out what is wrong with the check, and how to fix it if possible.
Does anyone have any suggestions as to why the null comparison is true, or have an equivalent workaround?
Cheers