tcsl9621 发表于 2006-7-7 21:57:00

如何根据对像OBJECTID 取得对像名称?

<P>如标题所示。还望大侠指点。</P>

tcsl9621 发表于 2006-7-7 22:56:00

好了,找到解决方案了。

yinzhiw 发表于 2006-7-16 11:02:00

请问楼主是如何取得的

tcsl9621 发表于 2006-7-16 17:38:00

&nbsp;&nbsp;&nbsp; Public ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor<BR>&nbsp;&nbsp;&nbsp; Public Function objectidtoacadobject(ByVal objid As ObjectId) As AcadObject<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim obj2 As AcadObject<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim db = HostApplicationServices.WorkingDatabase<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim trans As Transaction = db.TransactionManager.StartTransaction()<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim ent As Entity = trans.GetObject(objid, OpenMode.ForRead, False)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; obj2 = ent.AcadObject<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Return obj2<BR>&nbsp;&nbsp;&nbsp; End Function
页: [1]
查看完整版本: 如何根据对像OBJECTID 取得对像名称?