public ExternalCommandResult Execute(SelectionSet impliedSelection, ref string errorMessage, ref IList <ObjectId> elementSet) { var s = new SlopeConstructor(); return(AddinManagerDebuger.DebugInAddinManager(s.ConstructSlopes, impliedSelection, ref errorMessage, ref elementSet)); }
/// <summary> 按标高将边坡对象进行分割,以实现同一级边坡中分别设置不同的防护形式 </summary> private void CutSlopes(DocumentModifier docMdf, SlopeLine[] selectedSlopes, CutMethod method, double elev, double waterLineLength) { // ProtectionUtils.SubgradeEnvironmentConfiguration(docMdf); // //var layer_Slope = Utils.GetOrCreateLayer(docMdf, ProtectionConstants.LayerName_ProtectionMethod_Slope); var layer_WaterLine = eZcad.SubgradeQuantity.Utility.SQUtils.GetOrCreateLayer_WaterLine(docMdf); //var layer_Platform = Utils.GetOrCreateLayer(docMdf, ProtectionConstants.LayerName_ProtectionMethod_Platform); var es = EditStateIdentifier.GetCurrentEditState(docMdf); es.CurrentBTR.UpgradeOpen(); // Point2d intersPt; Slope intersSlopeSeg; int cutCount = 0; docMdf.WriteLineIntoDebuger("被分割的边坡对象:"); var protLayers = ProtectionTags.MapProtectionLayers(_docMdf, selectedSlopes); foreach (var slp in selectedSlopes) { var inters = ValidateElevation(slp, method, elev, out intersPt, out intersSlopeSeg); if (inters) { // 将子边坡按指定的交点进行剪切 var newSegs = CutSlopeSegment(slp.XData, intersSlopeSeg, new Point3d(intersPt.X, intersPt.Y, 0)); slp.XData.Slopes = newSegs; // 将被剪切掉的子边坡所绑定的文字删除 SlopeLine.EraseText(intersSlopeSeg, docMdf.acDataBase); // 绘制水位线 var line = new Line(new Point3d(intersPt.X - waterLineLength / 2, intersPt.Y, 0), new Point3d(intersPt.X + waterLineLength / 2, intersPt.Y, 0)); line.LayerId = layer_WaterLine.Id; es.CurrentBTR.AppendEntity(line); docMdf.acTransaction.AddNewlyCreatedDBObject(line, true); slp.XData.Waterlines.Add(line.Handle); // 将刷新后的数据保存到 AutoCAD 文档与界面中 slp.Pline.UpgradeOpen(); SlopeConstructor.SetSlopeUI(slp); slp.PrintProtectionMethod(es.CurrentBTR, protLayers); slp.FlushXData(); slp.Pline.DowngradeOpen(); // cutCount += 1; docMdf.WriteLineIntoDebuger(slp); } } es.CurrentBTR.DowngradeOpen(); docMdf.WriteLineIntoDebuger($"总计:{cutCount} 个"); }