|
[CommandMethod("tt", CommandFlags.Session)]
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[BlockTableRecord.ModelSpace], 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)
大家帮帮忙,谢谢了。
|
|