我看了说是要应用SolidWorks API SDK
http://www.cnblogs.com/liong/archive/2008/05/21/1204404.html
照着这个做了一下 结果发现com组件引用不了
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swconst;
namespace WebApplication1
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Command(object sender, CommandEventArgs e)
{
int IErrors = 0;
int IWarnings = 0;
SolidWorks.Interop.sldworks.SldWorks swApp = new SolidWorks.Interop.sldworks.SldWorks();
swApp.OpenDoc6(@"E:\a.SLDPRT", (int)SolidWorks.Interop.swconst.swDocumentTypes_e.swDocPART, (int)SolidWorks.Interop.swconst.swOpenDocOptions_e.swOpenDocOptions_Silent, null, ref IErrors, ref IWarnings);
swApp.Visible = true;
}
}
}
最后发现
检索 COM 类工厂中 CLSID 为 {88CEE7FD-9F58-4962-8483-041AB9AD69A2} 的组件失败,原因是出现以下错误: 80040154 没有注册类 (异常来自 HRESULT:0x80040154 (REGDB_E_CLASSNOTREG))。
我注册了啊