- [CommandMethod("tt")]
- 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;
- }
|