;;; Delete entities within crossing polygon in user selected layouts
;;; Saved from here: https://www.theswamp.org/index.php?topic=51868.msg569096#msg569096

;;; LISP to reload all XREF's,and IMAGE's

(defun c:ra (/)
(vl-load-com)
(setvar "visretain" 1)
(vl-cmdf "_.-xref" "r" "*")
(vl-cmdf "_.-image" "r" "*")
(setvar "visretain" 1)
;(vl-cmdf "_.externalreferences")
(princ)
)

;;; LISP to unload all XREF's,and IMAGE's

(defun c:ua (/)
(vl-load-com)
(vl-cmdf "_.-xref" "u" "*")
(vl-cmdf "_.-image" "u" "*")

;(vl-cmdf "_.externalreferences")
(princ)
)
(defun c:dw1 (/ p1 p2 ss)

(vl-load-com)
;; http://www.lee-mac.com/listbox.html
;; List Box - Lee Mac
;; Displays a DCL list box allowing the user to make a selection from the supplied data.
;; msg - [str] Dialog label
;; lst - [lst] List of strings to display
;; bit - [int] 1=allow multiple; 2=return indexes
;; Returns: [lst] List of selected items/indexes, else nil

(defun LM:listbox (msg lst bit / dch des tmp rtn)
(cond
((not
(and
(setq tmp (vl-filename-mktemp nil nil ".dcl"))
(setq des (open tmp "w"))
(write-line
(strcat "listbox:dialog{label=\""
msg
"\";spacer;:list_box{key=\"list\";multiple_select="
(if (= 1 (logand 1 bit))
"true"
"false"
)
";width=50;height=15;}spacer;ok_cancel;}"
)
des
)
(not (close des))
(< 0 (setq dch (load_dialog tmp)))
(new_dialog "listbox" dch)
)
)
(prompt "\nError Loading List Box Dialog.")
)
(t
(start_list "list")
(foreach itm lst (add_list itm))
(end_list)
(setq rtn (set_tile "list" "0"))
(action_tile "list" "(setq rtn $value)")
(setq rtn
(if (= 1 (start_dialog))
(if (= 2 (logand 2 bit))
(read (strcat "(" rtn ")"))
(mapcar '(lambda (x) (nth x lst)) (read (strcat "(" rtn ")")))
)
)
)
)
)
(if (< 0 dch)
(unload_dialog dch)
)
(if (and tmp (setq tmp (findfile tmp)))
(vl-file-delete tmp)
)
rtn
)

(setq layouts (LM:listbox "Select Layouts to Delete from... " (layoutlist) 1))

(vl-load-com)
(if (and (= 0 (getvar 'tilemode))
(setq p1 (getpoint "\nSpecify first corner point: "))
(setq p2 (getcorner p1 "\nSpecify other corner point: "))
)
(foreach tab layouts
(setvar 'ctab tab)
(and (= 1 (getvar 'cvport)) (vlax-invoke (vlax-get-acad-object) 'zoomwindow p1 p2))
(if (setq ss (ssget "C" p1 p2 (list (cons 410 tab))))
(mapcar 'entdel (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))
)
)
)
(princ)
)
(defun c:dw (/)
(c:ua)
(c:dw1)
(c:ra)
)
(c:dw)

Advertisements