明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2410|回复: 3

[求助]怎样提取POLYLINE线各拐点坐标?

[复制链接]
发表于 2010-8-21 08:18:00 | 显示全部楼层 |阅读模式
如题,在POLYLINE线的群码表里是没有坐标的,请问要通过什么方法得到各拐点坐标呢?
"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2010-8-21 09:02:00 | 显示全部楼层
 楼主| 发表于 2010-8-22 00:19:00 | 显示全部楼层

谢谢Andyhon

发表于 2010-8-22 23:03:00 | 显示全部楼层
  1. ;;Using DXF codes vertices are sub entities of the 3dpoly, have to use (entnext ...)
  2. (defun get-3dpoly-by-alisp (poly / vtx elst lst)
  3.   (setq vtx (entnext poly))
  4.   (while (/= (cdr (assoc 0 (setq elst (entget vtx)))) "SEQEND")
  5.     (setq lst (cons (cdr (assoc 10 elst)) lst)
  6.    vtx (entnext vtx)
  7.     )
  8.   )
  9.   (reverse lst)
  10. )
  11. ;;Another way using VisualLISP
  12. (defun get-3dpoly-by-vlisp (poly / )
  13.   (vl-load-com)
  14.   ;; Split a flat list into a points list
  15.   (defun 3d-coord->pt-lst (lst)
  16.     (if lst
  17.       (cons (list (car lst) (cadr lst) (caddr lst))
  18.      (3d-coord->pt-lst (cdddr lst))
  19.       )
  20.     )
  21.   )
  22.   (3d-coord->pt-lst
  23.     (vlax-get (vlax-ename->vla-object poly) 'Coordinates)
  24.   )
  25. )
  26. ;;test
  27. (defun C:test ()
  28.   (if (setq 3dpoly (car (entsel)))
  29.     (if (= (cdr (assoc 0 (entget 3dpoly)))  "POLYLINE")
  30.       ;;(get-3dpoly-by-alisp 3dpoly)  ;1ST way
  31.       (get-3dpoly-by-vlisp 3dpoly) ;2ND way
  32.     )
  33.   )
  34. )
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-10-2 10:27 , Processed in 0.172054 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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