;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;多边形剪切;;裁剪内部数据 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun c:ksjq() (command"undo" "BE")
(princ "\n欢迎使用快捷剪切程序,裁剪范围以内的数据!命令名:ksjq=== mdjchy 郭海录 2009.12.29===") (setq pt (getpoint "\n 指定第一点:")) (command "pline") (while pt (command pt) (setq pt (getpoint pt "\n 指定下一点(回车自动结束):")) ) (command "c") (command "osnap" "off") (command "zoom" "e" "") ;;;;;;;;;;;;;;;;裁剪;;;;;;;;;;;;;;;;;;; (setq ma (ssname (ssget "L") 0)) (setq p0 (getpoint "\n选择范围内的任意一点:")) (command "offset" 0.2 ma p0 "") (setq mb (ssname (ssget "L") 0)) (setq bb (entget mb)) (setq d1 nil) (setq nn1 (length bb) k2 1) (while (< k2 nn1) (if(or (= 10 (car ( nth k2 bb))) (= 11 (car ( nth k2 bb))) ) (progn (setq x (atof (rtos (nth 1 (nth k2 bb)) 2 3))) (setq y (atof (rtos (nth 2 (nth k2 bb)) 2 3))) (setq d1 (cons (list x y) d1)) ) ) (setq k2 (+ 1 k2)) ) (setq mn1 (length d1)) (setq km 0) (while (<= km (- mn1 1)) (progn (setq pt3 (nth km d1)) (setq km1 (+ 1 km)) (setq pt4 (nth km1 d1)) (command "trim" ma "" "f" pt3 pt4 "" "") ) (setq km (+ 1 km)) ) (setq pt3 (nth 0 d1)) (setq pt4 (nth (- mn1 1) d1)) (command "trim" ma "" "f" pt3 pt4 "" "")
;;;;;;;;;;;;;;删除;;;;;;;;;;;;;;;;; (setq kn 1) (command "erase" "wp") (setq pt1 (nth 0 d1)) (command pt1) (while (< kn mn1)
(progn (setq pt1 (nth kn d1)) (command pt1) ) (setq kn (+ 1 kn)) ) (command "" "")
(command "erase" ma "" "") (command "erase" mb "" "") (command"undo" "e")
)
|