(defun PARALLEL (LN1 LN2 / ANG1 ANG2 PFUZZ)
(if (= (type LN1) 'ENAME)
(setq LN1 (entget LN1)
LN2 (entget LN2)
)
)
(setq ANG1 (angle (cdr (assoc 10 LN1)) (cdr (assoc 11 LN1))))
(setq ANG2 (angle (cdr (assoc 10 LN2)) (cdr (assoc 11 LN2))))
(setq PFUZZ 0.001)
(or (equal ANG1 ANG2 PFUZZ)
;;Check for lines drawn in opposite directions
(equal (min ANG1 ANG2) (- (max ANG1 ANG2) pi) PFUZZ)
)
)
本帖最后由 caoyin 于 2011-6-10 14:02 编辑
carrot1983 发表于 2011-6-10 08:56 http://bbs.mjtd.com/static/image/common/back.gif
;;test for parallel CAB 10/18/05
(defun PARALLEL (LN1 LN2 / ANG1 ANG2 PFUZZ)
(if (=...
假设2根直线的角度分别是359.99999999度和0.00000001度,你的程序就判断出错了,呵呵
方法1:
(inters P1 P2 P3 P4 nil)
方法2:
(setq ANG (ABS (- ANG1 ANG2)))
(or (equal ANG 0 1-E6)
(equal ANG 0 PI 1-E6)
)
页:
1
[2]