明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1510|回复: 2

[LISP]求教:等高线交点为什么返回为空?

[复制链接]
发表于 2004-6-5 14:33:00 | 显示全部楼层 |阅读模式
请各位大哥帮忙看一下我的程序,为什么求交,没有返回的列表。要是有,请问怎么样让它们按横坐标排列?;================================================================
(vl-load-com)
(defun GetPlXY (ename fit / en closeID ptype i len v vn pl p isfit fittag hval) (setq en (entget ename)
ptype (cdr (assoc 0 en))
pl nil
fittag (cdr (assoc 70 en))
fittag (if fittag fittag 0)
isfit (logand fittag 2)
closeID (logand fittag 1)
hval (cdr (assoc 38 en))
) (if (or (= ptype "LWPOLYLINE") (= ptype "POLYLINE"))
(progn
(setvar "useri1" closeID )
(setvar "useri2" isfit )
(if (null hval) (setq hval 9999))
(setvar "userr1" hval )

(cond
( (= ptype "LWPOLYLINE")
(progn
(SETQ I 0 LEN (LENGTH EN))
(WHILE (< I LEN)
(SETQ VN (LIST (NTH I EN)))
(SETQ P (CDR (ASSOC 10 VN)))
(IF P (SETQ PL (CONS P PL)))
(SETQ I (1+ I))
)
)
)
( (= ptype "POLYLINE")
(progn
(setvar "useri2" 2 )
(setq v (entnext ename))
(setq vn (entget v))
(while (= (cdr (assoc 0 vn)) "VERTEX")
(if (or fit (= 0 (cdr (assoc 70 vn))) ) ; (0 p)--- P is survey point
(setq pl (cons (cdr (assoc 10 vn)) pl)) ; (1 p)----p is fit point
)
(setq v (entnext v))
(setq vn (entget v))
); end while
)
)
); end cond (setq pl (reverse pl) )
(if (= 1 closeID) (setq pl (append pl (list (nth 0 pl)))))
))

pl

)
;;========================
; Function Get_Interpoint
; Return: Point of Intersection Of Line & Polyline
;;========================
(Defun Get_IntersPoint (p1 p2 ename / pl i listlen intp_lst firstpoint secondpoint intp)
(setq p1 '(0 150) p2 '(1000 150))
(command "line" p1 p2"")
(setq T (ssget "x" '((0 . "line"))))
(setq pl (GetPlXY ename T))
(setq i 0 listlen (length pl))
(setq intp_lst nil)
(while (< i (1- listlen))
(setq firstpoint (nth i pl) secondpoint (nth (1+ i) pl))
(if (/= (setq intp (inters p1 p2 firstpoint secondpoint T)) nil)
(progn
(setq intp_lst (cons intp intp_lst))
))
(setq i (1+ i))
)
intp_lst
)
(princ)
发表于 2004-6-5 17:02:00 | 显示全部楼层
因为等高线是三纬的就是不相交
 楼主| 发表于 2004-6-5 22:23:00 | 显示全部楼层
怎么样才可以啊?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-10-1 06:17 , Processed in 0.159167 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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