;;作者 by tryhi 【http://bbs.mjtd.com/thread-170291-1-1.html】
(defun c:trxx(/ *error* dd echox osmode p0 p1 ss);超级修剪
(setq osmode (getvar "osmode")echox (getvar "cmdecho"));记录两个原始系统变量
(setvar "osmode" 0);关闭捕捉
(setvar "cmdecho" 0)
(defun *ERROR* (MSG)
(if osmode
(progn
(setvar "osmode" osmode)
(setvar "CMDECHO" echox)
(command"undo" "end")
)
)
)
(while (setq p0 (getpoint "\n开始: "));开始点
(command"undo" "be");撤销命令开始
(setq dd (* 0.01 (getvar "viewsize")));设置随意线长度
(while (= 5 (car (setq p1 (grread t 4 0))));捕捉鼠标移动
(setq p1 (cadr p1));鼠标位置
(if (>= (distance p0 p1) dd);移动超过长度才继续
(progn
(grdraw p0 p1 1);屏幕显示矢量线
(command "trim" "" "f" p0 p1 "" "");修剪
(if (setq ss (ssget "f" (list p0 p1)));获取先交又没有修剪的
(command "erase" ss "");删除
)
(setq p0 p1);设置p为后一点
)
)
)
(command"undo" "end");撤销命令结束
(redraw)
)
(setvar "osmode" osmode);恢复捕捉
(setvar "CMDECHO" echox)
(princ)
)