- 积分
- 4226
- 明经币
- 个
- 注册时间
- 2009-10-12
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2012-2-7 13:28:57
|
显示全部楼层
本帖最后由 liuxu042 于 2012-2-7 13:38 编辑
Tools应该是作者自己定义的类,可以自己改动一下代码,试试如下代码:
[CommandMethod("SEWP")]
public static void SelectEntitiesWithProperties()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
TypedValue[] tvs = new TypedValue[]
{
new TypedValue((int)DxfCode.Operator, "<or"),
new TypedValue((int)DxfCode.Operator, "<and"),
new TypedValue((int)DxfCode.LayerName, "0"),
new TypedValue((int)DxfCode.Start, "LINE"),
new TypedValue((int)DxfCode.Operator, "and>"),
new TypedValue((int)DxfCode.Operator, "<and"),
new TypedValue((int)DxfCode.Start, "CIRCLE"),
new TypedValue((int)DxfCode.Operator, ">="),
new TypedValue((int)DxfCode.Real, 10.0),// Circle Radius
new TypedValue((int)DxfCode.Operator, "and>"),
new TypedValue((int)DxfCode.Operator, "or>")
};
SelectionFilter sf = new SelectionFilter(tvs);
PromptSelectionResult psr = ed.SelectAll(sf);
if (psr.Status == PromptStatus.OK)
{
SelectionSet SS = psr.Value;
ObjectId[] idArray = SS.GetObjectIds();
Database db = HostApplicationServices.WorkingDatabase;
using (Transaction ta = db.TransactionManager.StartTransaction())
{
for (int i = 0; i < idArray.Length; i++)
{
Entity ent = (Entity)ta.GetObject(idArray, OpenMode.ForRead);
ent.Highlight();
ed.WriteMessage("\n"+i + ":" + ent.ObjectId.ToString() + "," + ent.GetType().Name);
}
ta.Commit();
}
}
}
|
评分
-
查看全部评分
|