GetDistance用於讓用戶指定距離值
Document doc = Application.DocumentManager.MdiActiveDocument;
double value = 0.0;
PromptDistanceOptions options = new PromptDistanceOptions("\n請指定距離: ");
options.BasePoint = new Point3d(0, 0, 0);
options.UseBasePoint = true;
PromptDoubleResult result = doc.Editor.GetDistance(options);
switch (result.Status)
{
case PromptStatus.OK:
value = result.Value;
doc.Editor.WriteMessage("\nDistance = " + value);
break;
case PromptStatus.Cancel:
doc.Editor.WriteMessage("\n用戶取消了輸入");
break;
default:
break;
}
PromptDistanceOptions用於設置用戶輸入的控制項。
UseBasePoint爲true時,會從BasePoint繪製一條示意線到當前鼠標位置,並計算這之間的距離。
Only2d爲true時,在計算點的距離時,會忽略掉點的Z座標來計算距離。
如要設置允許用戶任意輸入、關鍵字等,請參考文章
http://blog.csdn.net/hisinwang/article/details/78887888