本帖最后由 菜卷鱼 于 2014-3-22 12:32 编辑
经过听取黄大师的建议,改良了,应该符合要求,字高自己改
- (defun c:vv( )
- (setq p1(getpoint "\n第一点"))
- (setq p2(getpoint p1 "\n第二点"))
- (command "_.line" p1 p2 "")
- (setq en (entlast ))
- (setq ss(ssdel en(ssget "f" (list p1 p2) '((0 . "*line")))))
- (setq i 0)
- (repeat(sslength ss)
- (setq it (vlax-invoke (vlax-ename->vla-object en) 'IntersectWith (vlax-ename->vla-object (ssname ss i)) acExtendNone))
- (if (/= it nil)
- (progn
- (setq str (apply 'strcat (mapcar 'strcat (mapcar 'rtos it) (list "," "," ""))))
- (entmake (list '(0 . "text") (cons 1 str) (cons 10 it)(cons 40(*(getvar 'textsize)(getvar 'dimscale)) ) ))
- ))
- (setq i(1+ i))
- )
- (prin1)
- )
|