public void GetCutFillArea() { var sOptions = new PromptSelectionOptions() { SingleOnly = true, AllowDuplicates = false, }; var polyLine = DBDictionary.GetClass(typeof(Polyline)).DxfName; var filter = new SelectionFilter(new[] { new TypedValue((int)DxfCode.Start, polyLine), }); ED.WriteMessage("Select EG PLine"); var selection1 = ED.GetSelection(sOptions, filter); if (selection1.Status != PromptStatus.OK) { return; } var id1 = selection1.Value.GetObjectIds()[0]; ED.WriteMessage("Select Intermediate PLine"); var selection2 = ED.GetSelection(sOptions, filter); if (selection2.Status != PromptStatus.OK) { return; } var id2 = selection2.Value.GetObjectIds()[0]; ED.WriteMessage("Select Design PLine"); var selection3 = ED.GetSelection(sOptions, filter); if (selection3.Status != PromptStatus.OK) { return; } var id3 = selection3.Value.GetObjectIds()[0]; TInvoke(t => { var p1 = (Polyline)t.GetObject(id1, OpenMode.ForRead); var p2 = (Polyline)t.GetObject(id2, OpenMode.ForRead); var p3 = (Polyline)t.GetObject(id3, OpenMode.ForRead); var(cut, fill) = CalculateArea(t, p1, p2, p3); ED.WriteMessage($"Cut: {cut.ToString("N", NFormat)}, Fill: {fill.ToString("N", NFormat)}"); ED.WriteMessage("Select Point To Place Labels:"); var res = ED.GetPoint(new PromptPointOptions("Pick Point To Place Labels")); if (res.Status == PromptStatus.OK) { var point = res.Value; var label = new DBText { TextString = $"{cut.ToString("N", NFormat)}", Height = 0.4, Position = point, Color = Color.FromColor(System.Drawing.Color.Red) }; var label2 = new DBText { TextString = $"{fill.ToString("N", NFormat)}", Height = 0.4, Position = point.Add(new Vector3d(3, 0, 0)), Color = Color.FromColor(System.Drawing.Color.Green) }; var btr = (BlockTableRecord)t.GetObject(Db.CurrentSpaceId, OpenMode.ForWrite); btr.AppendEntity(label); btr.AppendEntity(label2); t.AddNewlyCreatedDBObject(label, true); t.AddNewlyCreatedDBObject(label2, true); } }); }