飞龙在天 发表于 2003-3-20 21:51:00

有一根垂直线和很多水平线,水平线均与垂线T形相交,如何获得交点信息?

chg 发表于 2003-3-21 10:35:00

这是在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)
)
)

meflying 发表于 2003-3-21 10:45:00

水平线的一个端点不就是交点吗?只要判断一下端点的横坐标就可知道交点了

页: [1]
查看完整版本: 有一根垂直线和很多水平线,水平线均与垂线T形相交,如何获得交点信息?