明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
12
返回列表 发新帖
楼主: scf0413

[基础] 拾取点时出现的问题

  [复制链接]
 楼主| 发表于 2011-1-11 22:25 | 显示全部楼层
贴图中 点取坐标只能点一下就没了,能否做到连续点取?以下是我的代码 [CommandMethod("PP")]
       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();
            }
恳求斑竹帮帮我 谢谢
 楼主| 发表于 2011-1-11 22:29 | 显示全部楼层
这贴图是执行我的代码后的效果

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2011-1-11 22:30 | 显示全部楼层
又把你的问题贴了一遍,汗
3楼不是有例子么
 楼主| 发表于 2011-1-11 22:54 | 显示全部楼层
发表于 2011-1-13 12:30 | 显示全部楼层
本帖最后由 飞诗(fsxm) 于 2011-1-13 12:33 编辑

  1. while(true)
  2. {var opt = new PromptPointOptions("\n指定下一点:");
  3. opt.AllowNone = true;
  4. var rst = ed.GetPoint(opt);
  5. if (rst.Status != PromptStatus.OK) break;
  6. ...................
  7. }

 楼主| 发表于 2011-1-13 14:28 | 显示全部楼层
多谢了 问题已解决
发表于 2011-1-13 18:39 | 显示全部楼层
[CommandMethod("PP")]
public void Pickpt()
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
             while (true)
             {
            Point3d pt = Pick("\n 拾取点");
            if (pt==null)
                return;
            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 null;
          }
      }
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-18 07:26 , Processed in 0.200851 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表