Files
revitDwgImportCleaner/source scripts/bindAndDetachXrefs.lsp

25 lines
604 B
Common Lisp

;; bindAndDetachXrefs.lsp
;;
;; bind and detach all xrefs, detach missing
;;
;; Created by Peter Gyetvai
;; gyetpet@mailbox.org
(defun C:bindAndDetachXrefs (/ really blk)
(graphscr)
(initget 1 "Yes No")
(setq really (getkword "Bind xrefs? [Yes/No]"))
(if
(= really "YES")
(foreach x
(mapcar 'cadr (ssnamex (ssget "_X" '((0 . "INSERT") (410 . "MODEL")))))
(setq blk (cdr (assoc 2 (entget x))))
(if (assoc 1 (tblsearch "block" blk))
(progn
(command "_.-xref" "_bind" blk)
(command "_.-xref" "_detach" blk)
)
)
)
)
)