I search out a lisp routine.It do it well.However,I find if the two outmost dimensions contain aligned dimensions,it can not do what
I want to do.Who can modify it?Running this routine needs to load libsub.fas.
(defun c:gps_deldm
(/ entlst i lst n pt1 pt2 ptlst ptx pty ss x xlst y ylst z)
;;;subfunction begins
(defun getapt (lst / i x y)
(setq x (nth 0 lst))
(setq i 1
y (nth i lst)
)
(while (and y (<= (fix (/ (- y x) 280.0)) 0))
(setq i (+ i 1)
y (nth i lst)
)
)
(setq x (last lst))
(setq i (- (length lst) 2)
z (nth i lst)
)
(while (and z (>= (fix (/ (- z x) 280.0)) 0))
(setq i (- i 1)
z (nth i lst)
)
)
(list y z)
)
;;;subfunction ends ---------------------------------
(princ "\n erase dimensions(retain the two outermost dimensions):")
(setq ss (ssget ":L" '((0 . "DIMENSION"))))
(if ss
(progn
(setq entlst (gps->ss-2lst ss))
(foreach n entlst
(setq ptlst (trans (dxf 10 (entget n)) 0 1))
(setq ptx (car ptlst))
(setq pty (cadr ptlst))
(setq xlst (append xlst (list ptx)))
(setq ylst (append ylst (list pty)))
)
(setq xlst (vl-sort xlst '<))
(setq ylst (vl-sort ylst '<))
(setq xlst (getapt xlst))
(setq ylst (getapt ylst))
(setq pt1 (list (+ (car xlst) 100) (+ (car ylst) 100)))
(setq pt2 (list (- (cadr xlst) 100) (- (cadr ylst) 100)))
(setq ss
(ssget
"w"
pt1
pt2
'((-4 . "<OR")
(-4 . "<AND")
(0 . "LEADER")
(-4 . "AND>")
(-4 . "<AND")
(0 . "*DIMENSION*")
(-4 . "AND>")
(-4 . "<AND")
(0 . "INSERT")
(-4 . "<OR")
(2 . "_SECTION")
(2 . "_AXISO")
(2 . "_AXISO#")
(-4 . "OR>")
(-4 . "AND>")
(-4 . "OR>")
)
)
)
(if ss
(command ".erase" ss "")
)
)
)
(gps->error-restore)
)