public static IOrderedEnumerable <Acaddb.Polyline> OrderPolylines(Acaddb.ObjectIdCollection polyoId) { var ordered = new List <Acaddb.Polyline>(); foreach (Acaddb.ObjectId i in polyoId) { using (var tr = Active.StartTransaction()) { ordered.Add(tr.GetObject(i, Acaddb.OpenMode.ForWrite) as Acaddb.Polyline); } } return(ordered.OrderBy(p => p.Area)); }
public static void AddCircle(Point2d p) { using (DocumentLock lLock = Active.Document.LockDocument()) { using (Transaction tr = Active.StartTransaction()) { var center = new Point3d(p.X, p.Y, 0); Circle c = new Circle(); c.Center = center; c.Radius = 2; c.SetDatabaseDefaults(); c.Layer = "0"; Entity ent = c; BBC.Common.AutoCAD.AcadDatabaseManager.AddToDatabase(Active.Database, ent, tr); tr.Commit(); } } }