有一根垂直线和很多水平线,水平线均与垂线T形相交,如何获得交点信息?
这是在xdcad上的一个求交点的函数。
Autolisp本身的函数有(inters p1 p2 p3 p4 );;;VxGetInters - 返回两个物体的所有交点
; -- Function VxGetInters
; Arguments :
; Fst = First object
; Nxt = Second object
; Mde = Intersection mode
; Constants:
; - acExtendNone Does 不延伸
; - acExtendThisEntity 延伸第一
; - acExtendOtherEntity 延伸第二
; - acExtendBoth 延伸两者
; Return :
; > list of points '((1.0 1.0 0.0)...
; > Nil if no intersection found
;
(defun VxGetInters (Fst Nxt Mde / IntLst PntLst);;;实体交点
(setq IntLst (vlax-invoke Fst "IntersectWith" Nxt Mde))
(cond
(IntLst
(repeat (/ (length IntLst) 3)
(setq PntLst
(cons
(list(car IntLst)(cadr IntLst)(caddr IntLst))
PntLst
)
IntLst (cdddr IntLst))
)
(reverse PntLst)
)
(T nil)
)
)
水平线的一个端点不就是交点吗?只要判断一下端点的横坐标就可知道交点了
页:
[1]