拾取点时出现的问题
请教斑竹 在点取坐标的时候 怎样用一个循环语句 可以一直点取 直到确定为止,显示在命令行里? 本帖最后由 雪山飞狐_lzh 于 2011-1-11 10:19 编辑仔细看下这两天的帖子,有这方面的代码:
http://bbs.mjtd.com/thread-85028-1-1.html
public static void Test2()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
var optPt = new PromptPointOptions("\n选择第一点");
optPt.AllowNone = true;
var resPt = ed.GetPoint(optPt);
optPt.Message = "\n选择下一点";
optPt.UseBasePoint = true;
while (resPt.Status == PromptStatus.OK)
{
optPt.BasePoint = resPt.Value;
resPt = ed.GetPoint(optPt);
}
}
飞狐大哥 下面这段代码加个循环 ,该怎么编? 先谢谢了
public void Pickpt()
{
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
Point3d pt = Pick("\n 拾取点");
ed.WriteMessage("\n{0:f1}", pt);
}
public static Point3d Pick(string word)
{
Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
PromptPointResult pt = ed.GetPoint(word);
if (pt.Status == PromptStatus.OK)
{
return (Point3d)pt.Value;
}
else
{
return new Point3d();
}
}
public void Pickpt()
{
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
Point3d pt = Pick("\n 拾取点");
ed.WriteMessage("\n{0:f1}", pt);
}
public static Point3d Pick(string word)
{
Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
PromptPointResult pt = ed.GetPoint(word);
bool isSelected = false;
while (!isSelected) {
if (pt.Status == PromptStatus.OK) {
isSelected = true;
return (Point3d)pt.Value;
} else {
continue;
}
}
希望会对你有用。
还是不能连续点取么? 把返回类型改成point3dCollection,
用选择集来获取选中的点试试。
不过你得获得用户什么时候取消选择了。 我的目的是在cad中连续点取任意实体上的坐标,我是初学者,还望高手能帮帮忙。不过还是要谢谢 epwt 恳请斑竹 帮帮我这个初学者 谢谢 这个,还是看不懂你的要求,说明清楚点?
如果有必要,贴图说明下吧
页:
[1]
2