明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1470|回复: 3

取得pline关键点的坐标

[复制链接]
发表于 2005-12-1 11:14 | 显示全部楼层 |阅读模式

如何取得pline线关键点的坐标组成一个选择集

发表于 2005-12-1 14:43 | 显示全部楼层

reply

取得线结点坐标,返回点表:

(defun *ax:GetVertexList (Ename / obj tmp coords oname start end)
 
  (setq obj (*ax:MakeObject Ename)
 coords '()
 oname (*ax:ObjectName obj))
 
  (if (member oname '("AcDbPolyline" "AcDb2dPolyline"))
    (progn
      (setq tmp (vlax-safearray->list
    (vlax-variant-value
      (vlax-get-property
        obj
        'Coordinates))))
      (cond
 ((= oname "AcDb2dPolyline") olyline
  (while tmp
    (setq coords (append coords (list (list (car tmp)(cadr tmp)(caddr tmp))))
   tmp (cdddr tmp))
  );while
 );
 ((= oname "AcDbPolyline") ;LWPolyline
  (while tmp
    (setq coords (append coords (list (list (car tmp)(cadr tmp))))
   tmp (cddr tmp))
  );while
 );
      );cond
    );
  );if

  (if (= oname "AcDbLine")
    (progn
      (setq start (vlax-safearray->list
      (vlax-variant-value
        (vlax-get-property obj 'StartPoint)))
     end (vlax-safearray->list
    (vlax-variant-value
      (vlax-get-property obj 'EndPoint)))
     coords (append coords (list start))
     coords (append coords (list end)))
    )
  );if
  coords
)

 楼主| 发表于 2005-12-1 15:25 | 显示全部楼层

((-1 . <ͼԪÃû: 7ef50e78>) (0 . "LWPOLYLINE") (330 . <ͼԪÃû:
7ef50cf8>) (5 . "87") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0")
(100 . "AcDbPolyline") (90 . 10) (70 . 1) (43 . 0.0) (38 . 0.0) (39 . 0.0) (10
520.312 887.337) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 901.354 927.418) (40 .
0.0) (41 . 0.0) (42 . 0.0) (10 873.333 739.408) (40 . 0.0) (41 . 0.0) (42 .
0.436024) (10 891.634 716.515) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 1280.74
687.642) (40 . 0.0) (41 . 0.0) (42 . -0.615591) (10 1294.42 654.653) (40 . 0.0)
(41 . 0.0) (42 . 0.0) (10 1006.09 319.53) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10
703.034 424.185) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 553.737 584.507) (40 .
0.0) (41 . 0.0) (42 . 0.0) (10 404.44 720.335) (40 . 0.0) (41 . 0.0) (42 . 0.0)
(210 0.0 0.0 1.0))

可以不用这么复杂,就是把上面的列表中含有10的都选出来,组成一个新的列表。我记得好象用foreach就可以实现,好久不用忘了

发表于 2005-12-1 21:54 | 显示全部楼层

你说的只是针对lwpolyline.

 

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

本版积分规则

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

GMT+8, 2024-5-3 00:00 , Processed in 0.306863 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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