画线能否改成不移屏!
<p>(defun c:pp ()<br/> (setvar "cmdecho" 0)<br/> (command "undo" "g")<br/> (if (setq point (getpoint "\nfrom point"))<br/> (progn<br/> (setq draw t<br/> ss (ssadd)<br/> pts nil<br/> pts (cons point pts)<br/> )<br/> (while draw<br/> (initget 128)<br/> (setq point (getpoint (car pts) "\nUndo/Reverse/Close/<Endpoint to line>:"))<br/> (cond<br/> ((= point "u")<br/> (if (= (length pts) 1)<br/> (print "can't undo.")<br/> (progn<br/> (setq pts (cdr pts))<br/> (command "zoom" "c" (car pts) "100")<br/> (command "erase" (entlast) "")<br/> )<br/> )<br/> )<br/> ((= point "r")<br/> (command "zoom" "c" (car (reverse pts)) "100")<br/> (setq point (getpoint (car (reverse pts)))) <br/> (command "pline" (car (reverse pts)) point "")<br/> (command "zoom" "c" point "100")<br/> (setq pts (cons point (reverse pts))<br/> ss (ssadd (entlast) ss)<br/> )<br/> )<br/> ((= (type point) 'list)<br/> (command "zoom" "c" point "100")<br/> (command "pline" (car pts) point "")<br/> (setq pts (cons point pts)<br/> ss (ssadd (entlast) ss)<br/> )<br/> )<br/> ((or (= point nil) (= point "e") (= point "c"))<br/> (command "pline" (car pts) (car pts) "")<br/> (setq ss (ssadd (entlast) ss))<br/> (setq draw nil)<br/> )<br/> (t (print "输入错误!只能输入点坐标或关键字."))<br/> )<br/> )<br/> (if (> (length pts) 1)<br/> (progn<br/> (command "pline")<br/> (while pts<br/> (command (car pts))<br/> (setq pts (cdr pts))<br/> )<br/> (if (= point "c")<br/> (command "c")<br/> (command "")<br/> )<br/> (command "erase" ss "")<br/> )<br/> )<br/> )<br/> )<br/> (command "undo" "e")<br/> (prin1)<br/>)</p> <p>在里面加上圆弧!!!就和CAD里的pline差不多的功能!!</p> 描绘等高线是舒服多了! 来个精简版本的,代码如下:;;;功能:绘制线段时自动移动窗口
;;;日期:zml84 于 2007-04-17
(defun c:tt (/ pt0 ss pt1)
(if (setq pt0 (getpoint "\n第一点:"))
(progn
(setq ss (ssadd))
;;绘制各段直线
(while (setq pt1 (getpoint pt0 "\n下一点:"))
(command "._pan" pt1 (getvar "VIEWCTR"))
(command "._line" pt0 pt1 "")
(setq ss(ssadd (entlast) ss)
pt0 pt1
)
)
;;将各段直线连接成PLINE
(if (> (sslength ss) 0)
(command "._pedit" (ssname ss 0) "y" "j" ss "" "")
)
)
)
(princ)
) zml84 发表于 2007-4-17 11:39 static/image/common/back.gif
来个精简版本的,代码如下:
太强大了! zml84 发表于 2007-4-17 11:39
来个精简版本的,代码如下:
厉害了,刚看到源码,就找到精简版的了
页:
[1]