protected override Status FixImpl(CheckResult checkResult, out List <ObjectId> resultIds) { resultIds = new List <ObjectId>(); var result = checkResult as MissingVertexInPolygonCheckResult; if (result == null) { return(Status.Rejected); } // Fix 就是 在缺点的地方添加顶点 using (var tr = Document.Database.TransactionManager.StartTransaction()) { var entity = tr.GetObject(result.ObjectId, OpenMode.ForWrite) as Curve; if (entity != null) { foreach (var position in result.MissingPositions) { AddVertex.AddVertexFromPolyline(tr, entity, position); } } tr.Commit(); } return(Status.Fixed); }
public bool FixAll() { var database = Editor.Document.Database; using (var transaction = database.TransactionManager.StartTransaction()) { foreach (var missingVertexInfo in MissingVertexInfos) { var curve = transaction.GetObject(missingVertexInfo.PolylineId, OpenMode.ForWrite) as Curve; foreach (var position in missingVertexInfo.Positions) { AddVertex.AddVertexFromPolyline(transaction, curve, position); } } transaction.Commit(); } return(true); }