Hello,
Our program uses Rhino via COM interface using C#.
In Rhino 5 it worked fine, but it doesn’t work in Rhino 6.
A simple sample programs are shown below.
In Rhino 5, it works fine:
Type type = Type.GetTypeFromProgID("Rhino5x64.Application");
if(type == null)
{
MessageBox.Show("Cannot find the COM type of Rhino5x64.Application");
return;
}
else
{
try
{
object obj = Activator.CreateInstance(type);
Rhino5x64.IRhino5x64Application rhinoApplication = (Rhino5x64.IRhino5x64Application)obj;
rhinoApplication.Visible = 1;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
In Rhino 6, doesn’t work, InvalidCastException occurred:
Type type = Type.GetTypeFromProgID("Rhino.Application");
if (type == null)
{
MessageBox.Show("Cannot find the COM type of Rhino.Application");
return;
}
else
{
try
{
object obj = Activator.CreateInstance(type);
Rhino.IRhinoApplication rhinoApplication = (Rhino.IRhinoApplication)obj;
rhinoApplication.Visible = 1;
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
How to use COM on Rhino 6?
Thanks.