protected override Status FixImpl(CheckResult checkResult, out List <ObjectId> resultIds) { resultIds = new List <ObjectId>(); var crossingCheckResult = checkResult as CrossingCheckResult; if (crossingCheckResult == null) { return(Status.Rejected); } var crossingInfo = crossingCheckResult.CrossingInfo; var distinctIds = new HashSet <ObjectId>(); distinctIds.Add(crossingInfo.SourceId); distinctIds.Add(crossingInfo.TargetId); using (var transaction = Document.Database.TransactionManager.StartTransaction()) { //// distinctIds == 1说明是自交线 bool isSelfIntersection = (distinctIds.Count == 1); var modelSpace = (BlockTableRecord)transaction.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(Document.Database), OpenMode.ForWrite); foreach (var sourceId in distinctIds) { var sourceCurve = transaction.GetObject(sourceId, OpenMode.ForWrite) as Curve; DBObjectCollection allSplitCurves = null; if (isSelfIntersection) { allSplitCurves = CurveUtils.SplitSelfIntersectCurve(sourceCurve, crossingInfo.IntersectPoints, transaction); } else // Use CurveUtils.SplitCurve take less time. { allSplitCurves = CurveUtils.SplitCurve(sourceCurve, crossingInfo.IntersectPoints); } // The splitted curves has the same layer with original curve, // so we needn't set its layer explicitly. foreach (Curve splitCurve in allSplitCurves) { var curveId = modelSpace.AppendEntity(splitCurve); transaction.AddNewlyCreatedDBObject(splitCurve, true); // Add splited curve to resultIds. resultIds.Add(curveId); } if (allSplitCurves.Count > 0) { // Erase the old one sourceCurve.Erase(); } } transaction.Commit(); } return(Status.Fixed); }