我在 Unity3D 中制作了一个产品配置器。我希望我的配置器的 Windows 版本与 Autodesk Inventor 进行通信,以制作配置产品的生产图纸。
我制作了一个 DLL 文件并将其作为插件统一使用:
namespace InventorInterface
{
public class InventorConnection
{
private Inventor.Application InventorApplication;
public InventorConnection()
{
InventorApplication = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application") as Inventor.Application;
}
public String FileName()
{
if (null != InventorApplication)
{
return InventorApplication.ActiveDocument.File.ToString();
}
return "Not Connected to Inventor!";
}
}
}
我在 Unity 中的脚本如下所示:
public class InventorConnection : MonoBehaviour {
// Use this for initialization
void Start () {
InventorInterface.InventorConnection Connection = new InventorInterface.InventorConnection ();
string File = Connection.FileName ();
}
}
但是当我运行我的项目时,我收到了这条消息:
NotImplementedException:请求的功能未实现。System.Runtime.InteropServices.Marshal.GetActiveObject (System.String progID) (在 /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs:317) InventorInterface.InventorConnection。 .ctor () InventorConnection.Start () (在 Assets/Scripts/Inventor/InventorConnection.cs:10)
我怎样才能让它工作?