;将程序修改为如下程序 ;点沿矢量到线的距离 (defun c:ddxjl() (setq xtblm '("cmdecho" "osmode") xtblz (mapcar 'getvar xtblm) ) (mapcar 'setvar xtblm '(0 0)) (while (setq p1 (getpoint "\n请指定点<回车结束>:")) (setq an (getangle p1 "\n请手指定矢量方向:") en (car (entsel "\n请选择线:")) ) (command "_line" p1 (setq p2 (polar p1 an 1e-10)) "" "_extend" en "" (list (setq en1 (entlast)) p2) "" ) (setq dis (rtos (distance p1 (cdr (assoc 11 (entget (entlast))))) 2 20)) (entdel (entlast)) (alert (strcat "点到沿矢量线的距离为:" dis)) (princ (strcat "\n点到沿矢量线的距离为:" dis)) ) (mapcar 'setvar xtblm xtblz)(princ) ) [glow=255,red,2]文字[/glow] |