private double getScale() { _Ed.PromptDoubleOptions pDoubleOpts = new _Ed.PromptDoubleOptions("\nEnter scale: "); _Ed.PromptDoubleResult pDoubleRes = _c.ed.GetDouble(pDoubleOpts); if (pDoubleRes.Status != _Ed.PromptStatus.OK) { throw new DMTException("no scale"); } return(pDoubleRes.Value); }
public static void DisplayIntersectionGridLines() { string strMsg = "Побудова перетину ліній координатної сітки > Масштаб креслення (1:1000 - 1.0, 1:500 - 0.5 ...) :"; AcEd.PromptDoubleOptions pdo = new AcEd.PromptDoubleOptions(strMsg) { AllowNegative = false, AllowZero = false, AllowNone = false }; AcEd.PromptDoubleResult pdr = CurrentCAD.Editor.GetDouble(pdo); if (pdr.Status == AcEd.PromptStatus.OK) { double scaleDrawing = pdr.Value; AcEd.PromptPointResult ppr = CurrentCAD.Editor.GetPoint("Побудова перетину ліній координатної сітки > Вкажіть першу точку:"); if (ppr.Status == AcEd.PromptStatus.OK) { AcGe.Point3d basePoint = ppr.Value; AcEd.PromptCornerOptions pco = new AcEd.PromptCornerOptions("Побудова перетину ліній координатної сітки > Вкажіть другу точку:", basePoint); ppr = CurrentCAD.Editor.GetCorner(pco); if (ppr.Status == AcEd.PromptStatus.OK) { AcGe.Point3d сornerPoint = ppr.Value; double stepGrid = scaleDrawing * 100; double newX = (double)((int)(basePoint.X / stepGrid)) * stepGrid; double newY = (double)((int)(basePoint.Y / stepGrid)) * stepGrid; if ((сornerPoint.X - basePoint.X) > 0) { newX += stepGrid; } if ((сornerPoint.Y - basePoint.Y) > 0) { newY += stepGrid; } AcGe.Point3d startPoint = new AcGe.Point3d(newX, newY, 0); int numCol = (int)((сornerPoint.Y - startPoint.Y) / stepGrid); int numRow = (int)((сornerPoint.X - startPoint.X) / stepGrid); double stepCol = stepGrid; double stepRow = stepGrid; if (numCol < 0) { stepCol *= -1; } if (numRow < 0) { stepRow *= -1; } ArraysBlocks arrBlock = new ArraysBlocks("11", scaleDrawing, 0, startPoint); arrBlock.DisplayArrays(Math.Abs(numCol) + 1, Math.Abs(numRow) + 1, stepCol, stepRow); } } } }