请教条件选择的问题
请教C#怎么实现实现这样的选择集:在所有图形中只选中“长度为100,与x轴夹角为30度的红色线”,望给位高手指点一下,谢谢。 <p>长度和倾角在DXF码中没有对应项,无法按这两项选择</p><p>只有先过滤出红色线,再遍历</p> lzh741206发表于2010-5-12 16:29:00static/image/common/back.gif长度和倾角在DXF码中没有对应项,无法按这两项选择只有先过滤出红色线,再遍历如何遍历<p>版主能说的详细点吗?</p>
public static void Test()
{
var db = HostApplicationServices.WorkingDatabase;
var doc = Application.DocumentManager.GetDocument(db);
var ed = doc.Editor;
var res =
ed.SelectAll
(
new ResultList
{
{0, "line"},
{62, 1}
}
);
if (res.Status != PromptStatus.OK)
return;
using (Transaction tr = db.TransactionManager.StartTransaction())
{
var ids =
from ObjectId id in res.Value.GetObjectIds()
let line = id.GetObject(OpenMode.ForWrite) as Line
where Equals(line.Length, 100, 10e-10) && Equals(line.Angle, Math.PI / 6, 10e-10)
select id;
ed.SetImpliedSelection(ids.ToArray());
}
}
public static bool Equals(double d1, double d2, double tol)
{
return Math.Abs(d1 - d2) < tol;
}
<p> 谢谢版主</p>
页:
[1]