- 积分
- 990
- 明经币
- 个
- 注册时间
- 2011-8-27
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
我想选择出某一图层中与一条多段线相交的多段线或二维多段线,该怎么写选择条件呢?
我现在的方法是:
Database db = HostApplicationServices.WorkingDatabase;
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
TypedValue value1 = new TypedValue((int)DxfCode.Start, "*PolyLine");
TypedValue value2 = new TypedValue((int)DxfCode.LayerName, Layername);
TypedValue[] values = { value1, value2 };
SelectionFilter sfilter = new SelectionFilter(values);
PromptSelectionResult resSel = ed.SelectAll(sfilter);
SelectionSet sSet = resSel.Value;
ObjectId[] ids = sSet.GetObjectIds();
Polyline polylineTemp = new Polyline(2);
polylineTemp.AddVertexAt(0, p1, 0, 0, 0);
polylineTemp.AddVertexAt(1, p2, 0, 0, 0);
using (Transaction trans = db.TransactionManager.StartTransaction())
{
foreach(ObjectId sSetEntId in ids)
{
Entity myEntity = (Entity)trans.GetObject(sSetEntId, OpenMode.ForRead);
if ((myEntity is Polyline) || (myEntity is Polyline2d))
{
//这里做myEntity 与polylineTemp 是否有交点的判断
}
}
trans.commit();
}
|
|