我有一个切正矩形的程请高手帮我改一下,改成选一任意矩形切图程序
(defun c:wSave(/ pzx pys p1 p2 p3 p4 s s1) (setq pzx (getpoint "\n选择左下角点(用鼠标直接点取或在命令行输入<x,y>):")) (setq pys (getpoint "\n选择右上角点(用鼠标直接点取或在命令行输入<x,y>):")) (setq p1 (list (- (car pzx) 0.01) (- (cadr pzx) 0.01))) (setq p2 (list (+ (car pys) 0.01) (- (cadr pzx) 0.01))) (setq p3 (list (+ (car pys) 0.01) (+ (cadr pys) 0.01))) (setq p4 (list (- (car pzx) 0.01) (+ (cadr pys) 0.01))) (command "rectang" pzx pys) (setq s (ssget "L")) (command "trim" s "" "F" p1 p2 "" "F" p2 p3 "" "F" p3 p4 "" "F" p4 p1 "" "") (command "erase" s "") (setq s1 (ssget "WP" (list p1 p2 p3 p4 p1))) (rder s1) (setq s nil s1 nil) (setvar "FILEDIA" 0) (command "SaveAs" "" "d:\\test" "close" "n") (setvar "FILEDIA" 1) (princ) );end wSave (defun rder(s1 / s2 ent s3 n) (setq s2 (ssget "X")) (if (not s1) (command "erase" s2 "") (progn (setq s3 (ssadd) n 0) (repeat (sslength s2) (setq ent (ssname s2 n)) (if (not (ssmemb ent s1)) (ssadd ent s3) ) (setq n (1+ n)) ) (command "erase" s3 "" "redraw") ) ) );end rder
|