这是asen在2008年4月27日发表的帖子中的一个函数,见
http://bbs.mjtd.com/forum.php?mod=viewthread&tid=67300
- (defun c:n (/ obj p1 p2 p3 li)
- (setq obj (vlax-ename->vla-object (car (entsel "\ncurve: ")))
- p1 (trans (getpoint "\npoint 1: ") 1 0)
- p2 (trans (getpoint p1 "\npoint 2: ") 1 0)
- li (vla-addline (vla-get-ModelSpace (vla-get-ActiveDocument (vlax-get-acad-object)))(vlax-3d-point p1)(vlax-3d-point p2))
- p3 (vlax-invoke obj 'IntersectWith li acExtendNone)
- )
- (if p3
- (vla-put-EndPoint li (vlax-3d-point (list (car p3) (cadr p3) (caddr p3))))
- (vla-delete li)
- )
- (princ)
- )
函数可以直接求出直线与曲线的交点,但缺点和prolee2008一样,都是求最远的交点,而不是最近的交点。
|