line命令时每次只画一条线
请问如何在用line命令时每次只画一条线,而不是连续画多条线! (defun c:linex (/ p1 p2 dist ang ents pts linefuzz angfuzz)(setq linefuzz 4.0)
(setq angfuzz 0.001)
(defun makepline (spc pts / norm elv pline)
(setq norm (trans '(0 0 1) 1 0 t)
elv(caddr (trans (car pts) 1 norm))
)
(setq pline
(vlax-invoke
spc
'addlightweightpolyline
(apply 'append
(mapcar '(lambda (pt)
(setq pt (trans pt 1 norm))
(list (car pt) (cadr pt))
)
pts
)
)
)
)
(vla-put-elevation pline elv)
(vla-put-normal pline (vlax-3d-point norm))
pline
)
(setq 45deg (/ pi 4))
(setq p1 (getpoint "\n指定第一点: "))
(while (and p1
(setq p2 (getpoint p1 "\n下一点:"))
)
(setq dist (distance p1 p2)
ang(angle p1 p2)
)
(setq dist (* (fix (+ (/ dist linefuzz) 0.99)) linefuzz))
(if (< (rem ang 45deg) 0.0523599)
(setq ang (* 45deg (fix (/ ang 45deg))))
(princ (strcat "\nWarning: Segment "
(itoa (max (length pts) 1))
" is a non standard angle."
)
)
)
(setq p2 (polar p1 ang dist))
(setq ents (cons
(entmakex
(list (cons 0 "LINE")
(cons 6 "BYLAYER")
(cons 10 p1)
(cons 11 p2)
(cons 39 0.0)
(cons 62 256)
)
)
ents
)
pts(if pts
(cons p2 pts)
(list p2 p1)
)
)
(setq p1 p2)
)
(and pts
(null (initget "Yes No"))
(/= (getkword "\n转换为多段线[(Y)es/(N)o] <Yes>: ")
"No"
)
(makepline
(if (= 1 (getvar "CVPORT"))
(vla-get-paperspace
(vla-get-activedocument (vlax-get-acad-object))
)
(vla-get-modelspace
(vla-get-activedocument (vlax-get-acad-object))
)
)
pts
)
(mapcar 'entdel ents)
)
(princ)
) 这个程序是干什么用? 画完一条线就回车结束,不要再继续点击左键了……或你把你的问题说清楚点?比方说你感到有何不便…… 怀疑你的 LINE 命令被重新定义了,或许是中了 lsp 病毒造成的;试试 .line 命令,就在 line 前加个小数点,这个应该是正常的
页:
[1]