获取多重引线样式WDAGAIN 的属性,输出到命令行
大侠看看这个程序这么改,获取多重引线样式WDAGAIN 的属性,输出到命令行using System;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.EditorInput;
namespace GetMleaderStyle
{
public class GetMlStyle
{
public static voidGetMlSty()
{
Database db = Application.DocumentManager.MdiActiveDocument.Database;
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
using (Transaction acTrans = db.TransactionManager.StartTransaction())
{
//获取所有多重标注样式
DBDictionary MlStyleList = acTrans.GetObject(db.MLeaderStyleDictionaryId, OpenMode.ForRead) as DBDictionary;
MLeaderStyle myMleaderStyle = new MLeaderStyle();
//判断当前文件是否存在多重标注样式WDAGAIN,如果不存,执行下边语句。
if (MlStyleList.Contains("WDAGAIN"))
{
myMleaderStyle = acTrans.GetObject(MlStyleList["WDAGAIN"], OpenMode.ForRead) as MLeaderStyle;
//获取多重标注样式WDAGAIN的ArrowSymbolId属性。
ObjectId MyArrowSymbol = myMleaderStyle.ArrowSymbolId;
double MyTextHeight = myMleaderStyle.TextHeight;
// 调用Editor对象的WriteMessage函数在命令行上显示文本
ed.WriteMessage( MyArrowSymbol );
ed.WriteMessage( MyTextHeight );
}
acTrans.Commit();//回收内存
}
}
}
}
页:
[1]