public void HydroInsulationStart() { var keywords = new[] { "Points", "polYline" }; var insulationModeResult = _editorHelper.PromptForKeywordSelection("HidroInsulation over points or object", keywords, false, "Points"); if (insulationModeResult.Status != PromptStatus.OK) { return; } using (var tr = _drawingHelper.TransactionManager.StartTransaction()) { switch (insulationModeResult.StringResult) { case "Points": var insulationVertices = GetPointsFromUser(); if (insulationVertices.Count < 2) { return; } var insulationBaseLine = new Polyline(); insulationBaseLine.SetDatabaseDefaults(); insulationBaseLine.Color = Color.FromColor(System.Drawing.Color.Yellow); var counter = 0; foreach (Point3d insulationVertex in insulationVertices) { insulationBaseLine.AddVertexAt(counter, new Point2d(insulationVertex.X, insulationVertex.Y), 0, 0, 0); counter++; } AddPolylineToModelSpace(insulationBaseLine, tr); _selectedObjectId = insulationBaseLine.ObjectId; break; case "polYline": var promptEntityResult = _editorHelper.PromptForObject( "\nSelect the Polyline : ", typeof(Polyline), true); if (promptEntityResult.Status != PromptStatus.OK) { return; } _selectedObjectId = promptEntityResult.ObjectId; break; } var sidePointResult = _editorHelper.PromptForPoint("Select side : "); if (sidePointResult.Status != PromptStatus.OK) { RemovePolylineFromModelSpace(_selectedObjectId, tr); return; } _sidePoint = sidePointResult.Value; var thicknessResult = _editorHelper.PromptForDouble("Set thickness : ", Settings.Default.HInsulationThickness); if (thicknessResult.Status != PromptStatus.OK) { RemovePolylineFromModelSpace(_selectedObjectId, tr); return; } _thickness = thicknessResult.Value; Settings.Default.HInsulationThickness = _thickness; var internalRadiusResult = _editorHelper.PromptForDouble("Set internal radius : ", Settings.Default.HInsulationInternalRadius); if (internalRadiusResult.Status != PromptStatus.OK) { RemovePolylineFromModelSpace(_selectedObjectId, tr); return; } _internalRadius = internalRadiusResult.Value; Settings.Default.HInsulationInternalRadius = _internalRadius; var segmentLengthResult = _editorHelper.PromptForDouble("Set segment length : ", Settings.Default.HInsulationSegmentLenght); if (segmentLengthResult.Status != PromptStatus.OK) { RemovePolylineFromModelSpace(_selectedObjectId, tr); return; } _segmentLength = segmentLengthResult.Value; Settings.Default.HInsulationSegmentLenght = _segmentLength; Settings.Default.Save(); CreateHydroInsulationLayers(); CreateHydroInsulation(); tr.Commit(); } _logger.Info(System.Reflection.MethodBase.GetCurrentMethod().Name); }
private Point3dCollection GetPointsFromUser() { var vertices = new Point3dCollection(); var verticesRslt = _editorHelper.PromptForPoint("\nSelect point: "); while (verticesRslt.Status == PromptStatus.OK) { vertices.Add(verticesRslt.Value); verticesRslt = _editorHelper.PromptForPoint("\nSelect point: ", true, true, verticesRslt.Value); if (verticesRslt.Status == PromptStatus.OK) { _editorHelper.DrawVector(vertices[vertices.Count - 1], verticesRslt.Value, Color.FromColor(System.Drawing.Color.Yellow).ColorIndex, false); } } return(vertices); }