- 积分
- 961
- 明经币
- 个
- 注册时间
- 2013-6-9
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
我写了一个双击弹出自定义实体,但是需要加一个读取实体扩展数据的判断,如果名字为Myshujia的扩展表存在则实现双击弹出窗体,如果不存在该表则不弹出,代码如下- private void dm_DocumentLockModeChanged(object sender, DocumentLockModeChangedEventArgs e)
- {
- //双击事件
- if (e.GlobalCommandName.ToUpper() == "PROPERTIES")
- {
- e.Veto();
- Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database;
- Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
- PromptEntityResult ent=ed.Editor
- using (Transaction tran = db.TransactionManager.StartTransaction())
- {
- if (ent.Status == PromptStatus.OK)
- {
- Entity eent = (Entity)tran.GetObject(ent.ObjectId, OpenMode.ForWrite);
- ResultBuffer rb = eent.XData;
- TypedValue[] vals = rb.AsArray();
- for (int i = 0; i < vals.Length; i++)
- {
- TypedValue[] val = vals;
- if(val.Value.ToString=="Myshujia" )
- {
- using (Form2 form2 = new Form2())
- {
- Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(form2);
- }
- }
- }
- }
- }
- }
|
|