/* ============================================================================== * 功能描述:ConnectToAcad * 创 建 者:Garrett * 创建日期:2019/12/16 11:54:13 * ==============================================================================*/ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Autodesk.AutoCAD.Interop.Common; using Autodesk.AutoCAD.Runtime; using SmartSoft.ACAD; namespace TestCad { /// /// ConnectToAcad /// class ConnectToAcad { public static void Connect(string path) { try { AutoCADConnector acd = new AutoCADConnector();//生成操作类对象 AxDbDocument doc_as = acd.GetThisDrawing(path, ""); if (doc_as != null) { acd.GetEntityReference(doc_as); } acd.Dispose(); } catch (System.Exception ac) { Console.WriteLine(ac); throw; } } } }