1. ;;作者 by tryhi http://bbs.mjtd.com/thread-170291-1-1.html】
    2. (defun c:trxx(/ *error* dd echox osmode p0 p1 ss);超级修剪
    3. (setq osmode (getvar "osmode")echox (getvar "cmdecho"));记录两个原始系统变量
    4. (setvar "osmode" 0);关闭捕捉
    5. (setvar "cmdecho" 0)
    6. (defun *ERROR* (MSG)
    7. (if osmode
    8. (progn
    9. (setvar "osmode" osmode)
    10. (setvar "CMDECHO" echox)
    11. (command"undo" "end")
    12. )
    13. )
    14. )
    15. (while (setq p0 (getpoint "\n开始: "));开始点
    16. (command"undo" "be");撤销命令开始
    17. (setq dd (* 0.01 (getvar "viewsize")));设置随意线长度
    18. (while (= 5 (car (setq p1 (grread t 4 0))));捕捉鼠标移动
    19. (setq p1 (cadr p1));鼠标位置
    20. (if (>= (distance p0 p1) dd);移动超过长度才继续
    21. (progn
    22. (grdraw p0 p1 1);屏幕显示矢量线
    23. (command "trim" "" "f" p0 p1 "" "");修剪
    24. (if (setq ss (ssget "f" (list p0 p1)));获取先交又没有修剪的
    25. (command "erase" ss "");删除
    26. )
    27. (setq p0 p1);设置p为后一点
    28. )
    29. )
    30. )
    31. (command"undo" "end");撤销命令结束
    32. (redraw)
    33. )
    34. (setvar "osmode" osmode);恢复捕捉
    35. (setvar "CMDECHO" echox)
    36. (princ)
    37. )

    [trxx]超级修剪.gif