- 积分
- 374
- 明经币
- 个
- 注册时间
- 2008-6-25
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
大侠看看这个程序这么改,获取多重引线样式WDAGAIN 的属性,输出到命令行
using System;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.EditorInput;
[assembly: CommandClass(typeof(GetMleaderStyle.GetMlStyle))]
namespace GetMleaderStyle
{
public class GetMlStyle
{
[CommandMethod("GMlS")]
public static void GetMlSty()
{
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();//回收内存
}
}
}
}
|
|