bing624 发表于 2010-4-21 11:15:00

C#获取块属性错误,怎么回事?


      private bool GetSize(string filepath)
      {
            bool revBool = false;
            axd.Application.DocumentManager.Open(filepath);
            Database db = axd.Application.DocumentManager.MdiActiveDocument.Database;   //获取当前活动文档所在的数据库
            Autodesk..DatabaseServices.TransactionManager tm = db.TransactionManager;    //获取事务处理管理器,用来对数据库进行操作
            using (Transaction ta = tm.StartTransaction())    //启动事务处理
            {
                BlockTable bt = (BlockTable)tm.GetObject(db.BlockTableId, OpenMode.ForRead, false); //获取块表,注意要进行强制类型转换
                BlockTableRecord btr = (BlockTableRecord)tm.GetObject(bt, OpenMode.ForWrite, false);//获取模型空间所在的块表记录
                Extents3d ext3d = new Extents3d();
                ext3d.AddBlockExtents(btr);
                double x = ext3d.MaxPoint.X - ext3d.MinPoint.X;
                double y = ext3d.MaxPoint.Y - ext3d.MinPoint.Y;
                revBool = x > y;               
               
                ta.Dispose();
            }
            tm.Dispose();
            db.Dispose();
            return revBool;
      }
各位朋友,我的代码如上,如是调用该方法时,却出现以下错误:
找不到指定的模块:(异常来自:0x8007008E)
大家帮帮忙,谢谢了。

雪山飞狐_lzh 发表于 2010-4-21 13:30:00

你的调用方式的问题
NetApi只能在进程内的方式调用
你是外部程序吧

bing624 发表于 2010-4-21 14:07:00

多谢你的回答,我这个是在外部程序里写的.
应该怎么处理呢?

雪山飞狐_lzh 发表于 2010-4-21 19:33:00

外部程序只能用Com了,呵呵

single-yu 发表于 2010-4-26 22:03:00

到这一步
attdef.Prompt = "Room Number"
就出错了
页: [1]
查看完整版本: C#获取块属性错误,怎么回事?