明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

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

[求助]了lisp读取顶点坐标写文本

  [复制链接]
发表于 2007-3-24 15:41:00 | 显示全部楼层
我在江苏,很近的,qq:498719189
发表于 2007-3-24 16:18:00 | 显示全部楼层
江苏,哪里。我在江苏宜兴。苏州无锡一带经常走动。我的qq:420200466,有空联系
发表于 2007-3-24 16:27:00 | 显示全部楼层
江苏宝应,我宜兴同学很多。有空联系
 楼主| 发表于 2007-3-25 09:48:00 | 显示全部楼层
各位热心的朋友,用空找我玩。上面有我的联系方式,我是干测量的。希望能多交爱好软件的朋友
发表于 2007-3-26 09:16:00 | 显示全部楼层
发表于 2007-4-2 18:51:00 | 显示全部楼层
  1. ;;方法一
  2. ;;Using DXF codes vertices are sub entities of the 3dpoly, have to use (entnext ...)
  3. (defun get-3dpoly-by-alisp (poly / vtx elst lst)
  4.   (setq vtx (entnext poly))
  5.   (while (/= (cdr (assoc 0 (setq elst (entget vtx)))) "SEQEND")
  6.     (setq lst (cons (cdr (assoc 10 elst)) lst)
  7.     vtx (entnext vtx)
  8.     )
  9.   )
  10.   (reverse lst)
  11. )
  12. ;;方法二
  13. ;;Another way using VisualLISP
  14. (defun get-3dpoly-by-vlisp (poly / )
  15.   (vl-load-com)
  16.   ;; Split a flat list into a points list
  17.   (defun 3d-coord->pt-lst (lst)
  18.     (if  lst
  19.       (cons (list (car lst) (cadr lst) (caddr lst))
  20.       (3d-coord->pt-lst (cdddr lst))
  21.       )
  22.     )
  23.   )
  24.   (3d-coord->pt-lst
  25.     (vlax-get (vlax-ename->vla-object poly) 'Coordinates)
  26.   )
  27. )
  28. ;;test
  29. (defun C:test ()
  30.   (if (setq 3dpoly (car (entsel)))
  31.     (if (= (cdr (assoc 0 (entget 3dpoly)))  "POLYLINE")
  32.       (get-3dpoly-by-alisp 3dpoly)  ;1ST way
  33.       ;(get-3dpoly-by-vlisp 3dpoly) ;2ND way
  34.     )
  35.   )
  36. )
这个问题在autodesk讨论组中出现过。  
两种方法,比前面帖子的代码精炼些。两种方法都可单独成为函数。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-6-20 20:57 , Processed in 0.259005 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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