乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 82|回复: 3

[编程交流] Info by cogo point #

[复制链接]

9

主题

25

帖子

16

银币

初来乍到

Rank: 1

铜币
45
发表于 2022-7-5 17:12:18 | 显示全部楼层 |阅读模式
A brief overview of what's going on here:
 


  • user will select their points
  • run the command
  • once the LISP encounters a point description with "CNF" or "DEC", it places a block with text

Now the next step is to grab the next 2 sequential points and get their X&Y coordinates so I can measure the distance between the two, but I'm kind of stuck on how to do that. Any help would be appreciated.
 
 
  1. (defun c:desc2 (/ ss x northng pnt eastng descr dist hndl eastng1 eastng2 northng1 northng2)  (vl-load-com)  (if (ssget ":S:E" '((0 . "AECC_COGO_POINT")))     (progn        (vlax-for x           (setq ss (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object))))           (setq pnt (vlax-get x 'number)              eastng (vlax-get x 'easting)              northng (vlax-get x 'northing)              descr (vlax-get x 'rawdescription)              hndl (vlax-get x 'handle)           );END setq           (if              (= 0 (vl-string-search "DEC" descr))                 (progn                    (command "text" "c" (list eastng northng) 0.5 0 descr)                    (command  "_insert" "nf_shrub_decid" (list eastng northng) "" "" "")                    (setq pnt1 (+ 1 pnt)                          pnt2 (+ 2 pnt)                    )                 );END if TRUE                 (progn                    (if                       (= 0 (vl-string-search "CNF" descr))                          (progn                             (command "text" "c" (list eastng northng) 0.5 0 descr)                             (command  "_insert" "nf_shrub_conifer" (list eastng northng) "" "" "")                          );END if TRUE                    );END if                 );END if FALSE           );END if        );END vlax-for     );END progn  );END if  (princ))
回复

使用道具 举报

5

主题

1334

帖子

1410

银币

限制会员

铜币
-20
发表于 2022-7-5 17:38:28 | 显示全部楼层
I don't have Civil, but based on your code, you can try something like this :
 
  1. (defun c:desc2 ( / ss x northng pnt eastng descr dist hndl eastng1 eastng2 northng1 northng2 pnt1 pnt2 easting1 nothing1 easting2 northing2 )  (vl-load-com)  (if (ssget ":S:E" '((0 . "AECC_COGO_POINT")))     (progn        (vlax-for x           (setq ss (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object))))           (setq pnt (vlax-get x 'number)              eastng (vlax-get x 'easting)              northng (vlax-get x 'northing)              descr (vlax-get x 'rawdescription)              hndl (vlax-get x 'handle)           );END setq           (if              (= 0 (vl-string-search "DEC" descr))                 (progn                    (command "text" "c" (list eastng northng) 0.5 0 descr)                    (command  "_insert" "nf_shrub_decid" (list eastng northng) "" "" "")                    (setq pnt1 (+ 1 pnt)                          pnt2 (+ 2 pnt)                    )                    (vlax-for p ss                       (if (= pnt1 (vlax-get p 'number))                          (progn                             (setq easting1 (vlax-get p 'easting))                             (setq northing1 (vlax-get p 'northing))                          )                       )                       (if (= pnt2 (vlax-get p 'number))                          (progn                             (setq easting2 (vlax-get p 'easting))                             (setq northing2 (vlax-get p 'northing))                          )                       )                    )                 );END if TRUE                 (progn                    (if                       (= 0 (vl-string-search "CNF" descr))                          (progn                             (command "text" "c" (list eastng northng) 0.5 0 descr)                             (command  "_insert" "nf_shrub_conifer" (list eastng northng) "" "" "")                          );END if TRUE                    );END if                 );END if FALSE           );END if        );END vlax-for     );END progn  );END if  (prompt "\nDistance is : ") (princ (rtos (distance (list easting1 northing1) (list easting2 northing2)) 2 20))  (princ))
 
HTH, M.R.
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 18:08:10 | 显示全部楼层
marko is the rtos ... 2 20 a typo ? 123.45678901234567.......
2 2 sounds right.
 
thereisnotime you may be interested in this also http://www.cadtutor.net/forum/showthread.php?98234-Dyanically-setting-tree-trunk-and-diameter.
回复

使用道具 举报

9

主题

25

帖子

16

银币

初来乍到

Rank: 1

铜币
45
发表于 2022-7-5 18:26:59 | 显示全部楼层
Perfect, thanks guys!
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-7-12 19:31 , Processed in 0.491807 second(s), 60 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表