本次由重庆区公民若海同志提供,嘻嘻…
lisp语句:
(vlax-ldata-put (car (entsel)) “basepoint” “测试结果”)
[DllImport("accore.dll", CallingConvention = CallingConvention.Cdecl)]static extern IntPtr acdbEntGet(AdsName objName);[DllImport("accore.dll", CallingConvention = CallingConvention.Cdecl)]static extern IntPtr acdbEntGetX(AdsName objName, IntPtr app);[DllImport("acdb19.dll",CallingConvention = CallingConvention.Cdecl,EntryPoint = "?acdbGetAdsName@@YA?AW4ErrorStatus@Acad@@AEAY01_JVAcDbObjectId@@@Z")]static extern ErrorStatus acdbGetAdsName64(out AdsName objName, ObjectId id);[CommandMethod("tt")]public static void CB_GetDict(){Document m_Document = Application.DocumentManager.MdiActiveDocument;using (Transaction m_Transaction = m_Document.Database.TransactionManager.StartTransaction()){var id = Application.DocumentManager.MdiActiveDocument.Editor.GetEntity("ce").ObjectId;DBObject obj = m_Transaction.GetObject(id, OpenMode.ForRead);//获取对象的扩展字典ObjectId dictId = obj.ExtensionDictionary;DBDictionary m_DBDictionary = (DBDictionary)m_Transaction.GetObject(dictId, OpenMode.ForRead);if (m_DBDictionary != null){ObjectId m_DictObjectId = m_DBDictionary.GetAt("basepoint");DBObject m_ImpDBObjectAsDBObject = (DBObject)m_Transaction.GetObject(m_DictObjectId,OpenMode.ForRead);ResultBuffer m_Resultbuffer = new ResultBuffer();AdsName m_EName = new AdsName();acdbGetAdsName64(out m_EName, m_ImpDBObjectAsDBObject.ObjectId);IntPtr m_IntPrResult = acdbEntGetX(m_EName, m_Resultbuffer.UnmanagedObject);if (m_IntPrResult != IntPtr.Zero){m_Resultbuffer = ResultBuffer.Create(m_IntPrResult, true);Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage(m_Resultbuffer.ToString());}}m_Transaction.Commit();}}

