www.mxdraw.com
内容索引主面
前一个向上下一个
IMxDrawProxyEntity 接口

控件中的自定义实体类型

IDL
[ object, uuid(DC5A8A2F-1570-4A40-A764-859E1066E274), dual, nonextensible, helpstring("IMxDrawProxyEntity interface"), pointer_default(unique) ]
interface IMxDrawProxyEntity : IMxDrawEntity;

MxDrawProxyEntity.idl

例如: 判断图上是否有天正对象C#

private bool isTzDwg()
 {
     MxDrawSelectionSet ss = new MxDrawSelectionSet();
     ss.AllSelect();
     for (int i = 0; i < ss.Count; i++)
     {
         MxDrawEntity ent = ss.Item(i);
         if (ent is MxDrawProxyEntity)
         {
             MxDrawProxyEntity proxy = (MxDrawProxyEntity)ent;
               MxDrawResbuf ret = proxy.GetProp("ExplodeEx");
               if (ret.Count == 0)
               {
                    continue;
               }
             String sClassName = proxy.originalClassName;
             if(sClassName == "TDbWall"
                 || sClassName == "TDbOpening"
                 || sClassName == "TDbSymbCoord"
                 )
             {
                 return true;
             }

         }
     }
     return false;
 }

 // 调用函数的代码

 if (isTzDwg())
{
        MessageBox.Show("发现天正对象");
}

 

得到代理实体对象的EntGet数据 。

            MxDrawApplication app = new MxDrawApplication();

            //设置读取函数 读取自定义实体的,entget数据 。
            app.Iniset("DefaultReadContent=-131073");


            MxDrawService ser = new MxDrawService();
            ser.Open("I:\ld.dwg");


            MxDrawSelectionSet ss = new MxDrawSelectionSet();
            ss.AllSelect();

            axMxDrawX1.MakeCurrentOcx();
            for (int i = 0; i < ss.Count; i++)
            {
                MxDrawEntity ent = ss.Item(i);

                if (ent.ObjectName == "McDbProxyEntity")
                {
                    MxDrawProxyEntity proxyEntity = (MxDrawProxyEntity)ent;
                    if (proxyEntity.originalClassName == "AcDbLeader")
                    {
                        MxDrawResbuf ret = proxyEntity.GetProp("EntGet");
                        if (ret != null)
                            ret.PrintData();
                    }

                }
            }
            ser.Close();
Copyright (c) 2010. All rights reserved.
你认为该帮助怎么样? 发送反馈信息!