;;; UNLOAD_WIPEOUT (gile)
;;; Removes all wipeouts in Model space and stores their datas in a dictionary

(defun c:uw (/ ss dict n ent xname)
(if (setq ss (ssget “_X” ‘((0 . “WIPEOUT”) (410 . “Model”))))
(progn
(or (setq dict
(cdr (assoc -1 (dictsearch (namedobjdict) “GILE_WIPEOUT”))
)
)
(setq dict
(dictadd (namedobjdict)
“GILE_WIPEOUT”
(entmakex
‘((0 . “DICTIONARY”) (100 . “AcDbDictionary”))
)
)
)
)
(setq n 0)
(while (setq ent (ssname ss n))
(setq xname
(entmakex
(append
‘((0 . “XRECORD”) (100 . “AcDbXrecord”))
(vl-remove-if-not
‘(lambda (x)
(member (car x)
‘(8 90 10 11 12 13 70 280 71 14)
)
)
(entget ent)
)
)
)
)
(dictadd
dict
(strcat “W” (itoa (setq n (1+ n))))
xname
)
(entdel ent)
)
)
)
(princ)
)

;;; RELOAD_WIPEOUT (gile)
;;; Recrates wipeouts from the dictionary

(defun c:rw (/ dict elst)
(if (setq dict (dictsearch (namedobjdict) “GILE_WIPEOUT”))
(progn
(setq elst (member ‘(3 . “W1”) dict))
(while elst
(entmake
(append ‘((0 . “WIPEOUT”)
(100 . “AcDbEntity”)
(100 . “AcDbWipeout”)
(410 . “Model”)
)
(cdr (member ‘(280 . 1) (entget (cdadr elst))))
)
)
(setq elst (cddr elst))
)
(dictremove (namedobjdict) “GILE_WIPEOUT”)
)
)
(princ)
)

Advertisements