From 135008b4c40e2ebfb2a8b57bc27501c0b03ba7b5 Mon Sep 17 00:00:00 2001 From: infeeeee Date: Wed, 18 Sep 2019 22:06:22 +0200 Subject: [PATCH] added xref management and proxygraphics --- README.md | 3 ++- revitDwgImportCleaner.scr | 28 ++++++++++++++++++++------- source scripts/bindAndDetachXrefs.lsp | 21 ++++++++++++++++++++ 3 files changed, 44 insertions(+), 8 deletions(-) create mode 100644 source scripts/bindAndDetachXrefs.lsp diff --git a/README.md b/README.md index 0e6b260..94968c3 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,12 @@ Clean dwg files before linking them to Revit ### Current features: - change to model space +- binds and detaches all xrefs (you can uncomment this line so it only detaches them) - remove all xlines from model space and from blocks - delete all points from modelspace - move hatches to separate layers - attribute definitions not in block to txt because they are not showing up in Revit +- PROXYGRAPHICS=1 (one less annoying dialog) - purge - audit - save as 2013 dwg @@ -17,6 +19,5 @@ Clean dwg files before linking them to Revit - move closer to origin - remove layouts -- do something with xrefs(bind or purge) - replace heavy linestyles and hatches - ask for units for automatic import \ No newline at end of file diff --git a/revitDwgImportCleaner.scr b/revitDwgImportCleaner.scr index cb3aa5b..4e1c551 100644 --- a/revitDwgImportCleaner.scr +++ b/revitDwgImportCleaner.scr @@ -4,13 +4,25 @@ ; ._MODEL ;------------------------------------------------------------ -;XREF manegement is completely disabled until I fix it -;._-xref -;r -;* -;._-xref -;b -;* +;XREFS: bind and detach all +(defun C:bindAndDetachXrefs (/ blk) + (graphscr) + (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) + ) + ) + ) +) +;If you don't want to bind just detach uncomment the following line: +bindAndDetachXrefs +;------------------------------------------------------------ +;Detach all xrefs. +._-xref d * ;------------------------------------------------------------ ;deleteAllXlines.lsp: deletes all xlines in modelspace (defun C:dax (/ ss) @@ -154,6 +166,8 @@ sephatch ) AttDef2Text ;------------------------------------------------------------ +PROXYGRAPHICS +1 ._-PURGE a * diff --git a/source scripts/bindAndDetachXrefs.lsp b/source scripts/bindAndDetachXrefs.lsp new file mode 100644 index 0000000..fca1f62 --- /dev/null +++ b/source scripts/bindAndDetachXrefs.lsp @@ -0,0 +1,21 @@ +;; bindAndDetachXrefs.lsp +;; +;; bind and detach all xrefs, detach missing +;; +;; Created by Peter Gyetvai +;; gyetpet@mailbox.org + +(defun C:bindAndDetachXrefs (/ blk) + (graphscr) + + (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) + ) + ) + ) +) \ No newline at end of file