/// <summary> 在 AutoCAD 界面中快速导航到指定的桩号 </summary> public ExternalCmdResult NavigateStation(DocumentModifier docMdf, SelectionSet impliedSelection) { _docMdf = docMdf; SubgradeSection matchedSection = null; bool? start; var wantedStation = SetStation(docMdf.acEditor, out start); // 所有的断面 var allSections = SQUtils.GetAllSections(docMdf, sort: true); if (allSections != null && allSections.Length > 0) { if (start.HasValue) { // 匹配起始或者结尾桩号 if (start.Value) { matchedSection = allSections[0]; } else { matchedSection = allSections[allSections.Length - 1]; } } else { // 匹配指定数值最近的桩号 if (wantedStation.HasValue) { var allStations = new AllStations(allSections.Select(r => r.XData.Station).ToArray()); var closestStation = allStations.MatchClosest(wantedStation.Value); matchedSection = allSections.FirstOrDefault(r => r.XData.Station == closestStation); } } // if (matchedSection != null) { var ext = matchedSection.GetExtends(); ext.TransformBy(Matrix3d.Scaling( scaleAll: 1.2, center: ext.MinPoint.Add((ext.MaxPoint - ext.MinPoint) / 2))); eZcad.Utility.Utils.ShowExtentsInView(docMdf.acEditor, ext); } } return(ExternalCmdResult.Commit); }