二维点转成三维点
本帖最后由 自贡黄明儒 于 2014-2-14 13:39 编辑;;判断为点
(defun IsPoint (p)
(not(VL-CATCH-ALL-ERROR-P (VL-CATCH-ALL-APPLY 'distance (list '(0 0) P))))
)
;;是二维点
(defun Is2Point (p)
(and (IsPoint P) (= (length p) 2))
)
;;是三维点
(defun Is3Point (p)
(and (IsPoint P) (= (length p) 3))
)
;;二维点转成三维点
(defun 2P=>3P (P)
(if (Is2Point P)
(append p '(0))
)
)
;;三维点转成二点
(defun 3P=>2P (P)
(if (Is3Point P)
(mapcar '+ p '(0 0))
)
) 咋么用啊》 不错,黄老师不断的做累活,当代雷锋啊, soly2006 发表于 2014-2-14 16:04 static/image/common/back.gif
不错,黄老师不断的做累活,当代雷锋啊,
大家不断探讨,才能提高。在晓东上,st788796就回了,判断是否是一个点,还有别的好办法,我双学到一招
(defun isPoint2 (p)
(not
(vl-catch-all-error-p (vl-catch-all-apply 'vlax-3d-point (list p)))
)
) ;; 来个简陋而繁琐的(defun ispoint (pt)
(if (and (= (type pt) 'LIST)
(member (length pt) '(2 3))
(setq n1 (length pt)
pt (vl-remove-if '(lambda (x) (not (numberp x))) pt)
n2 (length pt)
)
(= n1 n2)
)
t
nil
)
) 都是高手啊! xyp1964 发表于 2014-2-14 22:15 static/image/common/back.gif
;; 来个简陋而繁琐的
X版,我觉得这样更简化
(defun ispoint (pt)
(and (= (type pt) 'LIST)
(member (length pt) '(2 3))
(vl-every 'numberp pt)
)
) 谢谢长老! 学习到了,谢谢老师们 感谢大佬学习了
页:
[1]